mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-22 09:14:26 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7347b2d316 | ||
|
|
58f5a6af40 | ||
|
|
888f3f0178 | ||
|
|
692be7fef0 | ||
|
|
4bfd57ce09 | ||
|
|
964db18ed6 | ||
|
|
598c90ee77 | ||
|
|
f7f37a7a0b | ||
|
|
671dc16a4a | ||
|
|
b3be630198 | ||
|
|
5aca537f83 |
+1
-5
@@ -1,12 +1,10 @@
|
|||||||
*.cache
|
*.cache
|
||||||
*.flc
|
*.flc
|
||||||
|
*.patch *.log log patches applied
|
||||||
*.prj
|
*.prj
|
||||||
*~
|
|
||||||
.tarball-version
|
|
||||||
.version
|
.version
|
||||||
ABOUT-NLS
|
ABOUT-NLS
|
||||||
COPYING
|
COPYING
|
||||||
GNUmakefile
|
|
||||||
INSTALL
|
INSTALL
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
@@ -23,10 +21,8 @@ config.status
|
|||||||
configure
|
configure
|
||||||
configure.lineno
|
configure.lineno
|
||||||
conftest*
|
conftest*
|
||||||
gnulib
|
|
||||||
javacomp.sh
|
javacomp.sh
|
||||||
javaexec.sh
|
javaexec.sh
|
||||||
maint.mk
|
|
||||||
patches
|
patches
|
||||||
releases
|
releases
|
||||||
stamp-h*
|
stamp-h*
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
ChangeLog merge=merge-changelog
|
|
||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
/*.cache
|
|
||||||
/*.flc
|
|
||||||
/*.prj
|
|
||||||
/*~
|
|
||||||
/.tarball-version
|
|
||||||
/.version
|
|
||||||
/ABOUT-NLS
|
|
||||||
/COPYING
|
|
||||||
/GNUmakefile
|
|
||||||
/INSTALL
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/_*
|
|
||||||
/a.exe
|
|
||||||
/a.out
|
|
||||||
/aclocal.m4
|
|
||||||
/b.out
|
|
||||||
/bison-*
|
|
||||||
/conf[0-9]*
|
|
||||||
/confdefs*
|
|
||||||
/config.log
|
|
||||||
/config.status
|
|
||||||
/configure
|
|
||||||
/configure.lineno
|
|
||||||
/conftest*
|
|
||||||
/gnulib
|
|
||||||
/javacomp.sh
|
|
||||||
/javaexec.sh
|
|
||||||
/maint.mk
|
|
||||||
/patches
|
|
||||||
/releases
|
|
||||||
/stamp-h*
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[submodule "gnulib"]
|
|
||||||
path = gnulib
|
|
||||||
url = git://git.savannah.gnu.org/gnulib.git
|
|
||||||
[submodule "submodules/autoconf"]
|
|
||||||
path = submodules/autoconf
|
|
||||||
url = git://git.sv.gnu.org/autoconf.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
2.3b
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@VERSION@
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
COPYING
|
|
||||||
^doc/fdl\.texi$
|
|
||||||
^doc/gpl-3\.0\.texi$
|
|
||||||
^doc/yacc\.1\.in$
|
|
||||||
^src/parse-gram\.h$
|
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
# Having a separate GNUmakefile lets me `include' the dynamically
|
||||||
|
# generated rules created via Makefile.maint as well as Makefile.maint itself.
|
||||||
|
# This makefile is used only if you run GNU Make.
|
||||||
|
# It is necessary if you want to build targets usually of interest
|
||||||
|
# only to the maintainer.
|
||||||
|
|
||||||
|
# Copyright (C) 2001, 2003, 2006-2007, 2008 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Systems where /bin/sh is not the default shell need this. The $(shell)
|
||||||
|
# command below won't work with e.g. stock DOS/Windows shells.
|
||||||
|
ifeq ($(wildcard /bin/s[h]),/bin/sh)
|
||||||
|
SHELL = /bin/sh
|
||||||
|
else
|
||||||
|
# will be used only with the next shell-test line, then overwritten
|
||||||
|
# by a configured-in value
|
||||||
|
SHELL = sh
|
||||||
|
endif
|
||||||
|
|
||||||
|
have-Makefile := $(shell test -f Makefile && echo yes)
|
||||||
|
|
||||||
|
# If the user runs GNU make but has not yet run ./configure,
|
||||||
|
# give them a diagnostic.
|
||||||
|
ifeq ($(have-Makefile),yes)
|
||||||
|
|
||||||
|
# Make tar archive easier to reproduce.
|
||||||
|
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||||
|
|
||||||
|
include Makefile
|
||||||
|
|
||||||
|
# Ensure that $(VERSION) is up to date for dist-related targets, but not
|
||||||
|
# for others: rerunning autoconf and recompiling everything isn't cheap.
|
||||||
|
ifeq (0,$(MAKELEVEL))
|
||||||
|
_is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
|
||||||
|
ifneq (,$(_is-dist-target))
|
||||||
|
_curr-ver := $(shell build-aux/git-version-gen .version)
|
||||||
|
ifneq ($(_curr-ver),$(VERSION))
|
||||||
|
$(info INFO: rerunning autoconf for new version string: $(_curr-ver))
|
||||||
|
dummy := $(shell rm -rf autom4te.cache; $(AUTOCONF))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(srcdir)/Makefile.cfg
|
||||||
|
include $(srcdir)/Makefile.maint
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo There seems to be no Makefile in this directory. 1>&2
|
||||||
|
@echo "You must run ./configure before running \`make'." 1>&2
|
||||||
|
@exit 1
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||||
|
# directory in parallel. This is necessary in case someone tries to
|
||||||
|
# build multiple targets on one command line.
|
||||||
|
.NOTPARALLEL:
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
-*- outline -*-
|
-*- outline -*-
|
||||||
|
|
||||||
This file attempts to describe the rules to use when hacking Bison.
|
This file attempts to describe the rules to use when hacking Bison.
|
||||||
Don't put this file into the distribution.
|
Don't put this file into the distribution. Don't mention it in the
|
||||||
|
ChangeLog.
|
||||||
|
|
||||||
Everything related to the development of Bison is on Savannah:
|
Everything related to the development of Bison is on Savannah:
|
||||||
|
|
||||||
http://savannah.gnu.org/projects/bison/
|
http://savannah.gnu.org/projects/bison/
|
||||||
|
|
||||||
|
|
||||||
* Administrivia
|
* Administrivia
|
||||||
@@ -25,15 +26,6 @@ The correct response to most actual bugs is to write a new test case
|
|||||||
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||||
and check everything in.
|
and check everything in.
|
||||||
|
|
||||||
** You may find it useful to install the git-merge-changelog merge driver:
|
|
||||||
|
|
||||||
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
|
|
||||||
|
|
||||||
When following the generic installation instructions there, keep in mind that
|
|
||||||
your clone of Bison's git repository already contains appropriate
|
|
||||||
.gitattributes files, and running Bison's bootstrap script will make the
|
|
||||||
necessary changes to .git/config.
|
|
||||||
|
|
||||||
|
|
||||||
* Hacking
|
* Hacking
|
||||||
|
|
||||||
@@ -47,118 +39,6 @@ of the .output file etc. This excludes impossible error messages
|
|||||||
meant for the maintainers only.
|
meant for the maintainers only.
|
||||||
|
|
||||||
|
|
||||||
* Working from the repository
|
|
||||||
|
|
||||||
These notes intend to help people working on the checked-out sources.
|
|
||||||
These requirements do not apply when building from a distribution tarball.
|
|
||||||
|
|
||||||
** Requirements
|
|
||||||
|
|
||||||
We've opted to keep only the highest-level sources in the repository.
|
|
||||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
|
||||||
requirements on anyone wishing to build from the just-checked-out sources.
|
|
||||||
For example, you have to use the latest stable versions of the maintainer
|
|
||||||
tools we depend upon, including:
|
|
||||||
|
|
||||||
- Automake <http://www.gnu.org/software/automake/>
|
|
||||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
|
||||||
- Flex <http://www.gnu.org/software/flex/>
|
|
||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
|
||||||
- Perl <http://www.cpan.org/>
|
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
|
||||||
- Tar <http://www.gnu.org/software/tar/>
|
|
||||||
|
|
||||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
|
||||||
Valgrind supports your architecture.
|
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping
|
|
||||||
issues. The bootstrap script attempts to discover when the C code
|
|
||||||
generated from the grammars is out of date, and to bootstrap with an
|
|
||||||
out-of-date version of the C code, but the process is not foolproof.
|
|
||||||
Also, you may run into similar problems yourself if you modify Bison.
|
|
||||||
|
|
||||||
Only building the initial full source tree will be a bit painful.
|
|
||||||
Later, after synchronizing from the repository a plain `make' should
|
|
||||||
be sufficient.
|
|
||||||
|
|
||||||
** First checkout
|
|
||||||
|
|
||||||
Obviously, if you are reading these notes, you did manage to check out
|
|
||||||
this package from the repository. For the record, you will find all the
|
|
||||||
relevant information on:
|
|
||||||
|
|
||||||
http://savannah.gnu.org/git/?group=bison
|
|
||||||
|
|
||||||
Bison uses Git submodules: subscriptions to other Git repositories.
|
|
||||||
In particular it uses gnulib, the GNU portability library. To ask Git
|
|
||||||
to perform the first checkout of the submodules, run
|
|
||||||
|
|
||||||
$ git submodule update --init
|
|
||||||
|
|
||||||
Git submodule support is weak before versions 1.6 and later, you
|
|
||||||
should probably upgrade Git if your version is older.
|
|
||||||
|
|
||||||
The next step is to get other files needed to build, which are
|
|
||||||
extracted from other source packages:
|
|
||||||
|
|
||||||
$ ./bootstrap
|
|
||||||
|
|
||||||
And there you are! Just
|
|
||||||
|
|
||||||
$ ./configure
|
|
||||||
$ make
|
|
||||||
$ make check
|
|
||||||
|
|
||||||
At this point, there should be no difference between your local copy,
|
|
||||||
and the master copy:
|
|
||||||
|
|
||||||
$ git diff
|
|
||||||
|
|
||||||
should output no difference.
|
|
||||||
|
|
||||||
Enjoy!
|
|
||||||
|
|
||||||
** Updating
|
|
||||||
|
|
||||||
The use of submodules make things somewhat different because git does
|
|
||||||
not support recursive operations: submodules must be taken care of
|
|
||||||
explicitly by the user.
|
|
||||||
|
|
||||||
*** Updating Bison
|
|
||||||
|
|
||||||
If you pull a newer version of a branch, say via `git pull', you might
|
|
||||||
import requests for updated submodules. A simple `git diff' will
|
|
||||||
reveal if the current version of the submodule (i.e., the actual
|
|
||||||
contents of the gnulib directory) and the current request from the
|
|
||||||
subscriber (i.e., the reference of the version of gnulib that the
|
|
||||||
Bison reporitory requests) differ. To upgrade the submodules (i.e.,
|
|
||||||
to check out the version that is actually requested by the subscriber,
|
|
||||||
run `git submodule update'.
|
|
||||||
|
|
||||||
$ git pull
|
|
||||||
$ git submodule update
|
|
||||||
|
|
||||||
*** Updating a submodule
|
|
||||||
To update a submodule, say gnulib, do as follows:
|
|
||||||
|
|
||||||
Get the most recent version of the master branch from git.
|
|
||||||
|
|
||||||
$ cd gnulib
|
|
||||||
$ git fetch
|
|
||||||
$ git checkout -b master --track origin/master
|
|
||||||
|
|
||||||
Make sure Bison can live with that version of gnulib.
|
|
||||||
|
|
||||||
$ cd ..
|
|
||||||
$ ./bootstrap
|
|
||||||
$ make distcheck
|
|
||||||
|
|
||||||
Register your changes.
|
|
||||||
|
|
||||||
$ git checkin ...
|
|
||||||
|
|
||||||
|
|
||||||
* Test suite
|
* Test suite
|
||||||
|
|
||||||
** make check
|
** make check
|
||||||
@@ -177,22 +57,11 @@ release:
|
|||||||
- runs the parsers under Valgrind.
|
- runs the parsers under Valgrind.
|
||||||
- runs the test suite with G++ as C compiler...
|
- runs the test suite with G++ as C compiler...
|
||||||
|
|
||||||
- run `make maintainer-push-check', which runs `make maintainer-check'
|
|
||||||
while activating the push implementation and its pull interface wrappers
|
|
||||||
in many test cases that were originally written to exercise only the
|
|
||||||
pull implementation. This makes certain the push implementation can
|
|
||||||
perform every task the pull implementation can.
|
|
||||||
|
|
||||||
- run `make maintainer-xml-check', which runs `make maintainer-check'
|
|
||||||
while checking Bison's XML automaton report for every working grammar
|
|
||||||
passed to Bison in the test suite. The check just diffs the output of
|
|
||||||
Bison's included XSLT style sheets with the output of --report=all and
|
|
||||||
--graph.
|
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||||
instance, `-traditional' to check that the parsers are K&R. Note
|
instance, `-traditional' to check that the parsers are K&R. Note
|
||||||
that it does not make sense for glr.c, which should be ANSI,
|
that it does not make sense for glr.c, which should be ANSI,
|
||||||
but currently is actually GNU C, nor for lalr1.cc.
|
but currently is actually GNU C, nor for lalr1.cc, which anyway is
|
||||||
|
not exercised yet in the test suite.
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
* Release Procedure
|
||||||
@@ -209,39 +78,15 @@ This covers PO files too. Sometimes a PO file contains problems that
|
|||||||
causes it to be rejected by recent Gettext releases; please report
|
causes it to be rejected by recent Gettext releases; please report
|
||||||
these to the Translation Project.
|
these to the Translation Project.
|
||||||
|
|
||||||
** Update README
|
|
||||||
Make sure the information in this file is current. Most notably, make sure it
|
|
||||||
recommends a version of GNU M4 that is compatible with the latest Bison
|
|
||||||
sources.
|
|
||||||
|
|
||||||
** Update NEWS
|
** Update NEWS
|
||||||
The version number, *and* the date of the release (including for
|
The version number, *and* the date of the release (including for
|
||||||
betas).
|
betas).
|
||||||
|
|
||||||
** Update ChangeLog
|
** Update ChangeLog
|
||||||
Should have an entry similar to `Version 1.49b.'.
|
Should have an entry similar to `Version 1.49b.'.
|
||||||
|
Check all this in once `make distcheck' passes.
|
||||||
** Update configure.ac
|
|
||||||
Be sure PACKAGE_COPYRIGHT_YEAR is up-to-date.
|
|
||||||
|
|
||||||
** Tag the release
|
|
||||||
Before Bison will build with the right version number, you must tag the release
|
|
||||||
in git. Do this after all other changes. The command is similar to:
|
|
||||||
|
|
||||||
git tag -a v2.3b
|
|
||||||
|
|
||||||
The log message can be simply:
|
|
||||||
|
|
||||||
Bison 2.3b
|
|
||||||
|
|
||||||
** Push
|
|
||||||
Once `make distcheck' passes, push your changes and the tag.
|
|
||||||
`git push' without arguments will not push the tag.
|
|
||||||
|
|
||||||
** make alpha
|
** make alpha
|
||||||
FIXME: `make alpha' is not maintained and is broken. These
|
|
||||||
instructions need to be replaced or removed.
|
|
||||||
|
|
||||||
Running `make alpha' is absolutely perfect for beta releases: it makes
|
Running `make alpha' is absolutely perfect for beta releases: it makes
|
||||||
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
||||||
announcement. It is so neat, that that's what I use anyway for
|
announcement. It is so neat, that that's what I use anyway for
|
||||||
@@ -253,86 +98,13 @@ If it fails, you're on your own...
|
|||||||
It requires GNU Make.
|
It requires GNU Make.
|
||||||
|
|
||||||
** Upload
|
** Upload
|
||||||
The generic GNU upload procedure is at:
|
Put the tarballs/xdeltas where they should be. Or put it somewhere,
|
||||||
|
and send the URL to [email protected].
|
||||||
|
|
||||||
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
|
** Bump the version number
|
||||||
|
In configure.ac. Run `make', check this in.
|
||||||
Follow the instructions there to register your information so you're permitted
|
|
||||||
to upload. Make sure your public key has been uploaded at least to
|
|
||||||
keys.gnupg.net. You can upload it with:
|
|
||||||
|
|
||||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
|
||||||
|
|
||||||
where F125BDF3 should be replaced with your key ID.
|
|
||||||
|
|
||||||
Here's a brief reminder of how to roll the tarballs and upload them:
|
|
||||||
|
|
||||||
*** make distcheck
|
|
||||||
*** gpg -b bison-2.3b.tar.gz
|
|
||||||
*** In a file named `bison-2.3b.tar.gz.directive', type:
|
|
||||||
|
|
||||||
version: 1.1
|
|
||||||
directory: bison
|
|
||||||
filename: bison-2.3b.tar.gz
|
|
||||||
|
|
||||||
*** gpg --clearsign bison-2.3b.tar.gz.directive
|
|
||||||
*** ftp ftp-upload.gnu.org # Log in as anonymous.
|
|
||||||
*** cd /incoming/alpha # cd /incoming/ftp for full release.
|
|
||||||
*** put bison-2.3b.tar.gz # This can take a while.
|
|
||||||
*** put bison-2.3b.tar.gz.sig
|
|
||||||
*** put bison-2.3b.tar.gz.directive.asc
|
|
||||||
*** Repeat all these steps for bison-2.3b.tar.bz2.
|
|
||||||
|
|
||||||
** Update Bison manual on www.gnu.org.
|
|
||||||
|
|
||||||
*** You need a non-anonymous checkout of the web pages directory.
|
|
||||||
|
|
||||||
$ cvs -d [email protected]:/web/bison checkout bison
|
|
||||||
|
|
||||||
*** Get familiar with the instructions for web page maintainers.
|
|
||||||
http://www.gnu.org/server/standards/readme_index.html
|
|
||||||
http://www.gnu.org/server/standards/README.software.html
|
|
||||||
especially the note about symlinks.
|
|
||||||
|
|
||||||
*** Build the web pages.
|
|
||||||
Assuming BISON_CHECKOUT refers to a checkout of the Bison dir, and
|
|
||||||
BISON_WWW_CHECKOUT refers to the web directory created above, do:
|
|
||||||
|
|
||||||
$ cd $BISON_CHECKOUT/doc
|
|
||||||
$ make stamp-vti
|
|
||||||
$ ../build-aux/gendocs.sh -o "$BISON_WWW_CHECKOUT/manual" \
|
|
||||||
bison "Bison - GNU parser generator"
|
|
||||||
$ cd $BISON_WWW_CHECKOUT
|
|
||||||
|
|
||||||
Verify that the result looks sane.
|
|
||||||
|
|
||||||
*** Commit the modified and the new files.
|
|
||||||
|
|
||||||
*** Remove old files.
|
|
||||||
Find the files which have not been overwritten (because they belonged to
|
|
||||||
sections that have been removed or renamed):
|
|
||||||
|
|
||||||
$ cd manual/html_node
|
|
||||||
$ ls -lt
|
|
||||||
|
|
||||||
Remove these files and commit their removal to CVS. For each of these
|
|
||||||
files, add a line to the file .symlinks. This will ensure that
|
|
||||||
hyperlinks to the removed files will redirect to the entire manual; this
|
|
||||||
is better than a 404 error.
|
|
||||||
|
|
||||||
There is a problem with 'index.html' being written twice (once for POSIX
|
|
||||||
function 'index', once for the table of contents); you can ignore this
|
|
||||||
issue.
|
|
||||||
|
|
||||||
** Announce
|
** Announce
|
||||||
To generate a template announcement file:
|
|
||||||
|
|
||||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
|
||||||
|
|
||||||
where alpha can be replaced by beta or major and F125BDF3 should be replaced
|
|
||||||
with your key ID. For an example of how to fill out the template, search the
|
|
||||||
mailing list archives for the most recent release announcement.
|
|
||||||
|
|
||||||
Complete/fix the announcement file, and send it at least to
|
Complete/fix the announcement file, and send it at least to
|
||||||
[email protected] (if a real release, or a ``serious beta''),
|
[email protected] (if a real release, or a ``serious beta''),
|
||||||
[email protected], [email protected], [email protected],
|
[email protected], [email protected], [email protected],
|
||||||
@@ -343,19 +115,10 @@ email to [email protected]. Do not make any Cc as the moderator will
|
|||||||
throw away anything cross-posted or Cc'ed. It really needs to be a
|
throw away anything cross-posted or Cc'ed. It really needs to be a
|
||||||
separate message.
|
separate message.
|
||||||
|
|
||||||
** Bump the version number
|
|
||||||
In configure.ac. Run `make'. So that developers don't accidentally add new
|
|
||||||
items to the old NEWS entry, create a new empty NEWS entry something like:
|
|
||||||
|
|
||||||
Changes in version ?.? (????-??-??):
|
|
||||||
|
|
||||||
Push these changes.
|
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009
|
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||||
Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+31
-57
@@ -1,70 +1,44 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
|
||||||
## Free Software Foundation, Inc.
|
## Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
## the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
## (at your option) any later version.
|
# (at your option) any later version.
|
||||||
##
|
#
|
||||||
## This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
## GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
##
|
#
|
||||||
## You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = po runtime-po .
|
SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc
|
||||||
if BISON_CXX_WORKS
|
|
||||||
SUBDIRS += examples/calc++
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Files installed for use by Automake.
|
# Files installed for use by Automake.
|
||||||
aclocaldir = @aclocaldir@
|
aclocaldir = @aclocaldir@
|
||||||
aclocal_DATA = m4/bison-i18n.m4
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
EXTRA_DIST = .prev-version .version \
|
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
|
||||||
cfg.mk \
|
OChangeLog PACKAGING \
|
||||||
OChangeLog PACKAGING
|
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
||||||
|
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
||||||
|
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
|
||||||
|
djgpp/fnchange.lst djgpp/testsuite.sed
|
||||||
|
|
||||||
# Initialization before completion by local.mk's.
|
|
||||||
AM_CFLAGS = $(WARN_CFLAGS)
|
|
||||||
AM_CPPFLAGS =
|
|
||||||
BUILT_SOURCES =
|
|
||||||
DISTCLEANFILES =
|
|
||||||
MOSTLYCLEANFILES =
|
|
||||||
SUFFIXES =
|
|
||||||
include build-aux/local.mk
|
|
||||||
include data/local.mk
|
|
||||||
include djgpp/local.mk
|
|
||||||
include doc/local.mk
|
|
||||||
include etc/local.mk
|
|
||||||
include examples/local.mk
|
|
||||||
include lib/local.mk
|
|
||||||
include src/local.mk
|
|
||||||
include tests/local.mk
|
|
||||||
|
|
||||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
.PHONY: maintainer-check
|
||||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
maintainer-check:
|
||||||
# working copy (for example, when you run autoreconf && make). Allowing these
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
# to fall out of sync appears to have little potential to improve Bison build
|
|
||||||
# efficiency (even if we were to replace VERSION/PACKAGE_VERSION with .version
|
|
||||||
# everywhere possible). On the other hand, it could be harmful. For example,
|
|
||||||
# a developer might naively reference .version in a test case while the bison
|
|
||||||
# executable still compiles with VERSION, and so the test case might fail or
|
|
||||||
# pass incorrectly.
|
|
||||||
BUILT_SOURCES += $(top_srcdir)/.version
|
|
||||||
$(top_srcdir)/.version: configure
|
|
||||||
echo $(VERSION) > $@-t && mv $@-t $@
|
|
||||||
dist-hook:
|
|
||||||
echo $(VERSION) > $(distdir)/.tarball-version
|
|
||||||
|
|
||||||
.PHONY: update-b4-copyright
|
.PHONY: maintainer-push-check
|
||||||
update-b4-copyright:
|
maintainer-push-check:
|
||||||
find data -type f \
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
| grep -v -E '^data/bison.m4$$' \
|
|
||||||
| xargs $(build_aux)/$@
|
.PHONY: maintainer-xml-check
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
maintainer-xml-check:
|
||||||
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
|
|||||||
+5
-18
@@ -1,26 +1,19 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize Makefile.maint. -*- makefile -*-
|
||||||
# Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
# Copyright (C) 2003, 2005, 2006, 2007 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
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# It's useful to run maintainer-*check* targets during development, but we
|
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
|
||||||
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
|
||||||
# targets are filtered out.
|
|
||||||
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
|
||||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
|
||||||
|
|
||||||
# Use alpha.gnu.org for alpha and beta releases.
|
# Use alpha.gnu.org for alpha and beta releases.
|
||||||
# Use ftp.gnu.org for major releases.
|
# Use ftp.gnu.org for major releases.
|
||||||
gnu_ftp_host-alpha = alpha.gnu.org
|
gnu_ftp_host-alpha = alpha.gnu.org
|
||||||
@@ -39,10 +32,4 @@ local-checks-to-skip = changelog-check
|
|||||||
|
|
||||||
# The local directory containing the checked-out copy of gnulib used in
|
# The local directory containing the checked-out copy of gnulib used in
|
||||||
# this release. Used solely to get a date for the "announcement" target.
|
# this release. Used solely to get a date for the "announcement" target.
|
||||||
gnulib_dir = $(srcdir)/../../gnulib
|
gnulib_dir = /gnulib
|
||||||
|
|
||||||
bootstrap-tools = autoconf,automake,flex,gnulib
|
|
||||||
|
|
||||||
update-copyright: update-b4-copyright
|
|
||||||
update-copyright-env = \
|
|
||||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
|
||||||
+637
@@ -0,0 +1,637 @@
|
|||||||
|
# -*-Makefile-*-
|
||||||
|
# This Makefile fragment is shared between the coreutils,
|
||||||
|
# CPPI, Bison, and Autoconf.
|
||||||
|
|
||||||
|
## Copyright (C) 2001-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# This is reported not to work with make-3.79.1
|
||||||
|
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
ME := Makefile.maint
|
||||||
|
|
||||||
|
# Do not save the original name or timestamp in the .tar.gz file.
|
||||||
|
# Use --rsyncable if available.
|
||||||
|
gzip_rsyncable = \
|
||||||
|
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
|
||||||
|
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
|
||||||
|
|
||||||
|
CVS = cvs
|
||||||
|
|
||||||
|
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||||
|
CVS_LIST = sh -c ' \
|
||||||
|
if test -x $(srcdir)/build-aux/cvsu; then \
|
||||||
|
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
|
||||||
|
else \
|
||||||
|
awk -F/ '\''{ \
|
||||||
|
if (!$$1 && $$3 !~ /^-/) { \
|
||||||
|
f=FILENAME; \
|
||||||
|
sub(/CVS\/Entries/, "", f); \
|
||||||
|
print f $$2; \
|
||||||
|
}}'\'' \
|
||||||
|
$$(find $${*-*} -name Entries -print) /dev/null; \
|
||||||
|
fi \
|
||||||
|
' dummy
|
||||||
|
|
||||||
|
CVS_LIST_EXCEPT = \
|
||||||
|
$(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
|
||||||
|
|
||||||
|
ifeq ($(origin prev_version_file), undefined)
|
||||||
|
prev_version_file = .prev-version
|
||||||
|
endif
|
||||||
|
|
||||||
|
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||||
|
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||||
|
|
||||||
|
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
||||||
|
tag-this-version = $(subst .,_,$(VERSION))
|
||||||
|
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
||||||
|
my_distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
# Old releases are stored here.
|
||||||
|
# Used for diffs and xdeltas.
|
||||||
|
release_archive_dir ?= ../release
|
||||||
|
|
||||||
|
# Prevent programs like 'sort' from considering distinct strings to be equal.
|
||||||
|
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
|
||||||
|
export LC_ALL = C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------- ##
|
||||||
|
## Sanity checks. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
|
||||||
|
# in system.h. E.g. today I removed from tail.c a useless definition of
|
||||||
|
# ENOSYS. It was useless because system.h ensures it's defined.
|
||||||
|
|
||||||
|
# Checks that don't require cvs.
|
||||||
|
# Run `changelog-check' last, as previous test may reveal problems requiring
|
||||||
|
# new ChangeLog entries.
|
||||||
|
local-checks-available = \
|
||||||
|
po-check copyright-check writable-files m4-check author_mark_check \
|
||||||
|
changelog-check strftime-check $(syntax-check-rules) \
|
||||||
|
makefile_path_separator_check \
|
||||||
|
makefile-check
|
||||||
|
.PHONY: $(local-checks-available)
|
||||||
|
|
||||||
|
local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
|
||||||
|
|
||||||
|
.PHONY: $(syntax-check-rules)
|
||||||
|
syntax-check-rules = \
|
||||||
|
sc_cast_of_argument_to_free \
|
||||||
|
sc_cast_of_x_alloc_return_value \
|
||||||
|
sc_cast_of_alloca_return_value \
|
||||||
|
sc_changelog \
|
||||||
|
sc_dd_max_sym_length \
|
||||||
|
sc_error_exit_success \
|
||||||
|
sc_file_system \
|
||||||
|
sc_no_if_have_config_h \
|
||||||
|
sc_obsolete_symbols \
|
||||||
|
sc_prohibit_atoi_atof \
|
||||||
|
sc_prohibit_jm_in_m4 \
|
||||||
|
sc_prohibit_assert_without_use \
|
||||||
|
sc_require_config_h \
|
||||||
|
sc_root_tests \
|
||||||
|
sc_space_tab \
|
||||||
|
sc_sun_os_names \
|
||||||
|
sc_system_h_headers \
|
||||||
|
sc_tight_scope \
|
||||||
|
sc_trailing_blank \
|
||||||
|
sc_two_space_separator_in_usage \
|
||||||
|
sc_unmarked_diagnostics \
|
||||||
|
sc_useless_cpp_parens
|
||||||
|
|
||||||
|
syntax-check: $(syntax-check-rules)
|
||||||
|
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
|
||||||
|
# $$(find -type f -name '*.[chly]') && \
|
||||||
|
# { echo '$(ME): found conditional include' 1>&2; \
|
||||||
|
# exit 1; } || :
|
||||||
|
|
||||||
|
# grep -nE '^# *include <(string|stdlib)\.h>' \
|
||||||
|
# $(srcdir)/{lib,src}/*.[chy] && \
|
||||||
|
# { echo '$(ME): FIXME' 1>&2; \
|
||||||
|
# exit 1; } || :
|
||||||
|
# FIXME: don't allow `#include .strings\.h' anywhere
|
||||||
|
|
||||||
|
sc_cast_of_argument_to_free:
|
||||||
|
@grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \
|
||||||
|
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_cast_of_x_alloc_return_value:
|
||||||
|
@grep -nE --exclude=$(srcdir)/lib/regex.c \
|
||||||
|
'\*\) *x(m|c|re)alloc\>' \
|
||||||
|
$(srcdir)/{lib,src}/*.[chy] && \
|
||||||
|
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_cast_of_alloca_return_value:
|
||||||
|
@grep -nE '\*\) *alloca\>' \
|
||||||
|
$(srcdir)/src/*.[chy] && \
|
||||||
|
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_space_tab:
|
||||||
|
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Don't use the old ato* functions in `real' code.
|
||||||
|
# They provide no error checking mechanism.
|
||||||
|
# Instead, use strto* functions.
|
||||||
|
sc_prohibit_atoi_atof:
|
||||||
|
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Using EXIT_SUCCESS as the first argument to error is misleading,
|
||||||
|
# since when that parameter is 0, error does not exit. Use `0' instead.
|
||||||
|
sc_error_exit_success:
|
||||||
|
@grep -nF 'error (EXIT_SUCCESS,' \
|
||||||
|
$$(find -type f -name '*.[chly]') && \
|
||||||
|
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_file_system:
|
||||||
|
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found use of "file''system";' \
|
||||||
|
'rewrite to use "file system"' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_no_if_have_config_h:
|
||||||
|
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Nearly all .c files must include <config.h>.
|
||||||
|
sc_require_config_h:
|
||||||
|
@grep -L '^# *include <config\.h>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
|
||||||
|
| grep . && \
|
||||||
|
{ echo '$(ME): the above files do not include <config.h>' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Prohibit the inclusion of assert.h without an actual use of assert.
|
||||||
|
sc_prohibit_assert_without_use:
|
||||||
|
@files=$$(grep -l '# *include <assert\.h>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
|
||||||
|
grep -L '\<assert (' $$files \
|
||||||
|
| grep . && \
|
||||||
|
{ echo "$(ME): the above files include <assert.h> but don't use it" \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_obsolete_symbols:
|
||||||
|
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||||
|
|
||||||
|
# Each nonempty line must start with a year number, or a TAB.
|
||||||
|
sc_changelog:
|
||||||
|
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
|
||||||
|
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||||
|
# with the strings from the two affected variables.
|
||||||
|
dd_c = $(srcdir)/src/dd.c
|
||||||
|
sc_dd_max_sym_length:
|
||||||
|
ifneq ($(wildcard $(dd_c)),)
|
||||||
|
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||||
|
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||||
|
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||||
|
| wc --max-line-length); \
|
||||||
|
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||||
|
|tr -d '"' | wc --max-line-length); \
|
||||||
|
if test "$$len" = "$$max"; then :; else \
|
||||||
|
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Many m4 macros names once began with `jm_'.
|
||||||
|
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||||
|
# Make sure that none are inadvertently reintroduced.
|
||||||
|
sc_prohibit_jm_in_m4:
|
||||||
|
@grep -nE 'jm_[A-Z]' \
|
||||||
|
$$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \
|
||||||
|
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_root_tests:
|
||||||
|
@t1=sc-root.expected; t2=sc-root.actual; \
|
||||||
|
grep -nl '^PRIV_CHECK_ARG=require-root' \
|
||||||
|
$$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
|
||||||
|
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
|
||||||
|
$(srcdir)/tests/Makefile.am |sort > $$t2; \
|
||||||
|
diff -u $$t1 $$t2 || diff=1; \
|
||||||
|
rm -f $$t1 $$t2; \
|
||||||
|
test "$$diff" \
|
||||||
|
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Create a list of regular expressions matching the names
|
||||||
|
# of files included from system.h. Exclude a couple.
|
||||||
|
.re-list:
|
||||||
|
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||||
|
| grep -Ev 'sys/(param|file)\.h' \
|
||||||
|
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||||
|
> $@-t
|
||||||
|
@mv $@-t $@
|
||||||
|
|
||||||
|
# Files in src/ should not include directly any of
|
||||||
|
# the headers already included via system.h.
|
||||||
|
sc_system_h_headers: .re-list
|
||||||
|
@if test -f $(srcdir)/src/system.h; then \
|
||||||
|
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||||
|
grep -nE -f .re-list \
|
||||||
|
$$($(CVS_LIST) src | \
|
||||||
|
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
|
||||||
|
&& { echo '$(ME): the above are already included via system.h'\
|
||||||
|
1>&2; exit 1; } || :; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
sc_sun_os_names:
|
||||||
|
@grep -nEi \
|
||||||
|
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_tight_scope:
|
||||||
|
$(MAKE) -C src $@
|
||||||
|
|
||||||
|
sc_trailing_blank:
|
||||||
|
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found trailing blank(s)' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_two_space_separator_in_usage:
|
||||||
|
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo "$(ME): help2man requires at least two spaces between"; \
|
||||||
|
echo "$(ME): an option and its description"; \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Look for diagnostics that aren't marked for translation.
|
||||||
|
# This won't find any for which error's format string is on a separate line.
|
||||||
|
sc_unmarked_diagnostics:
|
||||||
|
@grep -nE \
|
||||||
|
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
|
||||||
|
| grep -v '_''(' && \
|
||||||
|
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Avoid useless parentheses like those in this example:
|
||||||
|
# #if defined (SYMBOL) || defined (SYM2)
|
||||||
|
sc_useless_cpp_parens:
|
||||||
|
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found useless parentheses in cpp directive' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Ensure that date's --help output stays in sync with the info
|
||||||
|
# documentation for GNU strftime. The only exception is %N,
|
||||||
|
# which date accepts but GNU strftime does not.
|
||||||
|
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||||
|
strftime-check:
|
||||||
|
if test -f $(srcdir)/src/date.c; then \
|
||||||
|
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||||
|
| $(extract_char) > $@-src; \
|
||||||
|
{ echo N; \
|
||||||
|
info libc date calendar format | grep '^ `%.'\' \
|
||||||
|
| $(extract_char); } | sort > $@-info; \
|
||||||
|
diff -u $@-src $@-info || exit 1; \
|
||||||
|
rm -f $@-src $@-info; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure that we use only the standard $(VAR) notation,
|
||||||
|
# not @...@ in Makefile.am, now that we can rely on automake
|
||||||
|
# to emit a definition for each substituted variable.
|
||||||
|
makefile-check:
|
||||||
|
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
|
||||||
|
&& { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
news-date-check: NEWS
|
||||||
|
today=`date +%Y-%m-%d`; \
|
||||||
|
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
|
||||||
|
>/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "version or today's date is not in NEWS" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
changelog-check:
|
||||||
|
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
|
||||||
|
>/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
m4-check:
|
||||||
|
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||||
|
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||||
|
# FIXME: don't hard-code file names below; use a more general mechanism.
|
||||||
|
po-check:
|
||||||
|
if test -f po/POTFILES.in; then \
|
||||||
|
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||||
|
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||||
|
files=; \
|
||||||
|
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||||
|
case $$file in \
|
||||||
|
djgpp/* | man/*) continue;; \
|
||||||
|
esac; \
|
||||||
|
case $$file in \
|
||||||
|
*.[ch]) \
|
||||||
|
base=`expr " $$file" : ' \(.*\)\..'`; \
|
||||||
|
{ test -f $$base.l || test -f $$base.y; } && continue;; \
|
||||||
|
esac; \
|
||||||
|
files="$$files $$file"; \
|
||||||
|
done; \
|
||||||
|
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
|
||||||
|
diff -u $@-1 $@-2 || exit 1; \
|
||||||
|
rm -f $@-1 $@-2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# In a definition of #define AUTHORS "... and ..." where the RHS contains
|
||||||
|
# the English word `and', the string must be marked with `N_ (...)' so that
|
||||||
|
# gettext recognizes it as a string requiring translation.
|
||||||
|
author_mark_check:
|
||||||
|
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
|
||||||
|
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Sometimes it is useful to change the PATH environment variable
|
||||||
|
# in Makefiles. When doing so, it's better not to use the Unix-centric
|
||||||
|
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
|
||||||
|
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
|
||||||
|
# and there probably aren't many projects with so many Makefile.am files
|
||||||
|
# that we'd have to worry about limits on command line length.
|
||||||
|
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
|
||||||
|
makefile_path_separator_check:
|
||||||
|
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
|
||||||
|
&& { echo $(msg) 1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Check that `make alpha' will not fail at the end of the process.
|
||||||
|
writable-files:
|
||||||
|
if test -d $(release_archive_dir); then :; else \
|
||||||
|
mkdir $(release_archive_dir); \
|
||||||
|
fi
|
||||||
|
for file in $(distdir).tar.gz $(xd-delta) \
|
||||||
|
$(release_archive_dir)/$(distdir).tar.gz \
|
||||||
|
$(release_archive_dir)/$(xd-delta); do \
|
||||||
|
test -e $$file || continue; \
|
||||||
|
test -w $$file \
|
||||||
|
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||||
|
done; \
|
||||||
|
test "$$fail" && exit 1 || :
|
||||||
|
|
||||||
|
v_etc_file = lib/version-etc.c
|
||||||
|
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
||||||
|
copyright-check:
|
||||||
|
@if test -f $(v_etc_file); then \
|
||||||
|
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||||
|
>/dev/null \
|
||||||
|
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||||
|
exit 1; }; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Sanity checks with the CVS repository.
|
||||||
|
cvs-tag-check:
|
||||||
|
echo $(this-cvs-tag); \
|
||||||
|
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
|
||||||
|
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
|
cvs-diff-check:
|
||||||
|
if $(CVS) diff >cvs-diffs; then \
|
||||||
|
rm cvs-diffs; \
|
||||||
|
else \
|
||||||
|
echo "Some files are locally modified:" 1>&2; \
|
||||||
|
cat cvs-diffs; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
cvs-check: cvs-diff-check cvs-tag-check
|
||||||
|
|
||||||
|
maintainer-distcheck: changelog-check
|
||||||
|
$(MAKE) distcheck
|
||||||
|
$(MAKE) my-distcheck
|
||||||
|
|
||||||
|
|
||||||
|
# Tag before making distribution. Also, don't make a distribution if
|
||||||
|
# checks fail. Also, make sure the NEWS file is up-to-date.
|
||||||
|
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
|
||||||
|
cvs-dist: $(local-check) cvs-check maintainer-distcheck
|
||||||
|
$(CVS) update po
|
||||||
|
$(CVS) tag -c $(this-cvs-tag)
|
||||||
|
$(MAKE) dist
|
||||||
|
|
||||||
|
# Use this to make sure we don't run these programs when building
|
||||||
|
# from a virgin tgz file, below.
|
||||||
|
null_AM_MAKEFLAGS = \
|
||||||
|
ACLOCAL=false \
|
||||||
|
AUTOCONF=false \
|
||||||
|
AUTOMAKE=false \
|
||||||
|
AUTOHEADER=false \
|
||||||
|
MAKEINFO=false
|
||||||
|
|
||||||
|
# Detect format-string/arg-list mismatches that would normally be obscured
|
||||||
|
# by the use of _(). The --disable-nls effectively defines away that macro,
|
||||||
|
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
|
||||||
|
# treated as a failure. Also, check for shadowing problems with -Wshadow.
|
||||||
|
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||||
|
# have to have a recent version of gcc and glibc headers.
|
||||||
|
TMPDIR ?= /tmp
|
||||||
|
t=$(TMPDIR)/$(PACKAGE)/test
|
||||||
|
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
|
||||||
|
-rm -rf $(t)
|
||||||
|
mkdir -p $(t)
|
||||||
|
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||||
|
cd $(t)/$(distdir) \
|
||||||
|
&& ./configure --disable-nls \
|
||||||
|
&& $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
|
||||||
|
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||||
|
&& $(MAKE) dvi \
|
||||||
|
&& $(MAKE) check \
|
||||||
|
&& $(MAKE) distclean
|
||||||
|
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||||
|
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||||
|
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||||
|
-rm -rf $(t)
|
||||||
|
@echo "========================"; \
|
||||||
|
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||||
|
echo "========================"
|
||||||
|
|
||||||
|
WGET = wget
|
||||||
|
WGETFLAGS = -C off
|
||||||
|
|
||||||
|
rel-check:
|
||||||
|
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||||
|
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
||||||
|
set -e; \
|
||||||
|
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
|
||||||
|
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
|
||||||
|
echo "$(md5) -" > $$md5_tmp; \
|
||||||
|
md5sum -c $$md5_tmp < $$tarz
|
||||||
|
|
||||||
|
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
|
||||||
|
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
|
||||||
|
|
||||||
|
rel-files = $(xd-delta) $(DIST_ARCHIVES)
|
||||||
|
announcement: NEWS ChangeLog $(rel-files)
|
||||||
|
@./announce-gen \
|
||||||
|
--release-type=$(RELEASE_TYPE) \
|
||||||
|
--package=$(PACKAGE) \
|
||||||
|
--prev=$(PREV_VERSION) \
|
||||||
|
--curr=$(VERSION) \
|
||||||
|
--release-archive-directory=$(release_archive_dir) \
|
||||||
|
--gpg-key-id=$(gpg_key_ID) \
|
||||||
|
--news=NEWS \
|
||||||
|
$(addprefix --url-dir=, $(url_dir_list)) \
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Updating files. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
ftp-gnu = ftp://ftp.gnu.org/gnu
|
||||||
|
www-gnu = http://www.gnu.org
|
||||||
|
|
||||||
|
# Use mv, if you don't have/want move-if-change.
|
||||||
|
move_if_change ?= move-if-change
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------- #
|
||||||
|
# Updating everything. #
|
||||||
|
# --------------------- #
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
|
local_updates ?= wget-update cvs-update po-update
|
||||||
|
update: $(local_updates)
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------- #
|
||||||
|
# Updating PO files. #
|
||||||
|
# ------------------- #
|
||||||
|
|
||||||
|
po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
|
||||||
|
.PHONY: do-po-update po-update
|
||||||
|
do-po-update:
|
||||||
|
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
||||||
|
rm -rf $$tmppo && \
|
||||||
|
mkdir $$tmppo && \
|
||||||
|
(cd $$tmppo && \
|
||||||
|
$(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
||||||
|
cp $$tmppo/*.po po
|
||||||
|
cd po && $(MAKE) update-po
|
||||||
|
$(MAKE) po-check
|
||||||
|
|
||||||
|
po-update:
|
||||||
|
if test -d "po"; then \
|
||||||
|
$(MAKE) do-po-update; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -------------------------- #
|
||||||
|
# Updating GNU build tools. #
|
||||||
|
# -------------------------- #
|
||||||
|
|
||||||
|
# The following pseudo table associates a local directory and a URL
|
||||||
|
# with each of the files that belongs to some other package and is
|
||||||
|
# regularly updated from the specified URL.
|
||||||
|
wget_files ?= \
|
||||||
|
$(srcdir)/build-aux/config.guess \
|
||||||
|
$(srcdir)/build-aux/config.sub \
|
||||||
|
$(srcdir)/build-aux/texinfo.tex \
|
||||||
|
$(srcdir)/src/ansi2knr.c
|
||||||
|
|
||||||
|
get-targets = $(patsubst %, get-%, $(wget_files))
|
||||||
|
|
||||||
|
config.guess-url_prefix = $(ftp-gnu)/build-aux/
|
||||||
|
config.sub-url_prefix = $(ftp-gnu)/build-aux/
|
||||||
|
|
||||||
|
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
|
||||||
|
|
||||||
|
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
|
||||||
|
|
||||||
|
standards.texi-url_prefix = $(www-gnu)/prep/
|
||||||
|
make-stds.texi-url_prefix = $(standards.texi-url_prefix)
|
||||||
|
|
||||||
|
target = $(patsubst get-%, %, $@)
|
||||||
|
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
|
||||||
|
|
||||||
|
.PHONY: $(get-targets)
|
||||||
|
$(get-targets):
|
||||||
|
$(WGET) $(WGETFLAGS) $(url) -O $(target).t \
|
||||||
|
&& $(move_if_change) $(target).t $(target)
|
||||||
|
|
||||||
|
cvs_files ?= \
|
||||||
|
$(srcdir)/build-aux/depcomp \
|
||||||
|
$(srcdir)/build-aux/install-sh \
|
||||||
|
$(srcdir)/build-aux/missing \
|
||||||
|
$(srcdir)/build-aux/mkinstalldirs \
|
||||||
|
$(srcdir)/src/ansi2knr.c
|
||||||
|
automake_repo=:pserver:anoncvs:[email protected]:/cvs/automake
|
||||||
|
.PHONY: wget-update
|
||||||
|
wget-update: $(get-targets)
|
||||||
|
|
||||||
|
.PHONY: cvs-update
|
||||||
|
cvs-update:
|
||||||
|
fail=; \
|
||||||
|
for f in $(cvs_files); do \
|
||||||
|
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
|
||||||
|
cvs diff $$f > /dev/null \
|
||||||
|
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \
|
||||||
|
fail=yes; continue; }; \
|
||||||
|
file=$$(basename $$f); \
|
||||||
|
echo checking out $$file...; \
|
||||||
|
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \
|
||||||
|
&& $(move_if_change) $$f.t $$f; \
|
||||||
|
done; \
|
||||||
|
test "$$fail" && exit 1
|
||||||
|
|
||||||
|
emit_upload_commands:
|
||||||
|
@echo =====================================
|
||||||
|
@echo =====================================
|
||||||
|
@echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\"
|
||||||
|
@echo " --to $(gnu_rel_host):coreutils \\"
|
||||||
|
@echo " $(rel-files)"
|
||||||
|
@echo '# send the /tmp/announcement e-mail'
|
||||||
|
@echo =====================================
|
||||||
|
@echo =====================================
|
||||||
|
|
||||||
|
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
|
||||||
|
xdelta delta -9 $^ $@ || :
|
||||||
|
|
||||||
|
.PHONY: alpha beta major
|
||||||
|
alpha beta major: news-date-check $(local-check)
|
||||||
|
$(MAKE) cvs-dist
|
||||||
|
$(MAKE) $(xd-delta)
|
||||||
|
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
|
||||||
|
ln $(rel-files) $(release_archive_dir)
|
||||||
|
chmod a-w $(rel-files)
|
||||||
|
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
||||||
|
echo $(VERSION) > $(prev_version_file)
|
||||||
|
$(CVS) ci -m. $(prev_version_file)
|
||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2005 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,47 +1,27 @@
|
|||||||
This package contains the GNU Bison parser generator.
|
This directory contains the Bison parser generator.
|
||||||
|
|
||||||
* Installation
|
See the file INSTALL for generic compilation and installation instructions.
|
||||||
** Build
|
See the file doc/FAQ for frequently asked questions.
|
||||||
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.3 or later. See:
|
||||||
|
|
||||||
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz
|
||||||
|
|
||||||
** Internationalization
|
Bison can work with pre-1.4.3 distributions of GNU m4 if they are
|
||||||
Bison supports two catalogues: one for Bison itself (i.e., for the
|
sufficiently patched, but if you encounter a bug with an older
|
||||||
maintainer-side parser generation), and one for the generated parsers
|
distribution and report a bug we will probably suggest that you
|
||||||
(i.e., for the user-side parser execution). The requirements between
|
upgrade to 1.4.3 as the first step in trying to fix it.
|
||||||
both differ: bison needs ngettext, the generated parsers do not. To
|
|
||||||
simplify the build system, neither are installed if ngettext is not
|
|
||||||
supported, even if generated parsers could have been localized. See
|
|
||||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for
|
|
||||||
more details.
|
|
||||||
|
|
||||||
* Questions
|
|
||||||
See the section FAQ in the documentation (doc/bison.info) for
|
|
||||||
frequently asked questions. The documentation is also available in
|
|
||||||
PDF and HTML, provided you have a recent version of Texinfo installed:
|
|
||||||
run "make pdf" or "make html".
|
|
||||||
|
|
||||||
If you have questions about using Bison and the documentation does
|
|
||||||
not answer them, please send mail to <[email protected]>.
|
|
||||||
|
|
||||||
* Bug reports
|
|
||||||
Please send bug reports to <[email protected]>. Please include the
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
version number from `bison --version', and a complete, self-contained
|
version number from `bison --version', and a complete, self-contained
|
||||||
test case in each bug report.
|
test case in each bug report.
|
||||||
|
|
||||||
|
If you have questions about using Bison and the documentation does
|
||||||
Local Variables:
|
not answer them, please send mail to <[email protected]>.
|
||||||
mode: outline
|
|
||||||
End:
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005, 2008-2009 Free
|
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
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
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
-*- outline -*-
|
||||||
|
|
||||||
|
These notes intend to help people working on the checked-out sources.
|
||||||
|
These requirements do not apply when building from a distribution tarball.
|
||||||
|
|
||||||
|
* Requirements
|
||||||
|
|
||||||
|
We've opted to keep only the highest-level sources in the repository.
|
||||||
|
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||||
|
requirements on anyone wishing to build from the just-checked-out sources.
|
||||||
|
For example, you have to use the latest stable versions of the maintainer
|
||||||
|
tools we depend upon, including:
|
||||||
|
|
||||||
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
|
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||||
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
|
- Perl <http://www.cpan.org/>
|
||||||
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
|
- Tar <http://www.gnu.org/software/tar/>
|
||||||
|
|
||||||
|
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||||
|
Valgrind supports your architecture.
|
||||||
|
|
||||||
|
Bison is written using Bison grammars, so there are bootstrapping
|
||||||
|
issues. The bootstrap script attempts to discover when the C code
|
||||||
|
generated from the grammars is out of date, and to bootstrap with an
|
||||||
|
out-of-date version of the C code, but the process is not foolproof.
|
||||||
|
Also, you may run into similar problems yourself if you modify Bison.
|
||||||
|
|
||||||
|
Only building the initial full source tree will be a bit painful.
|
||||||
|
Later, after synchronizing from the repository a plain `make' should
|
||||||
|
be sufficient.
|
||||||
|
|
||||||
|
* First checkout
|
||||||
|
|
||||||
|
Obviously, if you are reading these notes, you did manage to check out
|
||||||
|
this package from the repository. For the record, you will find all the
|
||||||
|
relevant information on:
|
||||||
|
|
||||||
|
http://savannah.gnu.org/cvs/?group_id=56
|
||||||
|
|
||||||
|
The next step is to get other files needed to build, which are
|
||||||
|
extracted from other source packages:
|
||||||
|
|
||||||
|
$ ./bootstrap
|
||||||
|
|
||||||
|
And there you are! Just
|
||||||
|
|
||||||
|
$ ./configure
|
||||||
|
$ make
|
||||||
|
$ make check
|
||||||
|
|
||||||
|
At this point, there should be no difference between your local copy,
|
||||||
|
and the master copy:
|
||||||
|
|
||||||
|
$ cvs diff
|
||||||
|
|
||||||
|
should output no difference.
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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,179 +1,5 @@
|
|||||||
-*- outline -*-
|
-*- outline -*-
|
||||||
|
|
||||||
* Short term
|
|
||||||
** Use b4_symbol in all the skeleton
|
|
||||||
Then remove the older system, including the tables generated by
|
|
||||||
output.c
|
|
||||||
|
|
||||||
** Update the documentation on gnu.org
|
|
||||||
|
|
||||||
** Get rid of fake #lines [Bison: ...]
|
|
||||||
Possibly as simple as checking whether the column number is nonnegative.
|
|
||||||
|
|
||||||
I have seen messages like the following from GCC.
|
|
||||||
|
|
||||||
<built-in>:0: fatal error: opening dependency file .deps/libltdl/argz.Tpo: No such file or directory
|
|
||||||
|
|
||||||
|
|
||||||
** Discuss about %printer/%destroy in the case of C++.
|
|
||||||
It would be very nice to provide the symbol classes with an operator<<
|
|
||||||
and a destructor. Unfortunately the syntax we have chosen for
|
|
||||||
%destroy and %printer make them hard to reuse. For instance, the user
|
|
||||||
is invited to write something like
|
|
||||||
|
|
||||||
%printer { debug_stream() << $$; } <my_type>;
|
|
||||||
|
|
||||||
which is hard to reuse elsewhere since it wants to use
|
|
||||||
"debug_stream()" to find the stream to use. The same applies to
|
|
||||||
%destroy: we told the user she could use the members of the Parser
|
|
||||||
class in the printers/destructors, which is not good for an operator<<
|
|
||||||
since it is no longer bound to a particular parser, it's just a
|
|
||||||
(standalone symbol).
|
|
||||||
|
|
||||||
** Rename LR0.cc
|
|
||||||
as lr0.cc, why upper case?
|
|
||||||
|
|
||||||
** bench several bisons.
|
|
||||||
Enhance bench.pl with %b to run different bisons.
|
|
||||||
|
|
||||||
** Use b4_symbol everywhere.
|
|
||||||
Move its definition in the more standard places and deploy it in other
|
|
||||||
skeletons.
|
|
||||||
|
|
||||||
* Various
|
|
||||||
** YYPRINT
|
|
||||||
glr.c inherits its symbol_print function from c.m4, which supports
|
|
||||||
YYPRINT. But to use YYPRINT yytoknum is needed, which not defined by
|
|
||||||
glr.c.
|
|
||||||
|
|
||||||
Anyway, IMHO YYPRINT is obsolete and should be restricted to yacc.c.
|
|
||||||
|
|
||||||
** YYERRCODE
|
|
||||||
Defined to 256, but not used, not documented. Probably the token
|
|
||||||
number for the error token, which POSIX wants to be 256, but which
|
|
||||||
Bison might renumber if the user used number 256. Keep fix and doc?
|
|
||||||
Throw away?
|
|
||||||
|
|
||||||
Also, why don't we output the token name of the error token in the
|
|
||||||
output? It is explicitly skipped:
|
|
||||||
|
|
||||||
/* Skip error token and tokens without identifier. */
|
|
||||||
if (sym != errtoken && id)
|
|
||||||
|
|
||||||
Of course there are issues with name spaces, but if we disable we have
|
|
||||||
something which seems to be more simpler and more consistent instead
|
|
||||||
of the special case YYERRCODE.
|
|
||||||
|
|
||||||
enum yytokentype {
|
|
||||||
error = 256,
|
|
||||||
// ...
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
We could (should?) also treat the case of the undef_token, which is
|
|
||||||
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
|
||||||
toknum:
|
|
||||||
|
|
||||||
const unsigned short int
|
|
||||||
parser::yytoken_number_[] =
|
|
||||||
{
|
|
||||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
|
||||||
|
|
||||||
while here
|
|
||||||
|
|
||||||
enum yytokentype {
|
|
||||||
TOK_EOF = 0,
|
|
||||||
TOK_EQ = 258,
|
|
||||||
|
|
||||||
so both 256 and 257 are "mysterious".
|
|
||||||
|
|
||||||
const char*
|
|
||||||
const parser::yytname_[] =
|
|
||||||
{
|
|
||||||
"\"end of command\"", "error", "$undefined", "\"=\"", "\"break\"",
|
|
||||||
|
|
||||||
|
|
||||||
** YYFAIL
|
|
||||||
It is seems to be *really* obsolete now, shall we remove it?
|
|
||||||
|
|
||||||
** YYBACKUP
|
|
||||||
There is no test about it, no examples in the doc, and I'm not sure
|
|
||||||
what it should look like. For instance what follows crashes.
|
|
||||||
|
|
||||||
%error-verbose
|
|
||||||
%debug
|
|
||||||
%pure-parser
|
|
||||||
%code {
|
|
||||||
# include <stdio.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
# include <assert.h>
|
|
||||||
|
|
||||||
static void yyerror (const char *msg);
|
|
||||||
static int yylex (YYSTYPE *yylval);
|
|
||||||
}
|
|
||||||
%%
|
|
||||||
exp:
|
|
||||||
'a' { printf ("a: %d\n", $1); }
|
|
||||||
| 'b' { YYBACKUP('a', 123); }
|
|
||||||
;
|
|
||||||
%%
|
|
||||||
static int
|
|
||||||
yylex (YYSTYPE *yylval)
|
|
||||||
{
|
|
||||||
static char const input[] = "b";
|
|
||||||
static size_t toknum;
|
|
||||||
assert (toknum < sizeof input);
|
|
||||||
*yylval = (toknum + 1) * 10;
|
|
||||||
return input[toknum++];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
yyerror (const char *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s\n", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
yydebug = !!getenv("YYDEBUG");
|
|
||||||
return yyparse ();
|
|
||||||
}
|
|
||||||
|
|
||||||
** yychar == yyempty_
|
|
||||||
The code in yyerrlab reads:
|
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
|
||||||
{
|
|
||||||
/* Return failure if at end of input. */
|
|
||||||
if (yychar == YYEOF)
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
There are only two yychar that can be <= YYEOF: YYEMPTY and YYEOF.
|
|
||||||
But I can't produce the situation where yychar is YYEMPTY here, is it
|
|
||||||
really possible? The test suite does not exercise this case.
|
|
||||||
|
|
||||||
This shows that it would be interesting to manage to install skeleton
|
|
||||||
coverage analysis to the test suite.
|
|
||||||
|
|
||||||
** Table definitions
|
|
||||||
It should be very easy to factor the definition of the various tables,
|
|
||||||
including the separation bw declaration and definition. See for
|
|
||||||
instance b4_table_define in lalr1.cc. This way, we could even factor
|
|
||||||
C vs. C++ definitions.
|
|
||||||
|
|
||||||
* From lalr1.cc to yacc.c
|
|
||||||
** Single stack
|
|
||||||
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
|
||||||
other improvements and also made it faster (probably because memory
|
|
||||||
management is performed once instead of three times). I suggest that
|
|
||||||
we do the same in yacc.c.
|
|
||||||
|
|
||||||
** yysyntax_error
|
|
||||||
The code bw glr.c and yacc.c is really alike, we can certainly factor
|
|
||||||
some parts.
|
|
||||||
|
|
||||||
* Header guards
|
* Header guards
|
||||||
|
|
||||||
From Franc,ois: should we keep the directory part in the CPP guard?
|
From Franc,ois: should we keep the directory part in the CPP guard?
|
||||||
@@ -192,6 +18,13 @@ find something clean (not like YYLSP_NEEDED...).
|
|||||||
Before releasing, make sure the documentation ("Understanding your
|
Before releasing, make sure the documentation ("Understanding your
|
||||||
parser") refers to the current `output' format.
|
parser") refers to the current `output' format.
|
||||||
|
|
||||||
|
* lalr1.cc
|
||||||
|
** vector
|
||||||
|
Move to using vector, drop stack.hh.
|
||||||
|
|
||||||
|
** I18n
|
||||||
|
Catch up with yacc.c.
|
||||||
|
|
||||||
* Report
|
* Report
|
||||||
|
|
||||||
** GLR
|
** GLR
|
||||||
@@ -266,6 +99,9 @@ must be in the scanner: we must not parse what is in a switched off
|
|||||||
part of %if. Akim Demaille thinks it should be in the parser, so as
|
part of %if. Akim Demaille thinks it should be in the parser, so as
|
||||||
to avoid falling into another CPP mistake.
|
to avoid falling into another CPP mistake.
|
||||||
|
|
||||||
|
** -D, --define-muscle NAME=VALUE
|
||||||
|
To define muscles via cli. Or maybe support directly NAME=VALUE?
|
||||||
|
|
||||||
** XML Output
|
** XML Output
|
||||||
There are couple of available extensions of Bison targeting some XML
|
There are couple of available extensions of Bison targeting some XML
|
||||||
output. Some day we should consider including them. One issue is
|
output. Some day we should consider including them. One issue is
|
||||||
@@ -306,8 +142,7 @@ this issue. Does anybody have it?
|
|||||||
Some history of Bison and some bibliography would be most welcome.
|
Some history of Bison and some bibliography would be most welcome.
|
||||||
Are there any Texinfo standards for bibliography?
|
Are there any Texinfo standards for bibliography?
|
||||||
|
|
||||||
** %printer
|
|
||||||
Wow, %printer is not documented. Clearly mark YYPRINT as obsolete.
|
|
||||||
|
|
||||||
* Java, Fortran, etc.
|
* Java, Fortran, etc.
|
||||||
|
|
||||||
@@ -337,14 +172,15 @@ Show reductions.
|
|||||||
** Skeleton strategy
|
** Skeleton strategy
|
||||||
Must we keep %token-table?
|
Must we keep %token-table?
|
||||||
|
|
||||||
|
* src/print_graph.c
|
||||||
|
Find the best graph parameters.
|
||||||
|
|
||||||
* BTYacc
|
* BTYacc
|
||||||
See if we can integrate backtracking in Bison. Charles-Henri de
|
See if we can integrate backtracking in Bison. Charles-Henri de
|
||||||
Boysson <[email protected]> has been working on this, but never gave
|
Boysson <[email protected]> is working on this, and already has some
|
||||||
the results.
|
results. Vadim Maslow, the maintainer of BTYacc was contacted, and we
|
||||||
|
stay in touch with him. Adjusting the Bison grammar parser will be
|
||||||
Vadim Maslow, the maintainer of BTYacc was once contacted. Adjusting
|
needed to support some extra BTYacc features. This is less urgent.
|
||||||
the Bison grammar parser will be needed to support some extra BTYacc
|
|
||||||
features. This is less urgent.
|
|
||||||
|
|
||||||
** Keeping the conflicted actions
|
** Keeping the conflicted actions
|
||||||
First, analyze the differences between byacc and btyacc (I'm referring
|
First, analyze the differences between byacc and btyacc (I'm referring
|
||||||
@@ -359,6 +195,9 @@ very feasible to use the very same conflict tables.
|
|||||||
** Adjust the skeletons
|
** Adjust the skeletons
|
||||||
Import the skeletons for C and C++.
|
Import the skeletons for C and C++.
|
||||||
|
|
||||||
|
** Improve the skeletons
|
||||||
|
Have them support yysymprint, yydestruct and so forth.
|
||||||
|
|
||||||
|
|
||||||
* Precedence
|
* Precedence
|
||||||
|
|
||||||
@@ -367,6 +206,15 @@ 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).
|
||||||
|
|
||||||
|
** Correlation b/w precedence and associativity
|
||||||
|
Also, I fail to understand why we have to assign the same
|
||||||
|
associativity to operators with the same precedence. For instance,
|
||||||
|
why can't I decide that the precedence of * and / is the same, but the
|
||||||
|
latter is nonassoc?
|
||||||
|
|
||||||
|
If there is really no profound motivation, we should find a new syntax
|
||||||
|
to allow specifying this.
|
||||||
|
|
||||||
** RR conflicts
|
** RR conflicts
|
||||||
See if we can use precedence between rules to solve RR conflicts. See
|
See if we can use precedence between rules to solve RR conflicts. See
|
||||||
what POSIX says.
|
what POSIX says.
|
||||||
@@ -395,6 +243,20 @@ $<type_name>$ = $<type_name>1. I therefore think that one should implement
|
|||||||
a Bison option where every typed default rule is explicitly written out
|
a Bison option where every typed default rule is explicitly written out
|
||||||
(same typed ruled can of course be grouped together).
|
(same typed ruled can of course be grouped together).
|
||||||
|
|
||||||
|
Note: Robert Anisko handles this. He knows how to do it.
|
||||||
|
|
||||||
|
|
||||||
|
* Warnings
|
||||||
|
It would be nice to have warning support. See how Autoconf handles
|
||||||
|
them, it is fairly well described there. It would be very nice to
|
||||||
|
implement this in such a way that other programs could use
|
||||||
|
lib/warnings.[ch].
|
||||||
|
|
||||||
|
Don't work on this without first announcing you do, as I already have
|
||||||
|
thought about it, and know many of the components that can be used to
|
||||||
|
implement it.
|
||||||
|
|
||||||
|
|
||||||
* Pre and post actions.
|
* Pre and post actions.
|
||||||
From: Florian Krohm <[email protected]>
|
From: Florian Krohm <[email protected]>
|
||||||
Subject: YYACT_EPILOGUE
|
Subject: YYACT_EPILOGUE
|
||||||
@@ -428,8 +290,8 @@ Equip the parser with a means to create the (visual) parse tree.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008-2009 Free Software
|
Copyright (C) 2001, 2002, 2003, 2004, 2006 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.
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -36,7 +36,7 @@ bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
|
|||||||
bt2=${bt}2
|
bt2=${bt}2
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
echo >&2 "\
|
||||||
Usage: $0 [OPTION]...
|
Usage: $0 [OPTION]...
|
||||||
Bootstrap this package from the checked-out sources.
|
Bootstrap this package from the checked-out sources.
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ If the file bootstrap.conf exists in the current working directory, its
|
|||||||
contents are read as shell variables to configure the bootstrap.
|
contents are read as shell variables to configure the bootstrap.
|
||||||
|
|
||||||
Running without arguments will suffice in most cases.
|
Running without arguments will suffice in most cases.
|
||||||
EOF
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configuration.
|
# Configuration.
|
||||||
@@ -129,7 +129,7 @@ excluded_files=
|
|||||||
|
|
||||||
# File that should exist in the top directory of a checked out hierarchy,
|
# File that should exist in the top directory of a checked out hierarchy,
|
||||||
# but not in a distribution tarball.
|
# but not in a distribution tarball.
|
||||||
checkout_only_file=HACKING
|
checkout_only_file=README-hacking
|
||||||
|
|
||||||
# Whether to use copies instead of symlinks.
|
# Whether to use copies instead of symlinks.
|
||||||
copy=false
|
copy=false
|
||||||
@@ -144,9 +144,9 @@ vc_ignore=auto
|
|||||||
# -------------------------
|
# -------------------------
|
||||||
find_tool ()
|
find_tool ()
|
||||||
{
|
{
|
||||||
|
# Find sha1sum, named gsha1sum on MacPorts.
|
||||||
find_tool_envvar=$1
|
find_tool_envvar=$1
|
||||||
shift
|
shift
|
||||||
find_tool_name=$@
|
|
||||||
if eval test x"\$$find_tool_envvar" = x; then
|
if eval test x"\$$find_tool_envvar" = x; then
|
||||||
for i
|
for i
|
||||||
do
|
do
|
||||||
@@ -157,7 +157,7 @@ find_tool ()
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if test x"$find_tool_res" = x; then
|
if test x"$find_tool_res" = x; then
|
||||||
echo >&2 "$0: one of these is required: $find_tool_names"
|
echo >&2 "$0: $find_tool_name is required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
|
($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
|
||||||
@@ -211,7 +211,7 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If each line in $STR is not already on a line by itself in $FILE, insert it,
|
# If $STR is not already on a line by itself in $FILE, insert it,
|
||||||
# sorting the new contents of the file and replacing $FILE with the result.
|
# sorting the new contents of the file and replacing $FILE with the result.
|
||||||
insert_sorted_if_absent() {
|
insert_sorted_if_absent() {
|
||||||
file=$1
|
file=$1
|
||||||
@@ -222,21 +222,6 @@ insert_sorted_if_absent() {
|
|||||||
|| exit 1
|
|| exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
|
||||||
# insert_sorted_if_absent.
|
|
||||||
insert_vc_ignore() {
|
|
||||||
vc_ignore_file="$1"
|
|
||||||
case $vc_ignore_file in
|
|
||||||
*.gitignore)
|
|
||||||
# A .gitignore entry that does not start with `/' applies recursively to
|
|
||||||
# subdirectories, so prepend `/' to every .gitignore entry.
|
|
||||||
pattern=`echo "$2" | sed s,^,/,`;;
|
|
||||||
*)
|
|
||||||
pattern="$2";;
|
|
||||||
esac
|
|
||||||
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||||
found_aux_dir=no
|
found_aux_dir=no
|
||||||
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
|
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
|
||||||
@@ -255,7 +240,7 @@ if test ! -d $build_aux; then
|
|||||||
mkdir $build_aux
|
mkdir $build_aux
|
||||||
for dot_ig in x $vc_ignore; do
|
for dot_ig in x $vc_ignore; do
|
||||||
test $dot_ig = x && continue
|
test $dot_ig = x && continue
|
||||||
insert_vc_ignore $dot_ig $build_aux
|
insert_sorted_if_absent $dot_ig $build_aux
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -267,20 +252,6 @@ cleanup_gnulib() {
|
|||||||
exit $status
|
exit $status
|
||||||
}
|
}
|
||||||
|
|
||||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
|
||||||
|
|
||||||
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
|
||||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
|
||||||
:
|
|
||||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
|
||||||
echo "initializing git-merge-changelog driver"
|
|
||||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
|
||||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
|
||||||
else
|
|
||||||
echo "consider installing git-merge-changelog from gnulib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get gnulib files.
|
# Get gnulib files.
|
||||||
|
|
||||||
case ${GNULIB_SRCDIR--} in
|
case ${GNULIB_SRCDIR--} in
|
||||||
@@ -379,7 +350,7 @@ check_dst_dir()
|
|||||||
for dot_ig in x $vc_ignore; do
|
for dot_ig in x $vc_ignore; do
|
||||||
test $dot_ig = x && continue
|
test $dot_ig = x && continue
|
||||||
ig=$parent/$dot_ig
|
ig=$parent/$dot_ig
|
||||||
insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
|
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -505,10 +476,11 @@ slurp() {
|
|||||||
if test $file = Makefile.am; then
|
if test $file = Makefile.am; then
|
||||||
copied=$copied${sep}$gnulib_mk; sep=$nl
|
copied=$copied${sep}$gnulib_mk; sep=$nl
|
||||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
||||||
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..."
|
sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/$gnulib_mk || {
|
||||||
rm -f $dir/$gnulib_mk
|
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
|
||||||
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
|
rm -f $dir/$gnulib_mk &&
|
||||||
etc/prefix-gnulib-mk $dir/$gnulib_mk
|
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
|
||||||
|
}
|
||||||
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
|
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
|
||||||
version_controlled_file $dir $file; then
|
version_controlled_file $dir $file; then
|
||||||
echo "$0: $dir/$file overrides $1/$dir/$file"
|
echo "$0: $dir/$file overrides $1/$dir/$file"
|
||||||
@@ -535,18 +507,18 @@ slurp() {
|
|||||||
test $dot_ig = x && continue
|
test $dot_ig = x && continue
|
||||||
ig=$dir/$dot_ig
|
ig=$dir/$dot_ig
|
||||||
if test -n "$copied"; then
|
if test -n "$copied"; then
|
||||||
insert_vc_ignore $ig "$copied"
|
insert_sorted_if_absent $ig "$copied"
|
||||||
# If an ignored file name ends with _.h, then also add
|
# If an ignored file name ends with _.h, then also add
|
||||||
# the name with just ".h". Many gnulib headers are generated,
|
# the name with just ".h". Many gnulib headers are generated,
|
||||||
# e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc.
|
# e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc.
|
||||||
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
|
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
|
||||||
f=`echo "$copied"|sed 's/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
|
f=`echo "$copied"|sed 's/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
|
||||||
insert_vc_ignore $ig "$f"
|
insert_sorted_if_absent $ig "$f"
|
||||||
|
|
||||||
# For files like sys_stat_.h and sys_time_.h, record as
|
# For files like sys_stat_.h and sys_time_.h, record as
|
||||||
# ignorable the directory we might eventually create: sys/.
|
# ignorable the directory we might eventually create: sys/.
|
||||||
f=`echo "$copied"|sed 's/sys_.*_\.h$/sys/'`
|
f=`echo "$copied"|sed 's/sys_.*_\.h$/sys/'`
|
||||||
insert_vc_ignore $ig "$f"
|
insert_sorted_if_absent $ig "$f"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|||||||
+12
-11
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2007, 2008 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,12 +17,17 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
announce-gen argmatch config-h c-strcase configmake dirname error
|
argmatch config-h c-strcase configmake
|
||||||
extensions fopen-safer gendocs getopt-gnu gettext git-version-gen hash
|
dirname error extensions fopen-safer git-version-gen
|
||||||
inttypes javacomp-script javaexec-script maintainer-makefile malloc
|
getopt gettext hash inttypes javacomp-script javaexec-script malloc
|
||||||
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
|
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
|
||||||
strverscmp unistd unistd-safer unlocked-io update-copyright unsetenv
|
strverscmp unistd unistd-safer unlocked-io verify xalloc xalloc-die
|
||||||
verify warnings xalloc xalloc-die xstrndup
|
xstrndup
|
||||||
|
'
|
||||||
|
|
||||||
|
# Any gnulib files needed that are not in modules.
|
||||||
|
gnulib_files='
|
||||||
|
m4/warning.m4
|
||||||
'
|
'
|
||||||
|
|
||||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||||
@@ -60,7 +65,3 @@ excluded_files='
|
|||||||
m4/visibility.m4
|
m4/visibility.m4
|
||||||
m4/xsize.m4
|
m4/xsize.m4
|
||||||
'
|
'
|
||||||
|
|
||||||
# In directories like lib/, m4/, and po/, generate both these files because we
|
|
||||||
# still try to support CVS emulation.
|
|
||||||
vc_ignore='.cvsignore .gitignore'
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
announce-gen
|
Makefile
|
||||||
|
Makefile.in
|
||||||
compile
|
compile
|
||||||
config.guess
|
config.guess
|
||||||
config.rpath
|
config.rpath
|
||||||
config.sub
|
config.sub
|
||||||
depcomp
|
depcomp
|
||||||
gendocs.sh
|
|
||||||
git-version-gen
|
git-version-gen
|
||||||
install-sh
|
install-sh
|
||||||
javacomp.sh.in
|
javacomp.sh.in
|
||||||
@@ -13,7 +13,4 @@ link-warning.h
|
|||||||
mdate-sh
|
mdate-sh
|
||||||
missing
|
missing
|
||||||
texinfo.tex
|
texinfo.tex
|
||||||
update-copyright
|
|
||||||
useless-if-before-free
|
|
||||||
vc-list-files
|
|
||||||
ylwrap
|
ylwrap
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
/announce-gen
|
|
||||||
/compile
|
|
||||||
/config.guess
|
|
||||||
/config.rpath
|
|
||||||
/config.sub
|
|
||||||
/depcomp
|
|
||||||
/gendocs.sh
|
|
||||||
/git-version-gen
|
|
||||||
/install-sh
|
|
||||||
/javacomp.sh.in
|
|
||||||
/javaexec.sh.in
|
|
||||||
/link-warning.h
|
|
||||||
/mdate-sh
|
|
||||||
/missing
|
|
||||||
/texinfo.tex
|
|
||||||
/update-copyright
|
|
||||||
/useless-if-before-free
|
|
||||||
/vc-list-files
|
|
||||||
/ylwrap
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
EXTRA_DIST = prev-version.txt cross-options.pl
|
||||||
+16
-58
@@ -5,75 +5,33 @@ use 5.005;
|
|||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my %option;
|
my %option;
|
||||||
my %directive;
|
while (<>)
|
||||||
my $scanner = `grep -i '"%[a-z]' $ARGV[0]`;
|
|
||||||
$scanner =~ s/"\[-_\]"/-/g;
|
|
||||||
while (<STDIN>)
|
|
||||||
{
|
{
|
||||||
if (/^\s* # Initial spaces.
|
if (/^\s* # Initial spaces.
|
||||||
(?:(-\w),\s+)? # $1: $short: Possible short option.
|
(?:(-\w),\s+)? # $1: Possible short option.
|
||||||
(--[-\w]+) # $2: $long: Long option.
|
(--[-\w]+) # $2: Long option.
|
||||||
(\[?) # $3: $opt: '[' iff the argument is optional.
|
(\[?) # $3: '[' iff the argument is optional.
|
||||||
(?:=(\S+))? # $4: $arg: Possible argument name.
|
(?:=([-\w]+))? # $4: Possible argument name.
|
||||||
\s # Spaces.
|
|
||||||
/x)
|
/x)
|
||||||
{
|
{
|
||||||
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
||||||
$short = '' if ! defined $short;
|
$short = defined $short ? '@option{' . $short . '}' : '';
|
||||||
$short = '-d' if $long eq '--defines' && ! $short;
|
|
||||||
my $dir = '%' . substr($long, 2);
|
|
||||||
if (index ($scanner, "\"$dir\"") < 0)
|
|
||||||
{
|
|
||||||
if ($long eq '--force-define') { $dir = '%define'; }
|
|
||||||
else { $dir = ''; }
|
|
||||||
}
|
|
||||||
if ($arg)
|
if ($arg)
|
||||||
{
|
{
|
||||||
# if $opt, $arg contains the closing ].
|
|
||||||
substr ($arg, -1) = ''
|
|
||||||
if $opt eq '[';
|
|
||||||
$arg =~ s/^=//;
|
$arg =~ s/^=//;
|
||||||
$arg = lc ($arg);
|
$arg = '@var{' . lc ($arg) . '}';
|
||||||
my $dir_arg = $arg;
|
$arg = '[' . $arg . ']'
|
||||||
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
if $opt eq '[';
|
||||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
$option{"$long=$arg"} = $short ? "$short $arg" : '';
|
||||||
# @var{name[=value]}].
|
}
|
||||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
else
|
||||||
my $long_arg = "=$arg";
|
{
|
||||||
if ($opt eq '[') {
|
$option{"$long"} = "$short";
|
||||||
$long_arg = "[$long_arg]";
|
|
||||||
$arg = "[$arg]";
|
|
||||||
}
|
|
||||||
# For arguments of directives: this only works if all arguments
|
|
||||||
# are strings and have the same syntax as on the command line.
|
|
||||||
if ($dir_arg eq 'name[=value]')
|
|
||||||
{
|
|
||||||
$dir_arg = '@var{name} ["@var{value}"]';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$dir_arg =~ s/(\w+)/\@var{"$1"}/g;
|
|
||||||
$dir_arg = '[' . $dir_arg . ']'
|
|
||||||
if $opt eq '[';
|
|
||||||
}
|
|
||||||
$long = "$long$long_arg";
|
|
||||||
$short = "$short $arg" if $short && $short ne '-d';
|
|
||||||
$dir = "$dir $dir_arg" if $dir;
|
|
||||||
}
|
}
|
||||||
$option{$long} = $short;
|
|
||||||
$directive{$long} = $dir;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sep = '';
|
|
||||||
foreach my $long (sort keys %option)
|
foreach my $long (sort keys %option)
|
||||||
{
|
{
|
||||||
# Avoid trailing spaces.
|
printf "\@item %-40s \@tab %s\n", '@option{' . $long . '}', $option{$long};
|
||||||
print $sep;
|
|
||||||
$sep = "\n";
|
|
||||||
print '@item @option{', $long, "}\n\@tab";
|
|
||||||
print ' @option{', $option{$long}, '}' if $option{$long};
|
|
||||||
print "\n\@tab";
|
|
||||||
print ' @code{', $directive{$long}, '}' if $directive{$long};
|
|
||||||
print "\n";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
EXTRA_DIST += \
|
|
||||||
build-aux/cross-options.pl \
|
|
||||||
build-aux/move-if-change \
|
|
||||||
build-aux/prev-version.txt \
|
|
||||||
build-aux/update-b4-copyright
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../gnulib/build-aux/move-if-change
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
#!/usr/bin/perl -0777 -pi
|
|
||||||
|
|
||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
|
||||||
# include the current year.
|
|
||||||
|
|
||||||
# Copyright (C) 2009 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, 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/>.
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
my $margin = 72;
|
|
||||||
|
|
||||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
|
||||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
|
||||||
{
|
|
||||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
|
||||||
$this_year = $year + 1900;
|
|
||||||
}
|
|
||||||
my $old_re = <<'EOF'
|
|
||||||
(
|
|
||||||
(?:^|\n)
|
|
||||||
#BEFORE
|
|
||||||
(?:
|
|
||||||
b4_copyright\(\[[^][]*]
|
|
||||||
| m4_(?:push|pop)def\(\[b4_copyright_years]
|
|
||||||
)
|
|
||||||
#AFTER
|
|
||||||
)
|
|
||||||
(?:
|
|
||||||
,\s*
|
|
||||||
(
|
|
||||||
\[\s* (?:\d{4}(?:,\s*|-))* (\d{4}) \s*]
|
|
||||||
)
|
|
||||||
)?
|
|
||||||
\)
|
|
||||||
EOF
|
|
||||||
;
|
|
||||||
|
|
||||||
while (/($old_re)/gx)
|
|
||||||
{
|
|
||||||
my $start = pos() - length ($1);
|
|
||||||
my $b4_copyright_line = $2;
|
|
||||||
my $year_lines = $3;
|
|
||||||
my $final_year = $4;
|
|
||||||
$year_lines .= ')';
|
|
||||||
|
|
||||||
# If there was a second argument, it contains years, so update them.
|
|
||||||
if ($final_year)
|
|
||||||
{
|
|
||||||
$b4_copyright_line .= ',';
|
|
||||||
if ($final_year != $this_year)
|
|
||||||
{
|
|
||||||
# Update the year.
|
|
||||||
$year_lines =~ s/$final_year/$final_year, $this_year/;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Normalize all whitespace.
|
|
||||||
$year_lines =~ s/\s+/ /g;
|
|
||||||
|
|
||||||
# Put spaces after commas.
|
|
||||||
$year_lines =~ s/, ?/, /g;
|
|
||||||
|
|
||||||
# Compress to intervals.
|
|
||||||
$year_lines =~
|
|
||||||
s/
|
|
||||||
(\d{4})
|
|
||||||
(?:
|
|
||||||
(,\ |-)
|
|
||||||
((??{
|
|
||||||
if ($2 eq '-') { '\d{4}'; }
|
|
||||||
elsif (!$3) { $1 + 1; }
|
|
||||||
else { $3 + 1; }
|
|
||||||
}))
|
|
||||||
)+
|
|
||||||
/$1-$3/gx;
|
|
||||||
|
|
||||||
# Format within margin.
|
|
||||||
my $year_lines_new;
|
|
||||||
my $indent = index ($b4_copyright_line, '[');
|
|
||||||
--$indent if ($b4_copyright_line =~ m/^\n/);
|
|
||||||
while (length $year_lines)
|
|
||||||
{
|
|
||||||
my $text_margin = $margin - $indent;
|
|
||||||
if (($year_lines =~ s/^(.{1,$text_margin})(?: |$)//)
|
|
||||||
|| ($year_lines =~ s/^([\S]+)(?: |$)//))
|
|
||||||
{
|
|
||||||
my $line = "\n" . (' 'x$indent) . $1;
|
|
||||||
++$indent if (!$year_lines_new);
|
|
||||||
$year_lines_new .= $line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Should be unreachable, but we don't want an infinite
|
|
||||||
# loop if it can be reached.
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Replace the old invocation. Should never die.
|
|
||||||
die if (!s/$old_re\G/$b4_copyright_line$year_lines_new/x);
|
|
||||||
|
|
||||||
# Prepare for the next search.
|
|
||||||
pos () = $start + length ("$b4_copyright_line$year_lines_new");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (/(\bb4_copyright\()/g)
|
|
||||||
{
|
|
||||||
my $start = pos () - length ($1);
|
|
||||||
my $end = pos ();
|
|
||||||
my $re = $old_re;
|
|
||||||
pos () = $start;
|
|
||||||
$re =~ s/\#BEFORE/\\G/;
|
|
||||||
if (!/$re/x)
|
|
||||||
{
|
|
||||||
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
|
|
||||||
print STDERR
|
|
||||||
"$ARGV:$line: warning: failed to update a b4_copyright\n";
|
|
||||||
}
|
|
||||||
pos () = $end;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (/(\[b4_copyright_years])/g)
|
|
||||||
{
|
|
||||||
my $start = pos () - length ($1);
|
|
||||||
my $end = pos ();
|
|
||||||
my $re = $old_re;
|
|
||||||
$re =~ s/\#AFTER/\\G/;
|
|
||||||
if (!/$re/x)
|
|
||||||
{
|
|
||||||
# The substr operation blows away pos (), so restoring pos ()
|
|
||||||
# at the end is necessary.
|
|
||||||
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
|
|
||||||
print STDERR
|
|
||||||
"$ARGV:$line: warning: failed to update a"
|
|
||||||
. " b4_copyright_years\n";
|
|
||||||
}
|
|
||||||
pos () = $end;
|
|
||||||
}
|
|
||||||
+45
-52
@@ -1,7 +1,7 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
|
||||||
# Free Software Foundation, Inc.
|
# Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,25 +16,19 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
# testsuite -C appears in 2.62.
|
# We have strange test case titles, so we need Autoconf 2.61 or better.
|
||||||
AC_PREREQ(2.62)
|
AC_PREREQ(2.61)
|
||||||
|
|
||||||
AC_INIT([GNU Bison],
|
AC_INIT([GNU Bison], [2.3a+], [[email protected]])
|
||||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2007],
|
||||||
[[email protected]])
|
|
||||||
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2008],
|
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2008])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2007])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later.
|
# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later.
|
||||||
# We want gnits strictness only when rolling a formal release so that we can,
|
AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2])
|
||||||
# for example, run make dist at other times without being required to add a
|
|
||||||
# bogus NEWS entry.
|
|
||||||
AM_INIT_AUTOMAKE([1.8 dist-bzip2]
|
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-], [gnu], [gnits]))
|
|
||||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||||
|
|
||||||
# Checks for the compiler.
|
# Checks for the compiler.
|
||||||
@@ -51,23 +45,23 @@ AC_ARG_ENABLE(gcc-warnings,
|
|||||||
esac],
|
esac],
|
||||||
[enableval=no])
|
[enableval=no])
|
||||||
if test "${enableval}" = yes; then
|
if test "${enableval}" = yes; then
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
gl_WARNING_CFLAGS([-Werror])
|
||||||
AC_SUBST([WERROR_CFLAGS])
|
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||||
gl_WARN_ADD([-Wall])
|
WARNING_CFLAGS=
|
||||||
gl_WARN_ADD([-Wextra -Wno-sign-compare])
|
gl_WARNING_CFLAGS([-Wall])
|
||||||
gl_WARN_ADD([-Wcast-align])
|
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
|
||||||
gl_WARN_ADD([-Wcast-qual])
|
gl_WARNING_CFLAGS([-Wcast-align])
|
||||||
gl_WARN_ADD([-Wformat])
|
gl_WARNING_CFLAGS([-Wcast-qual])
|
||||||
gl_WARN_ADD([-Wpointer-arith])
|
gl_WARNING_CFLAGS([-Wformat])
|
||||||
gl_WARN_ADD([-Wwrite-strings])
|
gl_WARNING_CFLAGS([-Wpointer-arith])
|
||||||
AC_SUBST([WARN_CXXFLAGS], [$WARN_CFLAGS])
|
gl_WARNING_CFLAGS([-Wwrite-strings])
|
||||||
|
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
|
||||||
# The following warnings are not suitable for C++.
|
# The following warnings are not suitable for C++.
|
||||||
gl_WARN_ADD([-Wbad-function-cast])
|
gl_WARNING_CFLAGS([-Wbad-function-cast])
|
||||||
gl_WARN_ADD([-Wmissing-declarations])
|
gl_WARNING_CFLAGS([-Wmissing-declarations])
|
||||||
gl_WARN_ADD([-Wmissing-prototypes])
|
gl_WARNING_CFLAGS([-Wmissing-prototypes])
|
||||||
gl_WARN_ADD([-Wshadow])
|
gl_WARNING_CFLAGS([-Wshadow])
|
||||||
gl_WARN_ADD([-Wstrict-prototypes])
|
gl_WARNING_CFLAGS([-Wstrict-prototypes])
|
||||||
AC_SUBST([WARN_CFLAGS])
|
|
||||||
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
|
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -79,8 +73,8 @@ AC_ARG_ENABLE([yacc],
|
|||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
case $enable_yacc in
|
case $enable_yacc in
|
||||||
yes)
|
yes)
|
||||||
YACC_SCRIPT=src/yacc
|
YACC_SCRIPT=yacc
|
||||||
YACC_LIBRARY=lib/liby.a;;
|
YACC_LIBRARY=liby.a;;
|
||||||
*)
|
*)
|
||||||
YACC_SCRIPT=
|
YACC_SCRIPT=
|
||||||
YACC_LIBRARY=;;
|
YACC_LIBRARY=;;
|
||||||
@@ -92,10 +86,11 @@ AC_SUBST([YACC_LIBRARY])
|
|||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
BISON_PROG_GNU_M4
|
||||||
|
if test x"$ac_cv_prog_gnu_m4" != xyes; then
|
||||||
|
AC_MSG_ERROR([GNU M4 1.4 is required])
|
||||||
|
fi
|
||||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||||
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
|
||||||
supports -g, otherwise to "".])
|
|
||||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||||
AC_SUBST([XSLTPROC])
|
AC_SUBST([XSLTPROC])
|
||||||
@@ -117,10 +112,9 @@ BISON_PREREQ_SUBPIPE
|
|||||||
BISON_PREREQ_TIMEVAR
|
BISON_PREREQ_TIMEVAR
|
||||||
|
|
||||||
# Gettext.
|
# Gettext.
|
||||||
# We use gnulib, which is only guaranteed to work properly with the
|
# We've never tested with gettext versions before 0.15, so play it safe.
|
||||||
# latest Gettext.
|
AM_GNU_GETTEXT([external], [need-formatstring-macros])
|
||||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
AM_GNU_GETTEXT_VERSION([0.15])
|
||||||
AM_GNU_GETTEXT_VERSION([0.17])
|
|
||||||
BISON_I18N
|
BISON_I18N
|
||||||
|
|
||||||
# Internationalized parsers.
|
# Internationalized parsers.
|
||||||
@@ -134,7 +128,7 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
|||||||
|
|
||||||
# Initialize the test suite.
|
# Initialize the test suite.
|
||||||
AC_CONFIG_TESTDIR(tests)
|
AC_CONFIG_TESTDIR(tests)
|
||||||
AC_CONFIG_FILES([tests/atlocal])
|
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
@@ -145,19 +139,18 @@ AC_SUBST([GCC])
|
|||||||
AC_SUBST([O0CFLAGS], [`echo $CFLAGS | sed 's/-O[[0-9]] *//'`])
|
AC_SUBST([O0CFLAGS], [`echo $CFLAGS | sed 's/-O[[0-9]] *//'`])
|
||||||
AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`])
|
AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`])
|
||||||
|
|
||||||
gt_JAVACOMP([1.3], [1.4])
|
gt_JAVACOMP([1.3])
|
||||||
gt_JAVAEXEC
|
gt_JAVAEXEC
|
||||||
|
|
||||||
# We use gnulib, but from lib/local.mk instead of lib/Makefile.am.
|
AC_CONFIG_FILES([.version
|
||||||
# So prefix paths with lib/. See also etc/prefix-gnulib-mk.
|
Makefile
|
||||||
gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
|
build-aux/Makefile
|
||||||
for ac_var in ALLOCA_H ERRNO_H FCNTL_H GETOPT_H INTTYPES_H \
|
|
||||||
STDBOOL_H STDINT_H SYS_WAIT_H WCHAR_H WCTYPE_H
|
|
||||||
do
|
|
||||||
eval "test 'x$ac_var' = x || $ac_var=lib/\$$ac_var"
|
|
||||||
done
|
|
||||||
AC_CONFIG_FILES([Makefile
|
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
examples/calc++/Makefile
|
data/Makefile
|
||||||
doc/yacc.1])
|
etc/Makefile
|
||||||
|
examples/Makefile
|
||||||
|
examples/calc++/Makefile
|
||||||
|
lib/Makefile src/Makefile
|
||||||
|
doc/Makefile
|
||||||
|
doc/yacc.1])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile.in
|
||||||
|
Makefile
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
## Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dist_pkgdata_DATA = README bison.m4 \
|
||||||
|
c-skel.m4 c.m4 yacc.c glr.c \
|
||||||
|
c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc \
|
||||||
|
java-skel.m4 java.m4 lalr1.java
|
||||||
|
|
||||||
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
|
dist_m4sugar_DATA = m4sugar/m4sugar.m4
|
||||||
|
|
||||||
|
xsltdir = $(pkgdatadir)/xslt
|
||||||
|
dist_xslt_DATA = \
|
||||||
|
xslt/bison.xsl \
|
||||||
|
xslt/xml2dot.xsl \
|
||||||
|
xslt/xml2text.xsl \
|
||||||
|
xslt/xml2xhtml.xsl
|
||||||
+7
-34
@@ -1,58 +1,31 @@
|
|||||||
-*- outline -*-
|
-*- outline -*-
|
||||||
|
|
||||||
This directory contains data needed by Bison.
|
This directory contains Bison skeletons: the general shapes of the
|
||||||
|
different parser kinds, that are specialized for specific grammars by
|
||||||
|
the bison program.
|
||||||
|
|
||||||
* Skeletons
|
Currently, there are only three supported skeletons:
|
||||||
Bison skeletons: the general shapes of the different parser kinds,
|
|
||||||
that are specialized for specific grammars by the bison program.
|
|
||||||
|
|
||||||
Currently, the supported skeletons are:
|
|
||||||
|
|
||||||
- yacc.c
|
- yacc.c
|
||||||
It used to be named bison.simple: it corresponds to C Yacc
|
It used to be named bison.simple: it corresponds to C Yacc
|
||||||
compatible LALR(1) parsers.
|
compatible LALR(1) parsers.
|
||||||
|
|
||||||
- lalr1.cc
|
- lalr1.cc
|
||||||
Produces a C++ parser class.
|
Produces a C++ parser class. It is still very experimental, and not
|
||||||
|
yet supported. Please, subscribe to [email protected].
|
||||||
- lalr1.java
|
|
||||||
Produces a Java parser class.
|
|
||||||
|
|
||||||
- glr.c
|
- glr.c
|
||||||
A Generalized LR C parser based on Bison's LALR(1) tables.
|
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||||
|
|
||||||
- glr.cc
|
|
||||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
|
||||||
|
|
||||||
These skeletons are the only ones supported by the Bison team.
|
These skeletons are the only ones supported by the Bison team.
|
||||||
Because the interface between skeletons and the bison program is not
|
Because the interface between skeletons and the bison program is not
|
||||||
finished, *we are not bound to it*. In particular, Bison is not
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
mature enough for us to consider that ``foreign skeletons'' are
|
mature enough for us to consider that ``foreign skeletons'' are
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
* m4sugar
|
|
||||||
This directory contains M4sugar, sort of an extended library for M4,
|
|
||||||
which is used by Bison to instantiate the skeletons.
|
|
||||||
|
|
||||||
* xslt
|
|
||||||
This directory contains XSLT programs that transform Bison's XML output
|
|
||||||
into various formats.
|
|
||||||
|
|
||||||
- bison.xsl
|
|
||||||
A library of routines used by the other XSLT programs.
|
|
||||||
|
|
||||||
- xml2dot.xsl
|
|
||||||
Conversion into GraphViz's dot format.
|
|
||||||
|
|
||||||
- xml2text.xsl
|
|
||||||
Conversion into text.
|
|
||||||
|
|
||||||
- xml2xhtml.xsl
|
|
||||||
Conversion into XHTML.
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2009 Free Software Foundation, Inc.
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+22
-283
@@ -1,8 +1,8 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -22,17 +22,14 @@
|
|||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_copyright(TITLE, [YEARS])
|
# b4_copyright(TITLE, YEARS)
|
||||||
# ----------------------------
|
# --------------------------
|
||||||
# If YEARS are not defined, use b4_copyright_years.
|
|
||||||
m4_define([b4_copyright],
|
m4_define([b4_copyright],
|
||||||
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
||||||
|
|
||||||
b4_comment([$1
|
b4_comment([$1
|
||||||
|
|
||||||
]m4_dquote(m4_text_wrap([Copyright (C)
|
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
|
||||||
]m4_ifval([$2], [[$2]], [m4_defn([b4_copyright_years])])[
|
|
||||||
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
|
||||||
@@ -212,87 +209,6 @@ m4_define([b4_ints_in],
|
|||||||
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
||||||
|
|
||||||
|
|
||||||
# b4_subtract(LHS, RHS)
|
|
||||||
# ---------------------
|
|
||||||
# Evaluate LHS - RHS if they are integer literals, otherwise expand
|
|
||||||
# to (LHS) - (RHS).
|
|
||||||
m4_define([b4_subtract],
|
|
||||||
[m4_bmatch([$1$2], [^[0123456789]*$],
|
|
||||||
[m4_eval([$1 - $2])],
|
|
||||||
[($1) - ($2)])])
|
|
||||||
|
|
||||||
# b4_args(ARG1, ...)
|
|
||||||
# _b4_args(ARG1, ...)
|
|
||||||
# -------------------
|
|
||||||
# Join with comma, skipping empty arguments.
|
|
||||||
# b4_args calls itself recursively until it sees the first non-empty
|
|
||||||
# argument, then calls _b4_args which prepends each non-empty argument
|
|
||||||
# with a comma.
|
|
||||||
m4_define([b4_args],
|
|
||||||
[m4_if([$#$1],
|
|
||||||
[1], [],
|
|
||||||
[m4_ifval([$1],
|
|
||||||
[$1[]_$0(m4_shift($@))],
|
|
||||||
[$0(m4_shift($@))])])])
|
|
||||||
|
|
||||||
# _b4_args(ARGS1, ...)
|
|
||||||
# --------------------
|
|
||||||
m4_define([_b4_args],
|
|
||||||
[m4_if([$#$1],
|
|
||||||
[1], [],
|
|
||||||
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_tables_map(MACRO)
|
|
||||||
# -------------------------------------
|
|
||||||
# Map MACRO on all the integral tables. MACRO is expected to have
|
|
||||||
# the signature MACRO(TABLE-NAME, CONTENT, COMMENT).
|
|
||||||
m4_define([b4_integral_parser_tables_map],
|
|
||||||
[$1([pact], [b4_pact],
|
|
||||||
[[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
|
||||||
STATE-NUM.]])
|
|
||||||
|
|
||||||
$1([defact], [b4_defact],
|
|
||||||
[[YYDEFACT[S] -- default reduction number in state S. Performed when
|
|
||||||
YYTABLE does not specify something else to do. Zero means the default
|
|
||||||
is an error.]])
|
|
||||||
|
|
||||||
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
|
|
||||||
|
|
||||||
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
|
||||||
|
|
||||||
$1([table], [b4_table],
|
|
||||||
[[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.]])
|
|
||||||
|
|
||||||
$1([check], [b4_check])
|
|
||||||
|
|
||||||
$1([stos], [b4_stos],
|
|
||||||
[[STOS_[STATE-NUM] -- The (internal number of the) accessing
|
|
||||||
symbol of state STATE-NUM.]])
|
|
||||||
|
|
||||||
$1([r1], [b4_r1],
|
|
||||||
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
|
||||||
|
|
||||||
$1([r2], [b4_r2],
|
|
||||||
[[YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.]])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parser_tables_declare
|
|
||||||
# b4_parser_tables_define
|
|
||||||
# ------------------------
|
|
||||||
# Define/declare the (deterministic) parser tables.
|
|
||||||
m4_define([b4_parser_tables_declare],
|
|
||||||
[b4_integral_parser_tables_map([b4_integral_parser_table_declare])])
|
|
||||||
|
|
||||||
m4_define([b4_parser_tables_define],
|
|
||||||
[b4_integral_parser_tables_map([b4_integral_parser_table_define])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
## Decoding options. ##
|
## Decoding options. ##
|
||||||
@@ -331,120 +247,16 @@ m4_define([b4_$3_if],
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||||
b4_define_flag_if([defines]) # Whether headers are requested.
|
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||||
|
b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
||||||
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||||
|
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||||
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## ------------------------- ##
|
||||||
## Symbols. ##
|
## Assigning token numbers. ##
|
||||||
## --------- ##
|
## ------------------------- ##
|
||||||
|
|
||||||
# b4_symbol_(NUM, FIELD)
|
|
||||||
# ----------------------
|
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
|
||||||
# undefined.
|
|
||||||
m4_define([b4_symbol_],
|
|
||||||
[m4_indir([b4_symbol($1, $2)])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol(NUM, FIELD)
|
|
||||||
# ---------------------
|
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
|
||||||
# undefined. If FIELD = id, prepend the prefix.
|
|
||||||
m4_define([b4_symbol],
|
|
||||||
[m4_case([$2],
|
|
||||||
[id], [m4_do([b4_percent_define_get([api.tokens.prefix])],
|
|
||||||
[b4_symbol_([$1], [id])])],
|
|
||||||
[b4_symbol_($@)])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
|
||||||
# -------------------------------------------
|
|
||||||
# If FIELD about symbol #NUM is 1 expand IF-TRUE, if is 0, expand IF-FALSE.
|
|
||||||
# Otherwise an error.
|
|
||||||
m4_define([b4_symbol_if],
|
|
||||||
[m4_case(b4_symbol([$1], [$2]),
|
|
||||||
[1], [$3],
|
|
||||||
[0], [$4],
|
|
||||||
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Report the location of the KIND action as FILE:LINE.
|
|
||||||
m4_define([b4_symbol_action_location],
|
|
||||||
[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
|
||||||
# ----------------------------------
|
|
||||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
|
||||||
# Same as in C, but using references instead of pointers.
|
|
||||||
m4_define([b4_symbol_action],
|
|
||||||
[b4_symbol_if([$1], [has_$2],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[b4_symbol_value([(*yyvaluep)],
|
|
||||||
b4_symbol_if([$1], [has_type],
|
|
||||||
[b4_symbol([$1], [type])]))])dnl
|
|
||||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
|
||||||
b4_symbol_case_([$1])
|
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
|
||||||
b4_symbol([$1], [$2])
|
|
||||||
b4_syncline([@oline@], [@ofile@])
|
|
||||||
break;
|
|
||||||
|
|
||||||
m4_popdef([b4_at_dollar])dnl
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_destructor(SYMBOL-NUM)
|
|
||||||
# b4_symbol_printer(SYMBOL-NUM)
|
|
||||||
# --------------------------------
|
|
||||||
m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
|
|
||||||
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_case_(SYMBOL-NUM)
|
|
||||||
# ---------------------------
|
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
|
||||||
m4_define([b4_symbol_case_],
|
|
||||||
[ case b4_symbol([$1], [number]): // b4_symbol([$1], [tag])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_foreach(MACRO)
|
|
||||||
# ------------------------
|
|
||||||
# Invoke MACRO(SYMBOL-NUM) for each SYMBOL-NUM.
|
|
||||||
m4_define([b4_symbol_foreach],
|
|
||||||
[m4_map([$1], m4_defn([b4_symbol_numbers]))])
|
|
||||||
|
|
||||||
|
|
||||||
## ------- ##
|
|
||||||
## Types. ##
|
|
||||||
## ------- ##
|
|
||||||
|
|
||||||
# b4_type_action_(NUMS)
|
|
||||||
# ---------------------
|
|
||||||
# Run actions for the symbol NUMS that all have the same type-name.
|
|
||||||
# Skip NUMS that have no type-name.
|
|
||||||
m4_define([b4_type_action_],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[m4_map([b4_symbol_case_], [$@])[]dnl
|
|
||||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
|
||||||
[b4_symbol([$1], [tag])],
|
|
||||||
[b4_symbol([$1], [type])]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
])])
|
|
||||||
|
|
||||||
# b4_type_foreach(MACRO)
|
|
||||||
# ----------------------
|
|
||||||
# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
|
|
||||||
m4_define([b4_type_foreach],
|
|
||||||
[m4_map([$1], m4_defn([b4_type_names]))])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -462,8 +274,8 @@ m4_define([b4_basename],
|
|||||||
# b4_syncline(LINE, FILE)
|
# b4_syncline(LINE, FILE)
|
||||||
# -----------------------
|
# -----------------------
|
||||||
m4_define([b4_syncline],
|
m4_define([b4_syncline],
|
||||||
[b4_flag_if([synclines],
|
[b4_flag_if([synclines], [
|
||||||
[b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
||||||
b4_sync_start([$1], [$2])])])
|
b4_sync_start([$1], [$2])])])
|
||||||
|
|
||||||
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
||||||
@@ -505,8 +317,8 @@ b4_define_user_code([stype])
|
|||||||
# but is not used by Bison (as recorded by macros in the namespace
|
# but is not used by Bison (as recorded by macros in the namespace
|
||||||
# BISON-NAMESPACE).
|
# BISON-NAMESPACE).
|
||||||
#
|
#
|
||||||
# USER-LIST must expand to a list specifying all user occurrences of all names
|
# USER-LIST must expand to a list specifying all grammar occurrences of all
|
||||||
# of type WHAT. Each item in the list must be a triplet specifying one
|
# names of type WHAT. Each item in the list must be a triplet specifying one
|
||||||
# occurrence: name, start boundary, and end boundary. Empty string names are
|
# occurrence: name, start boundary, and end boundary. Empty string names are
|
||||||
# fine. An empty list is fine.
|
# fine. An empty list is fine.
|
||||||
#
|
#
|
||||||
@@ -550,20 +362,6 @@ m4_popdef([b4_start])dnl
|
|||||||
m4_popdef([b4_end])dnl
|
m4_popdef([b4_end])dnl
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------- ##
|
|
||||||
## b4_percent_define_*. ##
|
|
||||||
## --------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_use(VARIABLE)
|
|
||||||
# -------------------------------
|
|
||||||
# Declare that VARIABLE was used.
|
|
||||||
m4_define([b4_percent_define_use],
|
|
||||||
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_percent_define_get(VARIABLE)
|
# b4_percent_define_get(VARIABLE)
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if
|
# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if
|
||||||
@@ -575,7 +373,7 @@ m4_define([b4_percent_define_use],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_get([[foo]])
|
# b4_percent_define_get([[foo]])
|
||||||
m4_define([b4_percent_define_get],
|
m4_define([b4_percent_define_get],
|
||||||
[b4_percent_define_use([$1])dnl
|
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
||||||
m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
|
m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
|
||||||
|
|
||||||
# b4_percent_define_get_loc(VARIABLE)
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
@@ -626,15 +424,9 @@ m4_define([b4_percent_define_get_syncline],
|
|||||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
m4_define([b4_percent_define_ifdef],
|
m4_define([b4_percent_define_ifdef],
|
||||||
[m4_ifdef([b4_percent_define(]$1[)],
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[b4_percent_define_use([$1])$2],
|
[m4_define([b4_percent_define_bison_variables(]$1[)])$2],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
|
||||||
## Options. ##
|
|
||||||
## --------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,
|
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,
|
||||||
@@ -658,7 +450,6 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
[[b4_percent_define_flag_if($1)]])])],
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_flag_if]], [$1])])])
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_flag_if]], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT)
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle_tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle_tab.h exactly. That is,
|
||||||
@@ -673,23 +464,10 @@ m4_define([b4_percent_define_default],
|
|||||||
[m4_ifndef([b4_percent_define(]$1[)],
|
[m4_ifndef([b4_percent_define(]$1[)],
|
||||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
m4_define([b4_percent_define_loc(]$1[)],
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
[[[[<skeleton default value>:-1.-1]],
|
[[[[[Bison:b4_percent_define_default]:1.0]], [[[Bison:b4_percent_define_default]:1.0]]]])dnl
|
||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
m4_define([b4_percent_define_syncline(]$1[)],
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
[[]b4_syncline(1, [["[Bison:b4_percent_define_default]"]])[
|
||||||
|
]])])])
|
||||||
|
|
||||||
# b4_percent_define_if_define(VARIABLE)
|
|
||||||
# -------------------------------------
|
|
||||||
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether
|
|
||||||
# VARIABLE was %defined. The characters `.' and `-' in VARIABLE are mapped
|
|
||||||
# to `_'.
|
|
||||||
m4_define([b4_percent_define_if_define_],
|
|
||||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
|
||||||
[b4_percent_define_flag_if([$1], [$2], [$3])])])
|
|
||||||
m4_define([b4_percent_define_if_define],
|
|
||||||
[b4_percent_define_default([[$1]], [[false]])
|
|
||||||
b4_percent_define_if_define_([$1], $[1], $[2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
@@ -722,11 +500,7 @@ m4_define([_b4_percent_define_check_values],
|
|||||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||||
[[invalid value for %%define variable `%s': `%s']],
|
[[invalid value for %%define variable `%s': `%s']],
|
||||||
[$1],
|
[$1],
|
||||||
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
|
m4_dquote(m4_indir([b4_percent_define(]$1[)])))])dnl
|
||||||
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
|
||||||
[[accepted value: `%s']],
|
|
||||||
m4_dquote(b4_value))])])dnl
|
|
||||||
m4_popdef([b4_good_value])],
|
m4_popdef([b4_good_value])],
|
||||||
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])])
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])])
|
||||||
|
|
||||||
@@ -765,41 +539,6 @@ m4_define([b4_percent_code_ifdef],
|
|||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
## ------------------ ##
|
|
||||||
## Common variables. ##
|
|
||||||
## ------------------ ##
|
|
||||||
|
|
||||||
# Default values for %define.
|
|
||||||
# ---------------------------
|
|
||||||
# If the api.tokens.prefix, it is empty.
|
|
||||||
m4_percent_define_default([[api.tokens.prefix]], [[]])
|
|
||||||
|
|
||||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
|
||||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
|
||||||
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
|
||||||
# ----------------------------------------------
|
|
||||||
b4_percent_define_if_define([lex_symbol])
|
|
||||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
|
||||||
b4_percent_define_if_define([parse.assert])
|
|
||||||
b4_percent_define_if_define([parse.trace])
|
|
||||||
b4_percent_define_if_define([variant])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
|
||||||
# ------------------------------------------------------
|
|
||||||
# Map %define parse.error "(simple|verbose)" to b4_error_verbose_if and
|
|
||||||
# b4_error_verbose_flag.
|
|
||||||
b4_percent_define_default([[parse.error]], [[simple]])
|
|
||||||
b4_percent_define_check_values([[[[parse.error]],
|
|
||||||
[[simple]], [[verbose]]]])
|
|
||||||
m4_define([b4_error_verbose_flag],
|
|
||||||
m4_case(b4_percent_define_get([[parse.error]]),
|
|
||||||
[simple], [[0]],
|
|
||||||
[verbose], [[1]]))
|
|
||||||
b4_define_flag_if([error_verbose])
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------------------------------------------------- ##
|
## ----------------------------------------------------------- ##
|
||||||
## After processing the skeletons, check that all the user's ##
|
## After processing the skeletons, check that all the user's ##
|
||||||
## %define variables and %code qualifiers were used by Bison. ##
|
## %define variables and %code qualifiers were used by Bison. ##
|
||||||
@@ -811,7 +550,7 @@ m4_define([b4_check_user_names_wrap],
|
|||||||
[b4_percent_]$1[_user_]$2[s],
|
[b4_percent_]$1[_user_]$2[s],
|
||||||
[[b4_percent_]$1[_bison_]$2[s]])])])
|
[[b4_percent_]$1[_bison_]$2[s]])])])
|
||||||
|
|
||||||
m4_wrap_lifo([
|
m4_wrap([
|
||||||
b4_check_user_names_wrap([[define]], [[variable]])
|
b4_check_user_names_wrap([[define]], [[variable]])
|
||||||
b4_check_user_names_wrap([[code]], [[qualifier]])
|
b4_check_user_names_wrap([[code]], [[qualifier]])
|
||||||
])
|
])
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
# Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2007 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
-313
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
# Free Software Foundation, Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,24 +24,22 @@ m4_include(b4_pkgdatadir/[c.m4])
|
|||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
|
# Default parser class name.
|
||||||
b4_percent_define_default([[parser_class_name]], [[parser]])
|
b4_percent_define_default([[parser_class_name]], [[parser]])
|
||||||
b4_percent_define_default([[location_type]], [[location]])
|
b4_percent_define_default([[location_type]], [[location]])
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
|
||||||
|
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
b4_percent_define_default([[define_location_comparison]],
|
b4_percent_define_default([[define_location_comparison]],
|
||||||
[m4_if(b4_percent_define_get([[filename_type]]),
|
[m4_if(b4_percent_define_get([[filename_type]]),
|
||||||
[std::string], [[true]], [[false]])])
|
[std::string], [[true]], [[false]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
## Namespace. ##
|
## Namespace. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
m4_define([b4_namespace_ref], [b4_percent_define_get([[namespace]])])
|
||||||
|
|
||||||
|
|
||||||
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
||||||
# would compile as an absolute reference with `parser' in the global namespace.
|
# would compile as an absolute reference with `parser' in the global namespace.
|
||||||
@@ -51,7 +49,7 @@ m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
|||||||
# include the header, which is always generated. If we ever need to permit
|
# include the header, which is always generated. If we ever need to permit
|
||||||
# internal linkage somehow, surely we can find a cleaner approach.
|
# internal linkage somehow, surely we can find a cleaner approach.
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
[[namespace reference is empty]])])
|
[[namespace reference is empty]])])
|
||||||
|
|
||||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||||
@@ -62,24 +60,24 @@ m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
|||||||
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
||||||
# those into anonymous namespaces, and that might tempt some users.
|
# those into anonymous namespaces, and that might tempt some users.
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
[[namespace reference has consecutive "::"]])])
|
[[namespace reference has consecutive "::"]])])
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
[[namespace reference has a trailing "::"]])])
|
[[namespace reference has a trailing "::"]])])
|
||||||
|
|
||||||
m4_define([b4_namespace_open],
|
m4_define([b4_namespace_open],
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||||
[^\(.\)[ ]*::], [\1])),
|
[^\(.\)[ ]*::], [\1])),
|
||||||
[::], [ { namespace ])[ {]])])
|
[::], [ { namespace ])[ {]])])
|
||||||
|
|
||||||
m4_define([b4_namespace_close],
|
m4_define([b4_namespace_close],
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||||
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^][:]\)*],
|
||||||
[\1])),
|
[\1])),
|
||||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
[::\([^][:]\|:[^][:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
@@ -99,307 +97,12 @@ m4_map_sep([ b4_token_enum], [,
|
|||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
# b4_semantic_type_declare
|
|
||||||
# ------------------------
|
|
||||||
# Declare semantic_type.
|
|
||||||
m4_define([b4_semantic_type_declare],
|
|
||||||
[ /// Symbol semantic values.
|
|
||||||
m4_ifdef([b4_stype],
|
|
||||||
[ union semantic_type
|
|
||||||
{b4_user_stype
|
|
||||||
};],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[ typedef int semantic_type;]],
|
|
||||||
[[ typedef YYSTYPE semantic_type;]])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
|
||||||
# -----------------------
|
|
||||||
# Define the public types: token, semantic value, location, and so forth.
|
|
||||||
# Depending on %define token_lex, may be output in the header or source file.
|
|
||||||
m4_define([b4_public_types_declare],
|
|
||||||
[[#ifndef YYSTYPE
|
|
||||||
]b4_semantic_type_declare[
|
|
||||||
#else
|
|
||||||
typedef YYSTYPE semantic_type;
|
|
||||||
#endif]b4_locations_if([
|
|
||||||
/// Symbol locations.
|
|
||||||
typedef b4_percent_define_get([[location_type]]) location_type;])[
|
|
||||||
|
|
||||||
/// Tokens.
|
|
||||||
struct token
|
|
||||||
{
|
|
||||||
]b4_token_enums(b4_tokens)[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Token type.
|
|
||||||
typedef token::yytokentype token_type;
|
|
||||||
|
|
||||||
/// A complete symbol, with its type.
|
|
||||||
template <typename Exact>
|
|
||||||
struct symbol_base_type
|
|
||||||
{
|
|
||||||
/// Default constructor.
|
|
||||||
inline symbol_base_type ();
|
|
||||||
|
|
||||||
/// Constructor.]b4_locations_if([
|
|
||||||
inline symbol_base_type (const location_type& l)])[;
|
|
||||||
inline symbol_base_type (]b4_args(
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// Release the memory allocated to members.
|
|
||||||
/// Reclaim the semantic value using the %destructor directive.
|
|
||||||
void clear ();
|
|
||||||
|
|
||||||
/// Print the semantic value using the %printer directive.
|
|
||||||
std::ostream& print (std::ostream& o) const;
|
|
||||||
|
|
||||||
/// Print everything about the symbol (type, value, location).
|
|
||||||
std::ostream& dump (std::ostream& o) const;
|
|
||||||
|
|
||||||
/// Return this with its exact type.
|
|
||||||
const Exact& self () const;
|
|
||||||
Exact& self ();
|
|
||||||
|
|
||||||
/// Return the type of this symbol.
|
|
||||||
int type_get () const;
|
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
|
||||||
/// The name for the type.
|
|
||||||
const char *type_name () const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// The semantic value.
|
|
||||||
semantic_type value;]b4_locations_if([
|
|
||||||
|
|
||||||
/// The location.
|
|
||||||
location_type location;])[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// External form of a symbol: its type and attributes.
|
|
||||||
struct symbol_type : symbol_base_type<symbol_type>
|
|
||||||
{
|
|
||||||
/// The parent class.
|
|
||||||
typedef symbol_base_type<symbol_type> super_type;
|
|
||||||
|
|
||||||
/// Default constructor.
|
|
||||||
inline symbol_type ();
|
|
||||||
|
|
||||||
/// Constructor.
|
|
||||||
inline symbol_type (]b4_args([int t],
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
inline symbol_type (]b4_args([int t],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// The symbol type.
|
|
||||||
int type;
|
|
||||||
|
|
||||||
/// Return the type corresponding to this state.
|
|
||||||
inline int type_get_ () const;
|
|
||||||
|
|
||||||
/// Its token.
|
|
||||||
token_type token () const;
|
|
||||||
};
|
|
||||||
]b4_symbol_constructor_declare])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_define
|
|
||||||
# ----------------------
|
|
||||||
# Provide the implementation needed by the public types.
|
|
||||||
m4_define([b4_public_types_define],
|
|
||||||
[[ // symbol_base_type.
|
|
||||||
template <typename Exact>
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type ()
|
|
||||||
: value()]b4_locations_if([
|
|
||||||
, location()])[
|
|
||||||
{
|
|
||||||
}]b4_locations_if([[
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (const location_type& l)
|
|
||||||
: value()
|
|
||||||
, location(l)
|
|
||||||
{
|
|
||||||
}]])[
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args(
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: value(v)]b4_locations_if([
|
|
||||||
, location(l)])[
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
void
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::clear ()
|
|
||||||
{
|
|
||||||
int yytype = type_get ();
|
|
||||||
// User destructor.
|
|
||||||
switch (yytype)
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}]b4_variant_if([
|
|
||||||
|
|
||||||
// Type destructor.
|
|
||||||
b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
std::ostream&
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::print (std::ostream& yystream) const
|
|
||||||
{
|
|
||||||
#define debug_stream() yystream
|
|
||||||
switch (type_get ())
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#undef debug_stream
|
|
||||||
return yystream;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
std::ostream&
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::dump (std::ostream& yystream) const
|
|
||||||
{
|
|
||||||
int yytype = type_get ();
|
|
||||||
yystream << (yytype < yyntokens_ ? "token" : "nterm")
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
|
||||||
<< ' ' << type_name ()
|
|
||||||
#endif
|
|
||||||
<< " ("]b4_locations_if([
|
|
||||||
<< location << ": "])[;
|
|
||||||
print (yystream);
|
|
||||||
return yystream << ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
const Exact&
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::self () const
|
|
||||||
{
|
|
||||||
return static_cast<const Exact&>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
Exact&
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::self ()
|
|
||||||
{
|
|
||||||
return static_cast<Exact&>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
int
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::type_get () const
|
|
||||||
{
|
|
||||||
return self ().type_get_ ();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
|
||||||
template <typename Exact>
|
|
||||||
const char *
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::type_name () const
|
|
||||||
{
|
|
||||||
return ]b4_parser_class_name[::yytname_[type_get ()];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// symbol_type.
|
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type ()
|
|
||||||
: super_type ()
|
|
||||||
, type ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
|
||||||
[int t],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (]b4_locations_if([l])[)
|
|
||||||
, type (t)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
|
||||||
[int t],
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (v]b4_locations_if([, l])[)
|
|
||||||
, type (t)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
]b4_parser_class_name[::symbol_type::type_get_ () const
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
]b4_lex_symbol_if([[
|
|
||||||
]b4_parser_class_name[::token_type
|
|
||||||
]b4_parser_class_name[::symbol_type::token () const
|
|
||||||
{
|
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
|
||||||
// (internal) symbol number NUM (which must be that of a token). */
|
|
||||||
static
|
|
||||||
const ]b4_int_type_for([b4_toknum])[
|
|
||||||
yytoken_number_[] =
|
|
||||||
{
|
|
||||||
]b4_toknum[
|
|
||||||
};
|
|
||||||
return static_cast<token_type> (yytoken_number_[type]);
|
|
||||||
}
|
|
||||||
]])[]dnl
|
|
||||||
b4_symbol_constructor_define])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare
|
|
||||||
# b4_symbol_constructor_define
|
|
||||||
# -----------------------------
|
|
||||||
# Declare/define symbol constructors for all the value types.
|
|
||||||
# Use at class-level. Redefined in variant.hh.
|
|
||||||
m4_define([b4_symbol_constructor_declare], [])
|
|
||||||
m4_define([b4_symbol_constructor_define], [])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yytranslate_define
|
|
||||||
# ---------------------
|
|
||||||
# Define yytranslate_. Sometimes used in the header file,
|
|
||||||
# sometimes in the cc file.
|
|
||||||
m4_define([b4_yytranslate_define],
|
|
||||||
[[ // Symbol number corresponding to token number t.
|
|
||||||
]b4_parser_class_name[::token_number_type
|
|
||||||
]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
|
|
||||||
[int])[ t)
|
|
||||||
{
|
|
||||||
static
|
|
||||||
const token_number_type
|
|
||||||
translate_table[] =
|
|
||||||
{
|
|
||||||
]b4_translate[
|
|
||||||
};
|
|
||||||
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
|
|
||||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
if (static_cast<int>(t) <= yyeof_)
|
|
||||||
return yyeof_;
|
|
||||||
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
|
|
||||||
return translate_table[t];
|
|
||||||
else
|
|
||||||
return undef_token_;
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value([TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------
|
# --------------------
|
||||||
# Expansion of $<TYPE>$.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value([yyval], [$1])])
|
[(yyval[]m4_ifval([$1], [.$1]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
@@ -407,8 +110,7 @@ m4_define([b4_lhs_value],
|
|||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
# b4_lhs_location()
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
# Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2007 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,8 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
# 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,40 +20,17 @@
|
|||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
# b4_comment(TEXT)
|
||||||
# -------------------------------------
|
# ----------------
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
], [
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
]) */])
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
|
|
||||||
\(.\)], [
|
|
||||||
$3\1])$4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_comment(TEXT, [PREFIX])
|
|
||||||
# ----------------------------
|
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
|
||||||
# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_c_comment],
|
|
||||||
[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# By default, C comments.
|
|
||||||
m4_define([b4_comment], [b4_c_comment($@)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
||||||
# b4_pull_flag if they use the values of the %define variables api.pure or
|
# b4_pull_flag if they use the values of the %define variables api.pure or
|
||||||
# api.push-pull.
|
# api.push_pull.
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[[/* Identify Bison output. */
|
[[/* Identify Bison output. */
|
||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
@@ -75,7 +51,7 @@ m4_define([b4_identification],
|
|||||||
#define YYPULL ]b4_pull_flag])[
|
#define YYPULL ]b4_pull_flag])[
|
||||||
|
|
||||||
/* Using locations. */
|
/* Using locations. */
|
||||||
#define YYLSP_NEEDED ]b4_locations_if([1], [0])[
|
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -113,7 +89,7 @@ b4_parse_param)
|
|||||||
# the formal name to FORMAL, and evaluating the BODY.
|
# the formal name to FORMAL, and evaluating the BODY.
|
||||||
m4_define([b4_parse_param_for],
|
m4_define([b4_parse_param_for],
|
||||||
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
||||||
[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
|
[m4_pushdef([$1], m4_fst($1_$2))dnl
|
||||||
m4_pushdef([$2], m4_shift($1_$2))dnl
|
m4_pushdef([$2], m4_shift($1_$2))dnl
|
||||||
$3[]dnl
|
$3[]dnl
|
||||||
m4_popdef([$2])dnl
|
m4_popdef([$2])dnl
|
||||||
@@ -156,19 +132,6 @@ m4_define([b4_int_type],
|
|||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
|
|
||||||
# b4_table_value_equals(TABLE, VALUE, LITERAL)
|
|
||||||
# --------------------------------------------
|
|
||||||
# Without inducing a comparison warning from the compiler, check if the
|
|
||||||
# literal value LITERAL equals VALUE from table TABLE, which must have
|
|
||||||
# TABLE_min and TABLE_max defined. YYID must be defined as an identity
|
|
||||||
# function that suppresses warnings about constant conditions.
|
|
||||||
m4_define([b4_table_value_equals],
|
|
||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|
||||||
[[YYID (0)]],
|
|
||||||
[[((]$2[) == (]$3[))]])])
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
## Values. ##
|
## Values. ##
|
||||||
## ---------##
|
## ---------##
|
||||||
@@ -180,19 +143,6 @@ m4_define([b4_table_value_equals],
|
|||||||
m4_define([b4_null], [0])
|
m4_define([b4_null], [0])
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
|
||||||
# -------------------------------------------------------------
|
|
||||||
# Define "yy<TABLE-NAME>" which contents is CONTENT.
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[m4_ifval([$3], [b4_c_comment([$3], [ ])
|
|
||||||
])dnl
|
|
||||||
static const b4_int_type_for([$2]) yy$1[[]] =
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
};dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Assigning token numbers. ##
|
## Assigning token numbers. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
@@ -201,7 +151,7 @@ static const b4_int_type_for([$2]) yy$1[[]] =
|
|||||||
# -----------------------------------------
|
# -----------------------------------------
|
||||||
# Output the definition of this token as #define.
|
# Output the definition of this token as #define.
|
||||||
m4_define([b4_token_define],
|
m4_define([b4_token_define],
|
||||||
[#define b4_percent_define_get([api.tokens.prefix])$1 $2
|
[#define $1 $2
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -209,7 +159,7 @@ m4_define([b4_token_define],
|
|||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as #defines.
|
# Output the definition of the tokens (if there are) as #defines.
|
||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
m4_map([b4_token_define], [$@])])
|
m4_map([b4_token_define], [$@])])
|
||||||
])
|
])
|
||||||
@@ -219,14 +169,14 @@ m4_map([b4_token_define], [$@])])
|
|||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_percent_define_get([api.tokens.prefix])$1 = $2])
|
[$1 = $2])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
@@ -250,21 +200,6 @@ m4_define([b4_token_enums_defines],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Semantic Values. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [TYPE])
|
|
||||||
# ----------------------------
|
|
||||||
# Given a semantic value VAL ($$, $1 etc.), extract its value of type
|
|
||||||
# TYPE if TYPE is given, otherwise just return VAL. The result can be
|
|
||||||
# used safetly, 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],
|
|
||||||
[($1[]m4_ifval([$2], [.$2]))])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------------------------------- ##
|
## --------------------------------------------- ##
|
||||||
## Defining C functions in both K&R and ANSI-C. ##
|
## Defining C functions in both K&R and ANSI-C. ##
|
||||||
@@ -293,8 +228,8 @@ m4_define([b4_c_function_def],
|
|||||||
b4_c_ansi_function_def($@)
|
b4_c_ansi_function_def($@)
|
||||||
#else
|
#else
|
||||||
$2
|
$2
|
||||||
$1 (b4_c_knr_formal_names(m4_shift2($@)))
|
$1 (b4_c_knr_formal_names(m4_shiftn(2, $@)))
|
||||||
b4_c_knr_formal_decls(m4_shift2($@))
|
b4_c_knr_formal_decls(m4_shiftn(2, $@))
|
||||||
#endif[]dnl
|
#endif[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -304,7 +239,7 @@ b4_c_knr_formal_decls(m4_shift2($@))
|
|||||||
# Declare the function NAME in ANSI.
|
# Declare the function NAME in ANSI.
|
||||||
m4_define([b4_c_ansi_function_def],
|
m4_define([b4_c_ansi_function_def],
|
||||||
[$2
|
[$2
|
||||||
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
$1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -312,8 +247,9 @@ $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
|||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Output the arguments ANSI-C definition.
|
# Output the arguments ANSI-C definition.
|
||||||
m4_define([b4_c_ansi_formals],
|
m4_define([b4_c_ansi_formals],
|
||||||
[m4_if([$#], [0], [void],
|
[m4_case([$@],
|
||||||
[$#$1], [1], [void],
|
[], [void],
|
||||||
|
[[]], [void],
|
||||||
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||||
|
|
||||||
m4_define([b4_c_ansi_formal],
|
m4_define([b4_c_ansi_formal],
|
||||||
@@ -353,7 +289,7 @@ m4_define([b4_c_knr_formal_decl],
|
|||||||
# -----------------------------------------------------------
|
# -----------------------------------------------------------
|
||||||
# Declare the function NAME.
|
# Declare the function NAME.
|
||||||
m4_define([b4_c_function_decl],
|
m4_define([b4_c_function_decl],
|
||||||
[#if b4_c_modern
|
[#if defined __STDC__ || defined __cplusplus
|
||||||
b4_c_ansi_function_decl($@)
|
b4_c_ansi_function_decl($@)
|
||||||
#else
|
#else
|
||||||
$2 $1 ();
|
$2 $1 ();
|
||||||
@@ -365,7 +301,7 @@ $2 $1 ();
|
|||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# Declare the function NAME.
|
# Declare the function NAME.
|
||||||
m4_define([b4_c_ansi_function_decl],
|
m4_define([b4_c_ansi_function_decl],
|
||||||
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
[$2 $1 (b4_c_ansi_formals(m4_shiftn(2, $@)));[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -380,7 +316,7 @@ m4_define([b4_c_ansi_function_decl],
|
|||||||
# -----------------------------------------------------------
|
# -----------------------------------------------------------
|
||||||
# Call the function NAME with arguments NAME1, NAME2 etc.
|
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||||
m4_define([b4_c_function_call],
|
m4_define([b4_c_function_call],
|
||||||
[$1 (b4_c_args(m4_shift2($@)))[]dnl
|
[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -412,9 +348,25 @@ m4_define([b4_sync_start], [[#]line $1 $2])
|
|||||||
m4_define([b4_case],
|
m4_define([b4_case],
|
||||||
[ case $1:
|
[ case $1:
|
||||||
$2
|
$2
|
||||||
b4_syncline([@oline@], [@ofile@])
|
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
|
# b4_symbol_actions(FILENAME, LINENO,
|
||||||
|
# SYMBOL-TAG, SYMBOL-NUM,
|
||||||
|
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||||
|
# -------------------------------------------------
|
||||||
|
m4_define([b4_symbol_actions],
|
||||||
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
|
[m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
|
||||||
|
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
||||||
|
case $4: /* $3 */
|
||||||
|
b4_syncline([$2], [$1])
|
||||||
|
$5;
|
||||||
|
b4_syncline([@oline@], [@ofile@])
|
||||||
|
break;
|
||||||
|
m4_popdef([b4_at_dollar])dnl
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
@@ -446,8 +398,8 @@ b4_parse_param_use[]dnl
|
|||||||
|
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
||||||
[ default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}]dnl
|
}]dnl
|
||||||
@@ -487,7 +439,7 @@ b4_parse_param_use[]dnl
|
|||||||
# endif
|
# endif
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
[ default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+164
-103
@@ -1,8 +1,8 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -109,15 +109,7 @@ m4_define([b4_pure_formals],
|
|||||||
# --------------------
|
# --------------------
|
||||||
# Expansion of $<TYPE>$.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value([(*yyvalp)], [$1])])
|
[((*yyvalp)[]m4_ifval([$1], [.$1]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_data(RULE-LENGTH, NUM)
|
|
||||||
# -----------------------------
|
|
||||||
# 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],
|
|
||||||
[((yyGLRStackItem const *)yyvsp)@{YYFILL (b4_subtract([$2], [$1]))@}.yystate])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
@@ -125,7 +117,7 @@ m4_define([b4_rhs_data],
|
|||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yysval], [$3])])
|
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +137,7 @@ m4_define([b4_lhs_location],
|
|||||||
# Expansion of @NUM, 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]).yyloc)])
|
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yyloc)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -156,9 +148,9 @@ m4_define([b4_rhs_location],
|
|||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(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, 2003, 2004, 2005, 2006, 2007, 2008, 2009])
|
[2002, 2003, 2004, 2005, 2006])
|
||||||
[
|
[
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
@@ -224,7 +216,7 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
|||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling verbose error messages. */
|
/* Enabling verbose error messages. */
|
||||||
@@ -232,7 +224,7 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
|||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
/* Enabling the token table. */
|
||||||
@@ -367,6 +359,19 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
|
YYRHS. */
|
||||||
|
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
||||||
|
{
|
||||||
|
]b4_prhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
|
static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
|
||||||
|
{
|
||||||
|
]b4_rhs[
|
||||||
|
};
|
||||||
|
|
||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const ]b4_int_type_for([b4_rline])[ yyrline[] =
|
static const ]b4_int_type_for([b4_rline])[ yyrline[] =
|
||||||
{
|
{
|
||||||
@@ -383,10 +388,17 @@ static const char *const yytname[] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define YYPACT_NINF ]b4_pact_ninf[
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
static const ]b4_int_type_for([b4_r1])[ yyr1[] =
|
||||||
|
{
|
||||||
|
]b4_r1[
|
||||||
|
};
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
static const ]b4_int_type_for([b4_r2])[ yyr2[] =
|
||||||
|
{
|
||||||
|
]b4_r2[
|
||||||
|
};
|
||||||
|
|
||||||
/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
|
/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
|
||||||
static const ]b4_int_type_for([b4_dprec])[ yydprec[] =
|
static const ]b4_int_type_for([b4_dprec])[ yydprec[] =
|
||||||
@@ -400,6 +412,44 @@ static const ]b4_int_type_for([b4_merger])[ yymerger[] =
|
|||||||
]b4_merger[
|
]b4_merger[
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
|
doesn't specify something else to do. Zero means the default is an
|
||||||
|
error. */
|
||||||
|
static const ]b4_int_type_for([b4_defact])[ yydefact[] =
|
||||||
|
{
|
||||||
|
]b4_defact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPDEFGOTO[NTERM-NUM]. */
|
||||||
|
static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
|
||||||
|
{
|
||||||
|
]b4_defgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
|
STATE-NUM. */
|
||||||
|
#define YYPACT_NINF ]b4_pact_ninf[
|
||||||
|
static const ]b4_int_type_for([b4_pact])[ yypact[] =
|
||||||
|
{
|
||||||
|
]b4_pact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
|
static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
|
||||||
|
{
|
||||||
|
]b4_pgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If zero, do what YYDEFACT says.
|
||||||
|
If YYTABLE_NINF, syntax error. */
|
||||||
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
|
static const ]b4_int_type_for([b4_table])[ yytable[] =
|
||||||
|
{
|
||||||
|
]b4_table[
|
||||||
|
};
|
||||||
|
|
||||||
/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
|
/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
|
||||||
list of conflicting reductions corresponding to action entry for
|
list of conflicting reductions corresponding to action entry for
|
||||||
state STATE-NUM in yytable. 0 means no conflicts. The list in
|
state STATE-NUM in yytable. 0 means no conflicts. The list in
|
||||||
@@ -418,6 +468,19 @@ dnl We probably ought to introduce a type for confl.
|
|||||||
{
|
{
|
||||||
]b4_conflicting_rules[
|
]b4_conflicting_rules[
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
||||||
|
{
|
||||||
|
]b4_check[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||||
|
symbol of state STATE-NUM. */
|
||||||
|
static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
||||||
|
{
|
||||||
|
]b4_stos[
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Prevent warning if -Wmissing-prototypes. */
|
/* Prevent warning if -Wmissing-prototypes. */
|
||||||
]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[
|
]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[
|
||||||
@@ -500,12 +563,9 @@ static const int YYEMPTY = -2;
|
|||||||
|
|
||||||
typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
||||||
|
|
||||||
#define YYCHK(YYE) \
|
#define YYCHK(YYE) \
|
||||||
do { \
|
do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
|
||||||
YYRESULTTAG yyflag = YYE; \
|
while (YYID (0))
|
||||||
if (yyflag != yyok) \
|
|
||||||
return yyflag; \
|
|
||||||
} while (YYID (0))
|
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
|
|
||||||
@@ -514,23 +574,23 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define YYDPRINTF(Args) \
|
# define YYDPRINTF(Args) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[
|
]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
{ \
|
{ \
|
||||||
YYFPRINTF (stderr, "%s ", Title); \
|
YYFPRINTF (stderr, "%s ", Title); \
|
||||||
yy_symbol_print (stderr, Type, \
|
yy_symbol_print (stderr, Type, \
|
||||||
Value]b4_locations_if([, Location])[]b4_user_args[); \
|
Value]b4_locations_if([, Location])[]b4_user_args[); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
} \
|
} \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
@@ -953,15 +1013,17 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
return yyr1[yyrule];
|
return yyr1[yyrule];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yyis_pact_ninf(yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), [1],
|
||||||
|
[0],
|
||||||
|
[((yystate) == YYPACT_NINF)])[
|
||||||
|
|
||||||
/** True iff LR state STATE has only a default reduction (regardless
|
/** True iff LR state STATE has only a default reduction (regardless
|
||||||
* of token). */
|
* of token). */
|
||||||
static inline yybool
|
static inline yybool
|
||||||
yyisDefaultedState (yyStateNum yystate)
|
yyisDefaultedState (yyStateNum yystate)
|
||||||
{
|
{
|
||||||
return yypact_value_is_default (yypact[yystate]);
|
return yyis_pact_ninf (yypact[yystate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The default reduction for STATE, assuming it has one. */
|
/** The default reduction for STATE, assuming it has one. */
|
||||||
@@ -971,8 +1033,10 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
return yydefact[yystate];
|
return yydefact[yystate];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yyis_table_ninf(yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]m4_if(m4_eval(b4_table_ninf < b4_table_min), [1],
|
||||||
|
[YYID (0)],
|
||||||
|
[((yytable_value) == YYTABLE_NINF)])[
|
||||||
|
|
||||||
/** Set *YYACTION to 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
|
||||||
@@ -987,13 +1051,12 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
|||||||
int* yyaction, const short int** yyconflicts)
|
int* yyaction, const short int** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yypact_value_is_default (yypact[yystate])
|
if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
||||||
|| yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
|
||||||
{
|
{
|
||||||
*yyaction = -yydefact[yystate];
|
*yyaction = -yydefact[yystate];
|
||||||
*yyconflicts = yyconfl;
|
*yyconflicts = yyconfl;
|
||||||
}
|
}
|
||||||
else if (! yytable_value_is_error (yytable[yyindex]))
|
else if (! yyis_table_ninf (yytable[yyindex]))
|
||||||
{
|
{
|
||||||
*yyaction = yytable[yyindex];
|
*yyaction = yytable[yyindex];
|
||||||
*yyconflicts = yyconfl + yyconflp[yyindex];
|
*yyconflicts = yyconfl + yyconflp[yyindex];
|
||||||
@@ -1008,7 +1071,8 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
|||||||
static inline yyStateNum
|
static inline yyStateNum
|
||||||
yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
|
yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
|
||||||
{
|
{
|
||||||
int yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
int yyr;
|
||||||
|
yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
||||||
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
||||||
return yytable[yyr];
|
return yytable[yyr];
|
||||||
else
|
else
|
||||||
@@ -1049,11 +1113,11 @@ yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState)
|
|||||||
* stack #K of *STACKP. */
|
* stack #K of *STACKP. */
|
||||||
static void
|
static void
|
||||||
yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
|
yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
|
||||||
yyGLRState* yyrhs, yyRuleNum yyrule)
|
yyGLRState* rhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yySemanticOption* yynewOption =
|
yySemanticOption* yynewOption =
|
||||||
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
||||||
yynewOption->yystate = yyrhs;
|
yynewOption->yystate = rhs;
|
||||||
yynewOption->yyrule = yyrule;
|
yynewOption->yyrule = yyrule;
|
||||||
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
||||||
{
|
{
|
||||||
@@ -1284,7 +1348,7 @@ yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
* semantic value of YYRHS under the action for YYRULE. */
|
* semantic value of YYRHS under the action for YYRULE. */
|
||||||
static inline void
|
static inline void
|
||||||
yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
||||||
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
|
|
||||||
@@ -1296,7 +1360,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
yystackp->yytops.yystates[yyk] = yynewState;
|
yystackp->yytops.yystates[yyk] = yynewState;
|
||||||
|
|
||||||
/* Invokes YY_RESERVE_GLRSTACK. */
|
/* Invokes YY_RESERVE_GLRSTACK. */
|
||||||
yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule);
|
yyaddDeferredAction (yystackp, yyk, yynewState, rhs, yyrule);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Pop the symbols consumed by reduction #RULE from the top of stack
|
/** Pop the symbols consumed by reduction #RULE from the top of stack
|
||||||
@@ -1314,12 +1378,12 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
if (yystackp->yysplitPoint == NULL)
|
if (yystackp->yysplitPoint == NULL)
|
||||||
{
|
{
|
||||||
/* Standard special case: single stack. */
|
/* Standard special case: single stack. */
|
||||||
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
yyGLRStackItem* rhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
||||||
YYASSERT (yyk == 0);
|
YYASSERT (yyk == 0);
|
||||||
yystackp->yynextFree -= yynrhs;
|
yystackp->yynextFree -= yynrhs;
|
||||||
yystackp->yyspaceLeft += yynrhs;
|
yystackp->yyspaceLeft += yynrhs;
|
||||||
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
||||||
return yyuserAction (yyrule, yynrhs, yyrhs,
|
return yyuserAction (yyrule, yynrhs, rhs,
|
||||||
yyvalp, yylocp, yystackp]b4_user_args[);
|
yyvalp, yylocp, yystackp]b4_user_args[);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1362,7 +1426,8 @@ do { \
|
|||||||
`----------------------------------------------------------*/
|
`----------------------------------------------------------*/
|
||||||
|
|
||||||
/*ARGSUSED*/ static inline void
|
/*ARGSUSED*/ static inline void
|
||||||
yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule]b4_user_formals[)
|
yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||||
|
YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
yybool yynormal __attribute__ ((__unused__)) =
|
yybool yynormal __attribute__ ((__unused__)) =
|
||||||
@@ -1370,6 +1435,8 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule]b4_user_form
|
|||||||
yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
||||||
int yylow = 1;
|
int yylow = 1;
|
||||||
int yyi;
|
int yyi;
|
||||||
|
YYUSE (yyvalp);
|
||||||
|
YYUSE (yylocp);
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
||||||
(unsigned long int) yyk, yyrule - 1,
|
(unsigned long int) yyk, yyrule - 1,
|
||||||
@@ -1378,8 +1445,7 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule]b4_user_form
|
|||||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||||
]yystos@{b4_rhs_data(yynrhs, yyi + 1).yylrState@}[,
|
|
||||||
&]b4_rhs_value(yynrhs, yyi + 1)[
|
&]b4_rhs_value(yynrhs, yyi + 1)[
|
||||||
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
||||||
b4_user_args[);
|
b4_user_args[);
|
||||||
@@ -1410,7 +1476,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
YYSTYPE yysval;
|
YYSTYPE yysval;
|
||||||
YYLTYPE yyloc;
|
YYLTYPE yyloc;
|
||||||
|
|
||||||
YY_REDUCE_PRINT ((yystackp, yyk, yyrule]b4_user_args[));
|
YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
|
||||||
YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval,
|
YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval,
|
||||||
&yyloc]b4_user_args[));
|
&yyloc]b4_user_args[));
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
||||||
@@ -1708,11 +1774,11 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
{
|
{
|
||||||
if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
|
if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
|
||||||
YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
|
YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
|
||||||
yytokenName (yystos[yystates[yyi-1]->yylrState]));
|
yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]));
|
||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
|
YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
|
||||||
yytokenName (yystos[yystates[yyi-1]->yylrState]),
|
yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]),
|
||||||
(unsigned long int) (yystates[yyi-1]->yyposn + 1),
|
(unsigned long int) (yystates[yyi - 1]->yyposn + 1),
|
||||||
(unsigned long int) yystates[yyi]->yyposn);
|
(unsigned long int) yystates[yyi]->yyposn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2039,58 +2105,51 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yybool yysize_overflow = yyfalse;
|
yybool yysize_overflow = yyfalse;
|
||||||
char* yymsg = NULL;
|
char* yymsg = NULL;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
|
||||||
const char *yyformat = 0;
|
|
||||||
/* Arguments of yyformat. */
|
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
|
int yyx;
|
||||||
|
char *yyfmt;
|
||||||
|
char const *yyf;
|
||||||
|
static char const yyunexpected[] = "syntax error, unexpected %s";
|
||||||
|
static char const yyexpecting[] = ", expecting %s";
|
||||||
|
static char const yyor[] = " or %s";
|
||||||
|
char yyformat[sizeof yyunexpected
|
||||||
|
+ sizeof yyexpecting - 1
|
||||||
|
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
|
||||||
|
* (sizeof yyor - 1))];
|
||||||
|
char const *yyprefix = yyexpecting;
|
||||||
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. In other words, skip the first -YYN actions for this
|
YYCHECK. */
|
||||||
state because they are default actions. */
|
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
int yychecklim = YYLAST - yyn + 1;
|
int yychecklim = YYLAST - yyn + 1;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
|
int yycount = 1;
|
||||||
|
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
yyarg[0] = yytokenName (yytoken);
|
||||||
"expected"). */
|
yyfmt = yystpcpy (yyformat, yyunexpected);
|
||||||
int yycount = 0;
|
|
||||||
int yyx;
|
|
||||||
|
|
||||||
yyarg[yycount++] = yytokenName (yytoken);
|
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||||||
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
yycount = 1;
|
yycount = 1;
|
||||||
yysize = yysize0;
|
yysize = yysize0;
|
||||||
|
yyformat[sizeof yyunexpected - 1] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytokenName (yyx);
|
yyarg[yycount++] = yytokenName (yyx);
|
||||||
yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
|
yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
|
||||||
yysize_overflow |= yysize1 < yysize;
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
|
yyfmt = yystpcpy (yyfmt, yyprefix);
|
||||||
|
yyprefix = yyor;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (yycount)
|
yyf = YY_(yyformat);
|
||||||
{
|
yysize1 = yysize + strlen (yyf);
|
||||||
#define YYCASE_(N, S) \
|
|
||||||
case N: \
|
|
||||||
yyformat = S; \
|
|
||||||
break
|
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
|
||||||
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
|
||||||
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
|
||||||
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
|
||||||
#undef YYCASE_
|
|
||||||
}
|
|
||||||
|
|
||||||
yysize1 = yysize + strlen (yyformat);
|
|
||||||
yysize_overflow |= yysize1 < yysize;
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
|
|
||||||
@@ -2101,17 +2160,17 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
char *yyp = yymsg;
|
char *yyp = yymsg;
|
||||||
int yyi = 0;
|
int yyi = 0;
|
||||||
while ((*yyp = *yyformat))
|
while ((*yyp = *yyf))
|
||||||
{
|
{
|
||||||
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
||||||
{
|
{
|
||||||
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
||||||
yyformat += 2;
|
yyf += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyp++;
|
yyp++;
|
||||||
yyformat++;
|
yyf++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yyerror (]b4_lyyerror_args[yymsg);
|
yyerror (]b4_lyyerror_args[yymsg);
|
||||||
@@ -2173,7 +2232,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
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 (yyis_pact_ninf (yyj))
|
||||||
return;
|
return;
|
||||||
yyj += yytoken;
|
yyj += yytoken;
|
||||||
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
||||||
@@ -2181,7 +2240,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (! yytable_value_is_error (yytable[yyj]))
|
else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj]))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2202,7 +2261,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
yyj = yypact[yys->yylrState];
|
yyj = yypact[yys->yylrState];
|
||||||
if (! yypact_value_is_default (yyj))
|
if (! yyis_pact_ninf (yyj))
|
||||||
{
|
{
|
||||||
yyj += YYTERROR;
|
yyj += YYTERROR;
|
||||||
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
||||||
@@ -2570,23 +2629,25 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
]b4_epilogue[]dnl
|
]
|
||||||
|
|
||||||
|
b4_epilogue
|
||||||
dnl
|
dnl
|
||||||
dnl glr.cc produces its own header.
|
dnl glr.cc produces its own header.
|
||||||
dnl
|
dnl
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[b4_defines_if(
|
[b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[@output(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, 2003, 2004, 2005, 2006, 2007, 2008, 2009])
|
[2002, 2003, 2004, 2005, 2006])
|
||||||
|
|
||||||
b4_shared_declarations
|
b4_shared_declarations
|
||||||
|
|
||||||
b4_pure_if([],
|
b4_pure_if([],
|
||||||
[[extern YYSTYPE ]b4_prefix[lval;]])
|
[[extern YYSTYPE b4_prefix][lval;]])
|
||||||
|
|
||||||
b4_locations_if([b4_pure_if([],
|
b4_locations_if([b4_pure_if([],
|
||||||
[extern YYLTYPE ]b4_prefix[lloc;])
|
[extern YYLTYPE b4_prefix[]lloc;])
|
||||||
])
|
])
|
||||||
])])[]dnl
|
])])
|
||||||
m4_divert_pop(0)
|
m4_divert_pop(0)
|
||||||
|
|||||||
+44
-14
@@ -1,6 +1,8 @@
|
|||||||
|
-*- C -*-
|
||||||
|
|
||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -27,7 +29,7 @@
|
|||||||
#
|
#
|
||||||
# The additional arguments are stored as members of the parser
|
# The additional arguments are stored as members of the parser
|
||||||
# object, yyparser. The C routines need to carry yyparser
|
# object, yyparser. The C routines need to carry yyparser
|
||||||
# throughout the C parser; that's easy: make yyparser an
|
# throughout the C parser; that easy: just let yyparser become an
|
||||||
# additional parse-param. But because the C++ skeleton needs to
|
# additional parse-param. But because the C++ skeleton needs to
|
||||||
# know the "real" original parse-param, we save them
|
# know the "real" original parse-param, we save them
|
||||||
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
||||||
@@ -37,14 +39,14 @@
|
|||||||
# The locations
|
# The locations
|
||||||
#
|
#
|
||||||
# We use location.cc just like lalr1.cc, but because glr.c stores
|
# We use location.cc just like lalr1.cc, but because glr.c stores
|
||||||
# the locations in a union, the position and location classes
|
# the locations in a (C++) union, the position and location classes
|
||||||
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
||||||
# must not define "b4_location_constructors". As a consequence the
|
# must not define "b4_location_constructors". As a consequence the
|
||||||
# user must initialize the first positions (in particular the
|
# user must initialize the first positions (in particular the
|
||||||
# filename member).
|
# filename member).
|
||||||
|
|
||||||
# We require a pure interface using locations.
|
# We require a pure interface using locations.
|
||||||
m4_define([b4_percent_define(locations)], [])
|
m4_define([b4_locations_flag], [1])
|
||||||
m4_define([b4_pure_flag], [1])
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
# The header is mandatory.
|
# The header is mandatory.
|
||||||
@@ -123,7 +125,8 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
]b4_parser_class_name::b4_parser_class_name[ (]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 YYDEBUG
|
#if YYDEBUG
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||||
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -152,7 +155,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
YYUSE (yylocationp);
|
YYUSE (yylocationp);
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
[ default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -186,18 +189,19 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
]b4_parser_class_name[::debug_level_type
|
]b4_parser_class_name[::debug_level_type
|
||||||
]b4_parser_class_name[::debug_level () const
|
]b4_parser_class_name[::debug_level () const
|
||||||
{
|
{
|
||||||
return yydebug;
|
return yydebug_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
yydebug = l;
|
yydebug_ = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
b4_namespace_close[
|
b4_namespace_close[
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -213,9 +217,9 @@ m4_include(b4_pkgdatadir/[glr.c])
|
|||||||
m4_popdef([b4_parse_param])
|
m4_popdef([b4_parse_param])
|
||||||
|
|
||||||
m4_divert_push(0)
|
m4_divert_push(0)
|
||||||
@output(b4_spec_defines_file@)@
|
@output(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, 2003, 2004, 2005, 2006, 2007, 2008, 2009])[
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/* C++ GLR parser skeleton written by Akim Demaille. */
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
@@ -228,7 +232,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
/* Using locations. */
|
/* Using locations. */
|
||||||
#define YYLSP_NEEDED ]b4_locations_if([1], [0])[
|
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
class position;
|
class position;
|
||||||
@@ -239,7 +243,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||||
@@ -266,7 +270,28 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]b4_public_types_declare[
|
/// Symbol semantic values.
|
||||||
|
#ifndef YYSTYPE
|
||||||
|
]m4_ifdef([b4_stype],
|
||||||
|
[ union semantic_type
|
||||||
|
{
|
||||||
|
b4_user_stype
|
||||||
|
};],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[ typedef int semantic_type;]],
|
||||||
|
[[ typedef YYSTYPE semantic_type;]])])[
|
||||||
|
#else
|
||||||
|
typedef YYSTYPE semantic_type;
|
||||||
|
#endif
|
||||||
|
/// Symbol locations.
|
||||||
|
typedef ]b4_percent_define_get([[location_type]])[ location_type;
|
||||||
|
/// Tokens.
|
||||||
|
struct token
|
||||||
|
{
|
||||||
|
]b4_token_enums(b4_tokens)[
|
||||||
|
};
|
||||||
|
/// Token type.
|
||||||
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
@@ -288,11 +313,14 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
/// 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);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Report a syntax error.
|
/// Report a syntax error.
|
||||||
/// \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.
|
||||||
virtual void error (const location_type& loc, const std::string& msg);
|
virtual void error (const location_type& loc, const std::string& msg);
|
||||||
|
private:
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
public:
|
public:
|
||||||
@@ -312,9 +340,11 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
const location_type* yylocationp);
|
const location_type* yylocationp);
|
||||||
private:
|
private:
|
||||||
/* Debugging. */
|
/* Debugging. */
|
||||||
|
int yydebug_;
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// \brief Reclaim the memory associated to a symbol.
|
/// \brief Reclaim the memory associated to a symbol.
|
||||||
/// \param yymsg Why this token is reclaimed.
|
/// \param yymsg Why this token is reclaimed.
|
||||||
/// \param yytype The symbol type.
|
/// \param yytype The symbol type.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
# Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2007 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
-93
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2007 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
|
||||||
@@ -25,23 +25,6 @@ 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)
|
# b4_flag_value(BOOLEAN-FLAG)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||||
@@ -61,20 +44,6 @@ m4_define([b4_abstract_if],
|
|||||||
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
# b4_final_if(TRUE, FALSE)
|
|
||||||
# ---------------------------
|
|
||||||
b4_percent_define_default([[final]], [[false]])
|
|
||||||
m4_define([b4_final_if],
|
|
||||||
[b4_percent_define_flag_if([final], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_strictfp_if(TRUE, FALSE)
|
|
||||||
# ---------------------------
|
|
||||||
b4_percent_define_default([[strictfp]], [[false]])
|
|
||||||
m4_define([b4_strictfp_if],
|
|
||||||
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
# b4_lexer_if(TRUE, FALSE)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
m4_define([b4_lexer_if],
|
m4_define([b4_lexer_if],
|
||||||
@@ -84,7 +53,10 @@ m4_define([b4_lexer_if],
|
|||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[ /** Version number for the Bison executable that generated this parser. */
|
[/** Always <tt>true</tt>, identifies Bison output. */
|
||||||
|
public static final boolean bison = true;
|
||||||
|
|
||||||
|
/** Version number for the Bison executable that generated this parser. */
|
||||||
public static final String bisonVersion = "b4_version";
|
public static final String bisonVersion = "b4_version";
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
/** Name of the skeleton that generated this parser. */
|
||||||
@@ -103,7 +75,7 @@ m4_define([b4_identification],
|
|||||||
m4_define([b4_int_type],
|
m4_define([b4_int_type],
|
||||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
@@ -117,27 +89,6 @@ m4_define([b4_int_type_for],
|
|||||||
m4_define([b4_null], [null])
|
m4_define([b4_null], [null])
|
||||||
|
|
||||||
|
|
||||||
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
|
|
||||||
# -------------------------------------------------------
|
|
||||||
m4_define([b4_typed_parser_table_define],
|
|
||||||
[m4_ifval([$4], [b4_comment([$4])
|
|
||||||
])dnl
|
|
||||||
[private static final ]$1[ yy$2_[] = yy$2_init();
|
|
||||||
private static final ]$1[[] yy$2_init()
|
|
||||||
{
|
|
||||||
return new ]$1[[]
|
|
||||||
{
|
|
||||||
]$3[
|
|
||||||
};
|
|
||||||
}]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
|
||||||
#-----------------------------------------------------
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Assigning token numbers. ##
|
## Assigning token numbers. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
@@ -146,8 +97,8 @@ m4_define([b4_integral_parser_table_define],
|
|||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[ /** Token number, to be returned by the scanner. */
|
[ /** Token number, to be returned by the scanner. */
|
||||||
static final int b4_percent_define_get([api.tokens.prefix])$1 = $2;
|
public static final int $1 = $2;
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +106,7 @@ m4_define([b4_token_enum],
|
|||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
m4_map([b4_token_enum], [$@])])
|
m4_map([b4_token_enum], [$@])])
|
||||||
])
|
])
|
||||||
@@ -175,27 +126,22 @@ m4_define([b4_case], [ case $1:
|
|||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||||
b4_percent_define_default([[stype]], [[Object]])
|
b4_percent_define_default([[stype]], [[Object]])])
|
||||||
|
|
||||||
# %name-prefix
|
m4_define_default([[b4_prefix]], [[YY]])])
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
|
||||||
|
|
||||||
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])
|
|
||||||
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
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]])])
|
||||||
|
|
||||||
b4_percent_define_default([[throws]], [])
|
b4_percent_define_default([[throws]], [b4_lex_throws])])
|
||||||
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
||||||
|
|
||||||
b4_percent_define_default([[init_throws]], [])
|
b4_percent_define_default([[location_type]], [Location])])
|
||||||
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[location_type]], [Location])
|
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[position_type]], [Position])
|
b4_percent_define_default([[position_type]], [Position])])
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
||||||
|
|
||||||
|
|
||||||
@@ -242,24 +188,24 @@ m4_define([b4_rhs_location],
|
|||||||
# it to be single quoted. Same for b4_parse_param.
|
# it to be single quoted. Same for b4_parse_param.
|
||||||
|
|
||||||
# TODO: should be in bison.m4
|
# TODO: should be in bison.m4
|
||||||
m4_define_default([b4_lex_param], [[]])
|
m4_define_default([b4_lex_param], [[]]))
|
||||||
m4_define([b4_lex_param], b4_lex_param)
|
m4_define([b4_lex_param], b4_lex_param))
|
||||||
m4_define([b4_parse_param], b4_parse_param)
|
m4_define([b4_parse_param], b4_parse_param))
|
||||||
|
|
||||||
# b4_lex_param_decl
|
# b4_lex_param_decl
|
||||||
# -----------------
|
# -------------------
|
||||||
# Extra formal arguments of the constructor.
|
# Extra formal arguments of the constructor.
|
||||||
m4_define([b4_lex_param_decl],
|
m4_define([b4_lex_param_decl],
|
||||||
[m4_ifset([b4_lex_param],
|
[m4_ifset([b4_lex_param],
|
||||||
[b4_remove_comma([$1],
|
[b4_remove_comma([$1],
|
||||||
b4_param_decls(b4_lex_param))],
|
b4_param_decls(b4_lex_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
m4_define([b4_param_decls],
|
||||||
[m4_map([b4_param_decl], [$@])])
|
[m4_map([b4_param_decl], [$@])])
|
||||||
m4_define([b4_param_decl], [, $1])
|
m4_define([b4_param_decl], [, $1])
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
m4_define([b4_remove_comma], [m4_ifval($1, [$1, ], [])m4_shiftn(2, $@)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -269,21 +215,21 @@ m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
|||||||
m4_define([b4_parse_param_decl],
|
m4_define([b4_parse_param_decl],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[b4_remove_comma([$1],
|
[b4_remove_comma([$1],
|
||||||
b4_param_decls(b4_parse_param))],
|
b4_param_decls(b4_parse_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param_call
|
# b4_lex_param_call
|
||||||
# -----------------
|
# -------------------
|
||||||
# Delegating the lexer parameters to the lexer constructor.
|
# Delegating the lexer parameters to the lexer constructor.
|
||||||
m4_define([b4_lex_param_call],
|
m4_define([b4_lex_param_call],
|
||||||
[m4_ifset([b4_lex_param],
|
[m4_ifset([b4_lex_param],
|
||||||
[b4_remove_comma([$1],
|
[b4_remove_comma([$1],
|
||||||
b4_param_calls(b4_lex_param))],
|
b4_param_calls(b4_lex_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
m4_define([b4_param_calls],
|
m4_define([b4_param_calls],
|
||||||
[m4_map([b4_param_call], [$@])])
|
[m4_map([b4_param_call], [$@])])
|
||||||
m4_define([b4_param_call], [, $2])
|
m4_define([b4_param_call], [, $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -293,13 +239,13 @@ m4_define([b4_param_call], [, $2])
|
|||||||
# Extra initialisations of the constructor.
|
# Extra initialisations of the constructor.
|
||||||
m4_define([b4_parse_param_cons],
|
m4_define([b4_parse_param_cons],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[b4_constructor_calls(b4_parse_param)])])
|
[b4_constructor_calls(b4_parse_param)])])
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
m4_define([b4_constructor_calls],
|
||||||
[m4_map([b4_constructor_call], [$@])])
|
[m4_map([b4_constructor_call], [$@])])
|
||||||
m4_define([b4_constructor_call],
|
m4_define([b4_constructor_call],
|
||||||
[this.$2 = $2;
|
[this.$2 = $2;
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -308,15 +254,15 @@ m4_define([b4_constructor_call],
|
|||||||
# Extra instance variables.
|
# Extra instance variables.
|
||||||
m4_define([b4_parse_param_vars],
|
m4_define([b4_parse_param_vars],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[
|
[
|
||||||
/* User arguments. */
|
/* User arguments. */
|
||||||
b4_var_decls(b4_parse_param)])])
|
b4_var_decls(b4_parse_param)])])
|
||||||
|
|
||||||
m4_define([b4_var_decls],
|
m4_define([b4_var_decls],
|
||||||
[m4_map_sep([b4_var_decl], [
|
[m4_map_sep([b4_var_decl], [
|
||||||
], [$@])])
|
], [$@])])
|
||||||
m4_define([b4_var_decl],
|
m4_define([b4_var_decl],
|
||||||
[ protected final $1;])
|
[ protected final $1;])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -324,4 +270,4 @@ m4_define([b4_var_decl],
|
|||||||
# -----------------------
|
# -----------------------
|
||||||
# Expand to either an empty string or "throws THROWS".
|
# Expand to either an empty string or "throws THROWS".
|
||||||
m4_define([b4_maybe_throws],
|
m4_define([b4_maybe_throws],
|
||||||
[m4_ifval($1, [throws $1])])
|
[m4_ifval($1, [throws $1])])
|
||||||
|
|||||||
+642
-572
File diff suppressed because it is too large
Load Diff
+261
-240
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2007 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,60 +17,31 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[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])])
|
m4_ifval(m4_defn([b4_symbol_destructors]),
|
||||||
|
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
|
||||||
# We don't depend on %debug in Java, but pacify warnings about non-used flags.
|
[])
|
||||||
b4_parse_trace_if([0], [0])
|
|
||||||
|
|
||||||
m4_define([b4_symbol_no_destructor_assert],
|
|
||||||
[b4_symbol_if([$1], [has_destructor],
|
|
||||||
[b4_fatal([%s: %s: %%destructor does not make sense in Java],
|
|
||||||
[b4_skeleton],
|
|
||||||
[b4_symbol_action_location([$1], [destructor])])])])
|
|
||||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(b4_parser_file_name@)
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007, 2008, 2009])
|
[2007])
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
])[/* First part of user declarations. */
|
])[/* First part of user declarations. */
|
||||||
]b4_user_pre_prologue
|
]b4_pre_prologue
|
||||||
b4_user_post_prologue
|
|
||||||
b4_percent_code_get([[imports]])
|
b4_percent_code_get([[imports]])
|
||||||
[/**
|
[/**
|
||||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
* A Bison parser, automatically generated from <tt>@ofile@</tt>.
|
||||||
*
|
*
|
||||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||||
*/
|
*/
|
||||||
]b4_percent_define_get3([annotations], [], [ ])dnl
|
]b4_public_if([public ])b4_abstract_if([abstract ])[class ]b4_parser_class_name[
|
||||||
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([[
|
|
||||||
/** True if verbose error messages are enabled. */
|
/** True if verbose error messages are enabled. */
|
||||||
private boolean yyErrorVerbose = true;
|
public boolean errorVerbose = ]b4_flag_value([error_verbose]);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether verbose error messages are enabled.
|
|
||||||
*/
|
|
||||||
public final boolean getErrorVerbose() { return yyErrorVerbose; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the verbosity of error messages.
|
|
||||||
* @@param verbose True to request verbose error messages.
|
|
||||||
*/
|
|
||||||
public final void setErrorVerbose(boolean verbose)
|
|
||||||
{ yyErrorVerbose = verbose; }
|
|
||||||
]])
|
|
||||||
|
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
/**
|
/**
|
||||||
@@ -86,7 +57,7 @@ b4_locations_if([[
|
|||||||
public ]b4_position_type[ end;
|
public ]b4_position_type[ end;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
* Create a ]b4_location_type[ denoting an empty range located at
|
||||||
* a given point.
|
* a given point.
|
||||||
* @@param loc The position at which the range is anchored. */
|
* @@param loc The position at which the range is anchored. */
|
||||||
public ]b4_location_type[ (]b4_position_type[ loc) {
|
public ]b4_location_type[ (]b4_position_type[ loc) {
|
||||||
@@ -96,7 +67,7 @@ b4_locations_if([[
|
|||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||||
* @@param begin The first position included in the range.
|
* @@param begin The first position included in the range.
|
||||||
* @@param end The first position beyond the range. */
|
* @@param begin The first position beyond the range. */
|
||||||
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
||||||
this.begin = begin;
|
this.begin = begin;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -116,6 +87,11 @@ b4_locations_if([[
|
|||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
[ /** Token returned by the scanner to signal the end of its input. */
|
||||||
|
public static final int EOF = 0;]
|
||||||
|
|
||||||
|
b4_token_enums(b4_tokens)
|
||||||
|
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
||||||
{
|
{
|
||||||
@@ -123,18 +99,13 @@ b4_locations_if([[
|
|||||||
return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
|
return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
|
||||||
else
|
else
|
||||||
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
||||||
}]])[
|
}]])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Communication interface between the scanner and the Bison-generated
|
* Communication interface between the scanner and the Bison-generated
|
||||||
* parser <tt>]b4_parser_class_name[</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. */
|
|
||||||
public static final int EOF = 0;
|
|
||||||
|
|
||||||
]b4_token_enums(b4_tokens)[
|
|
||||||
|
|
||||||
]b4_locations_if([[/**
|
]b4_locations_if([[/**
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
* @@return the position at which the last scanned token starts. */
|
* @@return the position at which the last scanned token starts. */
|
||||||
@@ -159,12 +130,13 @@ b4_locations_if([[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for error reporting. Emits an error
|
* Entry point for error reporting. Emits an error
|
||||||
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
|
* ]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
|
* ]b4_locations_if([loc], [[The location of the element to which the
|
||||||
* error message is related]])[
|
* error message is related]])[
|
||||||
* @@param msg The string for the error message. */
|
* @@param s The string for the error message. */
|
||||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
|
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
|
||||||
}
|
}
|
||||||
|
|
||||||
b4_lexer_if([[private class YYLexer implements Lexer {
|
b4_lexer_if([[private class YYLexer implements Lexer {
|
||||||
@@ -180,9 +152,7 @@ b4_lexer_if([[
|
|||||||
/**
|
/**
|
||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
*/
|
*/
|
||||||
public ]b4_parser_class_name (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_percent_code_get([[init]])[
|
|
||||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||||
]b4_parse_param_cons[
|
]b4_parse_param_cons[
|
||||||
}
|
}
|
||||||
@@ -190,11 +160,9 @@ 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 yylex The scanner that will supply tokens to the parser.
|
||||||
*/
|
*/
|
||||||
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]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_percent_code_get([[init]])[
|
|
||||||
this.yylexer = yylexer;
|
this.yylexer = yylexer;
|
||||||
]b4_parse_param_cons[
|
]b4_parse_param_cons[
|
||||||
}
|
}
|
||||||
@@ -228,35 +196,20 @@ b4_lexer_if([[
|
|||||||
*/
|
*/
|
||||||
public final void setDebugLevel(int level) { yydebug = level; }
|
public final void setDebugLevel(int level) { yydebug = level; }
|
||||||
|
|
||||||
/**
|
private final int yylex () ]b4_maybe_throws([b4_lex_throws]) [{
|
||||||
* Print an error message via the lexer.
|
return yylexer.yylex ();
|
||||||
*]b4_locations_if([[ Use a <code>null</code> location.]])[
|
|
||||||
* @@param msg The error message.
|
|
||||||
*/
|
|
||||||
public final void yyerror (String msg)
|
|
||||||
{
|
|
||||||
yylexer.yyerror (]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
|
|
||||||
}
|
}
|
||||||
]b4_locations_if([[
|
protected final void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s) {
|
||||||
/**
|
yylexer.yyerror (]b4_locations_if([loc, ])[s);
|
||||||
* Print an error message via the lexer.
|
|
||||||
* @@param loc The location associated with the message.
|
|
||||||
* @@param msg The error message.
|
|
||||||
*/
|
|
||||||
public final void yyerror (]b4_location_type[ loc, String msg)
|
|
||||||
{
|
|
||||||
yylexer.yyerror (loc, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
]b4_locations_if([
|
||||||
* Print an error message via the lexer.
|
protected final void yyerror (String s) {
|
||||||
* @@param pos The position associated with the message.
|
yylexer.yyerror ((Location)null, s);
|
||||||
* @@param msg The error message.
|
}
|
||||||
*/
|
protected final void yyerror (]b4_position_type[ loc, String s) {
|
||||||
public final void yyerror (]b4_position_type[ pos, String msg)
|
yylexer.yyerror (new ]b4_location_type[ (loc), s);
|
||||||
{
|
}])
|
||||||
yylexer.yyerror (new ]b4_location_type[ (pos), msg);
|
|
||||||
}]])
|
|
||||||
|
|
||||||
[protected final void yycdebug (String s) {
|
[protected final void yycdebug (String s) {
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
@@ -272,24 +225,24 @@ b4_lexer_if([[
|
|||||||
public int height = -1;
|
public int height = -1;
|
||||||
|
|
||||||
public final void push (int state, ]b4_yystype[ value]dnl
|
public final void push (int state, ]b4_yystype[ value]dnl
|
||||||
b4_locations_if([, ]b4_location_type[ loc])[) {
|
b4_locations_if([, ]b4_location_type[ loc])[) {
|
||||||
height++;
|
height++;
|
||||||
if (size == height)
|
if (size == height)
|
||||||
{
|
{
|
||||||
int[] newStateStack = new int[size * 2];
|
int[] newStateStack = new int[size * 2];
|
||||||
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
||||||
stateStack = newStateStack;
|
stateStack = newStateStack;
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
||||||
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
||||||
locStack = newLocStack;]])
|
locStack = newLocStack;]])
|
||||||
|
|
||||||
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
||||||
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
||||||
valueStack = newValueStack;
|
valueStack = newValueStack;
|
||||||
|
|
||||||
size *= 2;
|
size *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
stateStack[height] = state;
|
stateStack[height] = state;
|
||||||
]b4_locations_if([[locStack[height] = loc;]])[
|
]b4_locations_if([[locStack[height] = loc;]])[
|
||||||
@@ -303,7 +256,7 @@ b4_lexer_if([[
|
|||||||
public final void pop (int num) {
|
public final void pop (int num) {
|
||||||
// Avoid memory leaks... garbage collection is a white lie!
|
// Avoid memory leaks... garbage collection is a white lie!
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
java.util.Arrays.fill (valueStack, height - num + 1, height, null);
|
java.util.Arrays.fill (valueStack, height - num + 1, height, null);
|
||||||
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
|
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
|
||||||
}
|
}
|
||||||
height -= num;
|
height -= num;
|
||||||
@@ -328,8 +281,8 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
for (int i = 0; i < height; i++)
|
for (int i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
out.print (' ');
|
out.print (' ');
|
||||||
out.print (stateStack[i]);
|
out.print (stateStack[i]);
|
||||||
}
|
}
|
||||||
out.println ();
|
out.println ();
|
||||||
}
|
}
|
||||||
@@ -372,7 +325,7 @@ b4_lexer_if([[
|
|||||||
return yyerrstatus_ == 0;
|
return yyerrstatus_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
private int yyaction (int yyn, YYStack yystack, int yylen)
|
||||||
{
|
{
|
||||||
]b4_yystype[ yyval;
|
]b4_yystype[ yyval;
|
||||||
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
||||||
@@ -392,8 +345,8 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
||||||
@@ -405,7 +358,7 @@ b4_lexer_if([[
|
|||||||
yyn = yyr1_[yyn];
|
yyn = yyr1_[yyn];
|
||||||
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
||||||
if (0 <= yystate && yystate <= yylast_
|
if (0 <= yystate && yystate <= yylast_
|
||||||
&& yycheck_[yystate] == yystack.stateAt (0))
|
&& yycheck_[yystate] == yystack.stateAt (0))
|
||||||
yystate = yytable_[yystate];
|
yystate = yytable_[yystate];
|
||||||
else
|
else
|
||||||
yystate = yydefgoto_[yyn - yyntokens_];
|
yystate = yydefgoto_[yyn - yyntokens_];
|
||||||
@@ -414,7 +367,6 @@ b4_lexer_if([[
|
|||||||
return YYNEWSTATE;
|
return YYNEWSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_error_verbose_if([[
|
|
||||||
/* Return YYSTR after stripping away unnecessary quotes and
|
/* Return YYSTR after stripping away unnecessary quotes and
|
||||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||||
that double-quoting is unnecessary unless the string contains an
|
that double-quoting is unnecessary unless the string contains an
|
||||||
@@ -433,7 +385,7 @@ b4_lexer_if([[
|
|||||||
break strip_quotes;
|
break strip_quotes;
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
if (yystr.charAt(++i) != '\\')
|
if (yystr.charAt(++i) != '\\')
|
||||||
break strip_quotes;
|
break strip_quotes;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
default:
|
default:
|
||||||
@@ -449,21 +401,20 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
return yystr;
|
return yystr;
|
||||||
}
|
}
|
||||||
]])[
|
|
||||||
|
|
||||||
/*--------------------------------.
|
/*--------------------------------.
|
||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private void yy_symbol_print (String s, int yytype,
|
private void yy_symbol_print (String s, int yytype,
|
||||||
]b4_yystype[ yyvaluep]dnl
|
]b4_yystype[ yyvaluep]dnl
|
||||||
b4_locations_if([, Object yylocationp])[)
|
b4_locations_if([, Object yylocationp])[)
|
||||||
{
|
{
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
||||||
+ yytname_[yytype] + " ("]b4_locations_if([
|
+ yytname_[yytype] + " ("]b4_locations_if([
|
||||||
+ yylocationp + ": "])[
|
+ yylocationp + ": "])[
|
||||||
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
+ (yyvaluep == null ? "(null)" : yyvaluep) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -473,7 +424,7 @@ b4_lexer_if([[
|
|||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
* imply that there were no syntax errors.
|
* imply that there were no syntax errors.
|
||||||
*/
|
*/
|
||||||
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
public boolean parse () ]b4_maybe_throws([b4_throws])[
|
||||||
{
|
{
|
||||||
/// Lookahead and lookahead in internal form.
|
/// Lookahead and lookahead in internal form.
|
||||||
int yychar = yyempty_;
|
int yychar = yyempty_;
|
||||||
@@ -521,7 +472,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
switch (label)
|
switch (label)
|
||||||
{
|
{
|
||||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||||
pushed when we come here. */
|
pushed when we come here. */
|
||||||
case YYNEWSTATE:
|
case YYNEWSTATE:
|
||||||
yycdebug ("Entering state " + yystate + "\n");
|
yycdebug ("Entering state " + yystate + "\n");
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
@@ -533,34 +484,34 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
/* Take a decision. First try without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (yy_pact_value_is_default_ (yyn))
|
if (yyn == yypact_ninf_)
|
||||||
{
|
{
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
{
|
{
|
||||||
yycdebug ("Reading a token: ");
|
yycdebug ("Reading a token: ");
|
||||||
yychar = yylexer.yylex ();]
|
yychar = yylex ();]
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||||
yylexer.getEndPos ());]])
|
yylexer.getEndPos ());]])
|
||||||
yylval = yylexer.getLVal ();[
|
yylval = yylexer.getLVal ();[
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
if (yychar <= Lexer.EOF)
|
if (yychar <= EOF)
|
||||||
{
|
{
|
||||||
yychar = yytoken = Lexer.EOF;
|
yychar = yytoken = EOF;
|
||||||
yycdebug ("Now at end of input.\n");
|
yycdebug ("Now at end of input.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yytoken = yytranslate_ (yychar);
|
yytoken = yytranslate_ (yychar);
|
||||||
yy_symbol_print ("Next token is", yytoken,
|
yy_symbol_print ("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
@@ -572,20 +523,20 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* <= 0 means reduce or error. */
|
/* <= 0 means reduce or error. */
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
{
|
{
|
||||||
if (yy_table_value_is_error_ (yyn))
|
if (yyn == 0 || yyn == yytable_ninf_)
|
||||||
label = YYFAIL;
|
label = YYFAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
label = YYREDUCE;
|
label = YYREDUCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shift the lookahead token. */
|
/* Shift the lookahead token. */
|
||||||
yy_symbol_print ("Shifting", yytoken,
|
yy_symbol_print ("Shifting", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
/* Discard the token being shifted. */
|
/* Discard the token being shifted. */
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
@@ -618,7 +569,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
case YYREDUCE:
|
case YYREDUCE:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
label = yyaction (yyn, yystack, yylen);
|
label = yyaction (yyn, yystack, yylen);
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*------------------------------------.
|
/*------------------------------------.
|
||||||
@@ -628,24 +579,24 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* If not already recovering from an error, report this error. */
|
/* If not already recovering from an error, report this error. */
|
||||||
if (yyerrstatus_ == 0)
|
if (yyerrstatus_ == 0)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yylloc;])[
|
]b4_locations_if([yyerrloc = yylloc;])[
|
||||||
if (yyerrstatus_ == 3)
|
if (yyerrstatus_ == 3)
|
||||||
{
|
{
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
if (yychar <= Lexer.EOF)
|
if (yychar <= EOF)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == Lexer.EOF)
|
if (yychar == EOF)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
@@ -671,46 +622,46 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
case YYERRLAB1:
|
case YYERRLAB1:
|
||||||
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (yyn != yypact_ninf_)
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
if (yystack.height == 1)
|
if (yystack.height == 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
/* Muck with the stack to setup for yylloc. */
|
/* Muck with the stack to setup for yylloc. */
|
||||||
yystack.push (0, null, yylloc);
|
yystack.push (0, null, yylloc);
|
||||||
yystack.push (0, null, yyerrloc);
|
yystack.push (0, null, yyerrloc);
|
||||||
yyloc = yylloc (yystack, 2);
|
yyloc = yylloc (yystack, 2);
|
||||||
yystack.pop (2);])[
|
yystack.pop (2);])[
|
||||||
|
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||||
yylval]b4_locations_if([, yyloc])[);
|
yylval]b4_locations_if([, yyloc])[);
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -726,82 +677,149 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private String yysyntax_error (int yystate, int tok)
|
private String yysyntax_error (int yystate, int tok)
|
||||||
{]b4_error_verbose_if([[
|
{
|
||||||
if (yyErrorVerbose)
|
if (errorVerbose)
|
||||||
{
|
{
|
||||||
int yyn = yypact_[yystate];
|
int yyn = yypact_[yystate];
|
||||||
if (yypact_ninf_ < yyn && yyn <= yylast_)
|
if (yypact_ninf_ < yyn && yyn <= yylast_)
|
||||||
{
|
{
|
||||||
StringBuffer res;
|
StringBuffer res;
|
||||||
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. In other words, skip the first -YYN actions for this
|
YYCHECK. */
|
||||||
state because they are default actions. */
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
||||||
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
++count;
|
||||||
++count;
|
|
||||||
|
|
||||||
// FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
// with internationalization.
|
// with internationalization.
|
||||||
res = new StringBuffer ("syntax error, unexpected ");
|
res = new StringBuffer ("syntax error, unexpected ");
|
||||||
res.append (yytnamerr_ (yytname_[tok]));
|
res.append (yytnamerr_ (yytname_[tok]));
|
||||||
if (count < 5)
|
if (count < 5)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
{
|
||||||
{
|
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||||
res.append (count++ == 0 ? ", expecting " : " or ");
|
res.append (yytnamerr_ (yytname_[x]));
|
||||||
res.append (yytnamerr_ (yytname_[x]));
|
}
|
||||||
}
|
}
|
||||||
}
|
return res.toString ();
|
||||||
return res.toString ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]])[
|
|
||||||
return "syntax error";
|
return "syntax error";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
|
||||||
private static boolean yy_pact_value_is_default_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yypact_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
|
||||||
private static boolean 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 final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
||||||
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
private static final ]b4_int_type_for([b4_pact])[ yypact_[] =
|
||||||
|
{
|
||||||
|
]b4_pact[
|
||||||
|
};
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
doesn't specify something else to do. Zero means the default is an
|
||||||
[TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
error. */
|
||||||
to YYLEX-NUM.])[
|
private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
|
||||||
|
{
|
||||||
|
]b4_defact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
|
private static final ]b4_int_type_for([b4_pgoto])[ yypgoto_[] =
|
||||||
|
{
|
||||||
|
]b4_pgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFGOTO[NTERM-NUM]. */
|
||||||
|
private static final ]b4_int_type_for([b4_defgoto])[
|
||||||
|
yydefgoto_[] =
|
||||||
|
{
|
||||||
|
]b4_defgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If zero, do what YYDEFACT says. */
|
||||||
|
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||||
|
private static final ]b4_int_type_for([b4_table])[
|
||||||
|
yytable_[] =
|
||||||
|
{
|
||||||
|
]b4_table[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYCHECK. */
|
||||||
|
private static final ]b4_int_type_for([b4_check])[
|
||||||
|
yycheck_[] =
|
||||||
|
{
|
||||||
|
]b4_check[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* STOS_[STATE-NUM] -- The (internal number of the) accessing
|
||||||
|
symbol of state STATE-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_stos])[
|
||||||
|
yystos_[] =
|
||||||
|
{
|
||||||
|
]b4_stos[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||||
|
to YYLEX-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_toknum])[
|
||||||
|
yytoken_number_[] =
|
||||||
|
{
|
||||||
|
]b4_toknum[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
|
private static final ]b4_int_type_for([b4_r1])[
|
||||||
|
yyr1_[] =
|
||||||
|
{
|
||||||
|
]b4_r1[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
private static final ]b4_int_type_for([b4_r2])[
|
||||||
|
yyr2_[] =
|
||||||
|
{
|
||||||
|
]b4_r2[
|
||||||
|
};
|
||||||
|
|
||||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
/* 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. */
|
||||||
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
private static final String yytname_[] =
|
||||||
|
{
|
||||||
|
]b4_tname[
|
||||||
|
};
|
||||||
|
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
|
private static final ]b4_int_type_for([b4_rhs])[ yyrhs_[] =
|
||||||
|
{
|
||||||
|
]b4_rhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
|
YYRHS. */
|
||||||
|
private static final ]b4_int_type_for([b4_prhs])[ yyprhs_[] =
|
||||||
|
{
|
||||||
|
]b4_prhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||||
|
private static final ]b4_int_type_for([b4_rline])[ yyrline_[] =
|
||||||
|
{
|
||||||
|
]b4_rline[
|
||||||
|
};
|
||||||
|
|
||||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||||
private void yy_reduce_print (int yyrule, YYStack yystack)
|
private void yy_reduce_print (int yyrule, YYStack yystack)
|
||||||
@@ -813,18 +831,21 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
/* Print the symbols being reduced, and their result. */
|
/* Print the symbols being reduced, and their result. */
|
||||||
yycdebug ("Reducing stack by rule " + (yyrule - 1)
|
yycdebug ("Reducing stack by rule " + (yyrule - 1)
|
||||||
+ " (line " + yylno + "), ");
|
+ " (line " + yylno + "), ");
|
||||||
|
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yy_symbol_print (" $" + (yyi + 1) + " =",
|
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||||
yystos_[yystack.stateAt(yyi + 1 - yynrhs)],
|
yyrhs_[yyprhs_[yyrule] + yyi],
|
||||||
]b4_rhs_value(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(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_table_[] =
|
||||||
|
{
|
||||||
|
]b4_translate[
|
||||||
|
};
|
||||||
|
|
||||||
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
@@ -850,5 +871,5 @@ b4_percent_code_get[]dnl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b4_epilogue[]dnl
|
b4_epilogue
|
||||||
m4_divert_pop(0)dnl
|
m4_divert_pop(0)dnl
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
## Copyright (C) 2002, 2005, 2006, 2007, 2008-2009 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/>.
|
|
||||||
|
|
||||||
dist_pkgdata_DATA = \
|
|
||||||
data/README \
|
|
||||||
data/bison.m4 \
|
|
||||||
data/c++-skel.m4 \
|
|
||||||
data/c++.m4 \
|
|
||||||
data/c-skel.m4 \
|
|
||||||
data/c.m4 \
|
|
||||||
data/glr.c \
|
|
||||||
data/glr.cc \
|
|
||||||
data/java-skel.m4 \
|
|
||||||
data/java.m4 \
|
|
||||||
data/lalr1.cc \
|
|
||||||
data/lalr1.java \
|
|
||||||
data/location.cc \
|
|
||||||
data/stack.hh \
|
|
||||||
data/variant.hh \
|
|
||||||
data/yacc.c
|
|
||||||
|
|
||||||
m4sugardir = $(pkgdatadir)/m4sugar
|
|
||||||
dist_m4sugar_DATA = \
|
|
||||||
data/m4sugar/foreach.m4 \
|
|
||||||
data/m4sugar/m4sugar.m4
|
|
||||||
|
|
||||||
xsltdir = $(pkgdatadir)/xslt
|
|
||||||
dist_xslt_DATA = \
|
|
||||||
data/xslt/bison.xsl \
|
|
||||||
data/xslt/xml2dot.xsl \
|
|
||||||
data/xslt/xml2text.xsl \
|
|
||||||
data/xslt/xml2xhtml.xsl
|
|
||||||
+24
-47
@@ -1,7 +1,7 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -16,14 +16,12 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
|
||||||
[2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009])
|
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_dir_prefix[]position.hh@)@
|
@output(b4_dir_prefix[]position.hh@)
|
||||||
b4_copyright([Positions for Bison parsers in C++])[
|
b4_copyright([Positions for Bison parsers in C++],
|
||||||
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file position.hh
|
** \file position.hh
|
||||||
@@ -42,33 +40,29 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]m4_ifdef([b4_location_constructors], [[
|
]m4_ifdef([b4_location_constructors], [
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = 0,
|
position ()
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
: filename (0), line (]b4_location_initial_line[), column (]b4_location_initial_column[)
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
|
||||||
: filename (f)
|
|
||||||
, line (l)
|
|
||||||
, column (c)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
]])[
|
])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
inline void initialize (]b4_percent_define_get([[filename_type]])[* fn)
|
inline void initialize (]b4_percent_define_get([[filename_type]])[* fn)
|
||||||
{
|
{
|
||||||
filename = fn;
|
filename = fn;
|
||||||
line = ]b4_location_initial_line[u;
|
line = ]b4_location_initial_line[;
|
||||||
column = ]b4_location_initial_column[u;
|
column = ]b4_location_initial_column[;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \name Line and Column related manipulators
|
/** \name Line and Column related manipulators
|
||||||
** \{ */
|
** \{ */
|
||||||
|
public:
|
||||||
/// (line related) Advance to the COUNT next lines.
|
/// (line related) Advance to the COUNT next lines.
|
||||||
/// Set current column to initial value.
|
|
||||||
inline void lines (int count = 1)
|
inline void lines (int count = 1)
|
||||||
{
|
{
|
||||||
column = ]b4_location_initial_column[u;
|
column = ]b4_location_initial_column[;
|
||||||
line += count;
|
line += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +73,7 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
}
|
}
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
|
public:
|
||||||
/// File name to which this position refers.
|
/// File name to which this position refers.
|
||||||
]b4_percent_define_get([[filename_type]])[* filename;
|
]b4_percent_define_get([[filename_type]])[* filename;
|
||||||
/// Current line number.
|
/// Current line number.
|
||||||
@@ -121,11 +116,10 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
inline bool
|
inline bool
|
||||||
operator== (const position& pos1, const position& pos2)
|
operator== (const position& pos1, const position& pos2)
|
||||||
{
|
{
|
||||||
return (pos1.line == pos2.line
|
return
|
||||||
&& pos1.column == pos2.column
|
(pos1.filename == pos2.filename
|
||||||
&& (pos1.filename == pos2.filename
|
|| pos1.filename && pos2.filename && *pos1.filename == *pos2.filename)
|
||||||
|| (pos1.filename && pos2.filename
|
&& pos1.line == pos2.line && pos1.column == pos2.column;
|
||||||
&& *pos1.filename == *pos2.filename)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compare two position objects.
|
/// Compare two position objects.
|
||||||
@@ -149,8 +143,9 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
#endif // not BISON_POSITION_HH]
|
#endif // not BISON_POSITION_HH]
|
||||||
@output(b4_dir_prefix[]location.hh@)@
|
@output(b4_dir_prefix[]location.hh@)
|
||||||
b4_copyright([Locations for Bison parsers in C++])[
|
b4_copyright([Locations for Bison parsers in C++],
|
||||||
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file location.hh
|
** \file location.hh
|
||||||
@@ -171,26 +166,9 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]m4_ifdef([b4_location_constructors], [
|
]m4_ifdef([b4_location_constructors], [
|
||||||
/// Construct a location from \a b to \a e.
|
/// Construct a location.
|
||||||
location (const position& b, const position& e)
|
location ()
|
||||||
: begin (b)
|
: begin (), end ()
|
||||||
, end (e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Construct a 0-width location in \a p.
|
|
||||||
explicit location (const position& p = position ())
|
|
||||||
: begin (p)
|
|
||||||
, end (p)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
|
||||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
|
||||||
: begin (f, l, c)
|
|
||||||
, end (f, l, c)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,5 +272,4 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
|
|
||||||
#endif // not BISON_LOCATION_HH]
|
#endif // not BISON_LOCATION_HH]
|
||||||
m4_divert_pop(0)
|
m4_divert_pop(0)
|
||||||
m4_popdef([b4_copyright_years])dnl
|
|
||||||
m4_changecom([#])
|
m4_changecom([#])
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../submodules/autoconf/lib/m4sugar/foreach.m4
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../submodules/autoconf/lib/m4sugar/m4sugar.m4
|
|
||||||
File diff suppressed because it is too large
Load Diff
-135
@@ -1,135 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008-2009 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_pushdef([b4_copyright_years],
|
|
||||||
[2002, 2003, 2004, 2005, 2006, 2007, 2008-2009])
|
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
|
||||||
m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_dir_prefix[]stack.hh@)@
|
|
||||||
b4_copyright([Stack handling for Bison parsers in C++])[
|
|
||||||
|
|
||||||
#ifndef BISON_STACK_HH
|
|
||||||
# define BISON_STACK_HH
|
|
||||||
|
|
||||||
#include <deque>
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
template <class T, class S = std::deque<T> >
|
|
||||||
class stack
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Hide our reversed order.
|
|
||||||
typedef typename S::reverse_iterator iterator;
|
|
||||||
typedef typename S::const_reverse_iterator const_iterator;
|
|
||||||
|
|
||||||
stack ()
|
|
||||||
: seq_ ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
stack (unsigned int n)
|
|
||||||
: seq_ (n)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
T&
|
|
||||||
operator [] (unsigned int i)
|
|
||||||
{
|
|
||||||
return seq_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const T&
|
|
||||||
operator [] (unsigned int i) const
|
|
||||||
{
|
|
||||||
return seq_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
push (const T& t)
|
|
||||||
{
|
|
||||||
seq_.push_front (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
pop (unsigned int n = 1)
|
|
||||||
{
|
|
||||||
for (; n; --n)
|
|
||||||
seq_.pop_front ();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
typename S::size_type
|
|
||||||
size () const
|
|
||||||
{
|
|
||||||
return seq_.size ();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const_iterator
|
|
||||||
begin () const
|
|
||||||
{
|
|
||||||
return seq_.rbegin ();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const_iterator
|
|
||||||
end () const
|
|
||||||
{
|
|
||||||
return seq_.rend ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
/// The wrapped container.
|
|
||||||
S seq_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Present a slice of the top of a stack.
|
|
||||||
template <class T, class S = stack<T> >
|
|
||||||
class slice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
slice (const S& stack, unsigned int range)
|
|
||||||
: stack_ (stack),
|
|
||||||
range_ (range)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const T&
|
|
||||||
operator [] (unsigned int i) const
|
|
||||||
{
|
|
||||||
return stack_[range_ - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const S& stack_;
|
|
||||||
unsigned int range_;
|
|
||||||
};
|
|
||||||
]b4_namespace_close[
|
|
||||||
|
|
||||||
#endif // not BISON_STACK_HH[]dnl
|
|
||||||
]
|
|
||||||
m4_divert_pop(0)
|
|
||||||
m4_popdef([b4_copyright_years])dnl
|
|
||||||
m4_changecom([#])
|
|
||||||
-278
@@ -1,278 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008-2009 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/>.
|
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
|
||||||
## variant. ##
|
|
||||||
## --------- ##
|
|
||||||
|
|
||||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
|
||||||
# ------------------------------------------------
|
|
||||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
|
||||||
# YYTYPE.
|
|
||||||
m4_define([b4_symbol_variant],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[$2.$3< $][3 >(m4_shift3($@))])dnl
|
|
||||||
switch ($1)
|
|
||||||
{
|
|
||||||
b4_type_foreach([b4_type_action_])[]dnl
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_char_sizeof_counter
|
|
||||||
# -----------------------
|
|
||||||
# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
|
|
||||||
m4_define([_b4_char_sizeof_counter],
|
|
||||||
[0])
|
|
||||||
|
|
||||||
# _b4_char_sizeof_dummy
|
|
||||||
# ---------------------
|
|
||||||
# At each call return a new C++ identifier.
|
|
||||||
m4_define([_b4_char_sizeof_dummy],
|
|
||||||
[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
|
|
||||||
dummy[]_b4_char_sizeof_counter])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_char_sizeof_(SYMBOL-NUM)
|
|
||||||
# ---------------------------
|
|
||||||
# A comment describing this symbol.
|
|
||||||
m4_define([b4_char_sizeof_],
|
|
||||||
[ // b4_symbol([$1], [tag])
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_char_sizeof(SYMBOL-NUMS)
|
|
||||||
# ---------------------------
|
|
||||||
# To be mapped on the list of type names to produce:
|
|
||||||
#
|
|
||||||
# char dummy1[sizeof(type_name_1)];
|
|
||||||
# char dummy2[sizeof(type_name_2)];
|
|
||||||
#
|
|
||||||
# for defined type names.
|
|
||||||
m4_define([b4_char_sizeof],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[
|
|
||||||
m4_map([b4_char_sizeof_], [$@])dnl
|
|
||||||
char _b4_char_sizeof_dummy@{sizeof([b4_symbol([$1], [type])])@};
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_define
|
|
||||||
# -----------------
|
|
||||||
# Define "variant".
|
|
||||||
m4_define([b4_variant_define],
|
|
||||||
[[
|
|
||||||
/// A char[S] buffer to store and retrieve objects.
|
|
||||||
///
|
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
|
||||||
/// of the stored data, since that knowledge is available
|
|
||||||
/// via the current state.
|
|
||||||
template <size_t S>
|
|
||||||
struct variant
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
/// Whether something is contained.
|
|
||||||
bool built;
|
|
||||||
])[
|
|
||||||
/// Empty construction.
|
|
||||||
inline
|
|
||||||
variant ()]b4_parse_assert_if([
|
|
||||||
: built (false)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// Instantiate a \a T in here.
|
|
||||||
template <typename T>
|
|
||||||
inline T&
|
|
||||||
build ()
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert (!built);
|
|
||||||
built = true;])[
|
|
||||||
return *new (buffer.raw) T;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
|
||||||
template <typename T>
|
|
||||||
inline T&
|
|
||||||
build (const T& t)
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert(!built);
|
|
||||||
built = true;])[
|
|
||||||
return *new (buffer.raw) T(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Construct and fill.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
variant (const T& t)]b4_parse_assert_if([
|
|
||||||
: built (true)])[
|
|
||||||
{
|
|
||||||
new (buffer.raw) T(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Accessor to a built \a T.
|
|
||||||
template <typename T>
|
|
||||||
inline T&
|
|
||||||
as ()
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert (built);])[
|
|
||||||
return reinterpret_cast<T&>(buffer.raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
|
||||||
template <typename T>
|
|
||||||
inline const T&
|
|
||||||
as () const
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert(built);])[
|
|
||||||
return reinterpret_cast<const T&>(buffer.raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Swap the content with \a other.
|
|
||||||
template <typename T>
|
|
||||||
inline void
|
|
||||||
swap (variant<S>& other)
|
|
||||||
{
|
|
||||||
std::swap (as<T>(), other.as<T>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Assign the content of \a other to this.
|
|
||||||
/// Destroys \a other.
|
|
||||||
template <typename T>
|
|
||||||
inline void
|
|
||||||
build (variant<S>& other)
|
|
||||||
{
|
|
||||||
build<T>();
|
|
||||||
swap<T>(other);
|
|
||||||
other.destroy<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destroy the stored \a T.
|
|
||||||
template <typename T>
|
|
||||||
inline void
|
|
||||||
destroy ()
|
|
||||||
{
|
|
||||||
as<T>().~T();]b4_parse_assert_if([
|
|
||||||
built = false;])[
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A buffer large enough to store any of the semantic values.
|
|
||||||
/// Long double is chosen as it has the strongest alignment
|
|
||||||
/// constraints.
|
|
||||||
union
|
|
||||||
{
|
|
||||||
long double align_me;
|
|
||||||
char raw[S];
|
|
||||||
} buffer;
|
|
||||||
};
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
## -------------------------- ##
|
|
||||||
## Adjustments for variants. ##
|
|
||||||
## -------------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_semantic_type_declare
|
|
||||||
# ------------------------
|
|
||||||
# Declare semantic_type.
|
|
||||||
m4_define([b4_semantic_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;])
|
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [TYPE])
|
|
||||||
# ----------------------------
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[$1.as< $2 >()],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
|
||||||
# -------------------------------------
|
|
||||||
# Same as b4_symbol_value, but used in a template method.
|
|
||||||
m4_define([b4_symbol_value_template],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[$1.template as< $2 >()],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------- ##
|
|
||||||
## make_SYMBOL. ##
|
|
||||||
## ------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare_(SYMBOL-NUMBER)
|
|
||||||
# ---------------------------------------------
|
|
||||||
# Declare the overloaded version of make_symbol for the (common) type of
|
|
||||||
# these SYMBOL-NUMBERS. Use at class-level.
|
|
||||||
m4_define([b4_symbol_constructor_declare_],
|
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
|
||||||
[ static // inline
|
|
||||||
symbol_type
|
|
||||||
make_[]b4_symbol_([$1], [id]) (dnl
|
|
||||||
b4_args(b4_symbol_if([$1], [has_type],
|
|
||||||
[const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l])));
|
|
||||||
|
|
||||||
])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare
|
|
||||||
# -----------------------------
|
|
||||||
# Declare symbol constructors for all the value types.
|
|
||||||
# Use at class-level.
|
|
||||||
m4_define([b4_symbol_constructor_declare],
|
|
||||||
[ // Symbol constructors declarations.
|
|
||||||
b4_symbol_foreach([b4_symbol_constructor_declare_])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_define_(SYMBOL-NUMBER)
|
|
||||||
# --------------------------------------------
|
|
||||||
# Define symbol constructor for this SYMBOL-NUMBER.
|
|
||||||
m4_define([b4_symbol_constructor_define_],
|
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
|
||||||
[ b4_parser_class_name::symbol_type
|
|
||||||
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
|
||||||
b4_args(b4_symbol_if([$1], [has_type],
|
|
||||||
[const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l])))
|
|
||||||
{
|
|
||||||
return symbol_type (b4_args([yytranslate_ (token::b4_symbol([$1], [id]))],
|
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
|
||||||
b4_locations_if([l])));
|
|
||||||
}
|
|
||||||
|
|
||||||
])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_define
|
|
||||||
# ----------------------------
|
|
||||||
# Define the overloaded versions of make_symbol for all the value types.
|
|
||||||
m4_define([b4_symbol_constructor_define],
|
|
||||||
[ // Implementation of make_symbol for each symbol type.
|
|
||||||
b4_symbol_foreach([b4_symbol_constructor_define_])])
|
|
||||||
+2
-1
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007, 2008-2009 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007, 2008-2009 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -48,15 +49,15 @@
|
|||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
a:link {
|
a:link {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:visited {
|
a:visited {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
#menu a {
|
#menu a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
|
|||||||
+160
-92
@@ -1,12 +1,9 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
|
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||||
# 2007, 2008, 2009 Free Software Foundation, Inc.
|
# 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
|
||||||
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
||||||
2007, 2008, 2009])
|
|
||||||
|
|
||||||
# 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,13 +18,13 @@ m4_pushdef([b4_copyright_years],
|
|||||||
# 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/>.
|
||||||
|
|
||||||
# Check the value of %define api.push-pull.
|
# Check the value of %define api.push_pull.
|
||||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
b4_percent_define_default([[api.push_pull]], [[pull]])
|
||||||
b4_percent_define_check_values([[[[api.push-pull]],
|
b4_percent_define_check_values([[[[api.push_pull]],
|
||||||
[[pull]], [[push]], [[both]]]])
|
[[pull]], [[push]], [[both]]]])
|
||||||
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
|
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
|
||||||
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
|
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
|
||||||
m4_case(b4_percent_define_get([[api.push-pull]]),
|
m4_case(b4_percent_define_get([[api.push_pull]]),
|
||||||
[pull], [m4_define([b4_push_flag], [[0]])],
|
[pull], [m4_define([b4_push_flag], [[0]])],
|
||||||
[push], [m4_define([b4_pull_flag], [[0]])])
|
[push], [m4_define([b4_pull_flag], [[0]])])
|
||||||
|
|
||||||
@@ -117,7 +114,7 @@ m4_define([b4_int_type],
|
|||||||
# --------------------
|
# --------------------
|
||||||
# Expansion of $<TYPE>$.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value(yyval, [$1])])
|
[(yyval[]m4_ifval([$1], [.$1]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
@@ -125,7 +122,7 @@ m4_define([b4_lhs_value],
|
|||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
[(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +142,7 @@ m4_define([b4_lhs_location],
|
|||||||
# Expansion of @NUM, 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@{($2) - ($1)@})])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -156,8 +153,9 @@ m4_define([b4_rhs_location],
|
|||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(b4_parser_file_name@)
|
||||||
b4_copyright([Implementation for Bison's Yacc-like parsers in C])[
|
b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
|
||||||
|
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
||||||
simplifying the original so-called "semantic" parser. */
|
simplifying the original so-called "semantic" parser. */
|
||||||
@@ -192,7 +190,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling verbose error messages. */
|
/* Enabling verbose error messages. */
|
||||||
@@ -200,7 +198,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
/* Enabling the token table. */
|
||||||
@@ -482,27 +480,41 @@ union yyalloc
|
|||||||
#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[
|
||||||
|
|
||||||
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
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[
|
||||||
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned int) (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, 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[
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
|
YYRHS. */
|
||||||
|
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
||||||
|
{
|
||||||
|
]b4_prhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
|
static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
|
||||||
|
{
|
||||||
|
]b4_rhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
|
static const ]b4_int_type_for([b4_rline])[ yyrline[] =
|
||||||
|
{
|
||||||
|
]b4_rline[
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
||||||
@@ -515,25 +527,75 @@ static const char *const yytname[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
# ifdef YYPRINT
|
# ifdef YYPRINT
|
||||||
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
|
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
|
||||||
(internal) symbol number NUM (which must be that of a token). */
|
token YYLEX-NUM. */
|
||||||
static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
||||||
{
|
{
|
||||||
]b4_toknum[
|
]b4_toknum[
|
||||||
};
|
};
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
|
static const ]b4_int_type_for([b4_r1])[ yyr1[] =
|
||||||
|
{
|
||||||
|
]b4_r1[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
static const ]b4_int_type_for([b4_r2])[ yyr2[] =
|
||||||
|
{
|
||||||
|
]b4_r2[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
||||||
|
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
|
||||||
|
means the default is an error. */
|
||||||
|
static const ]b4_int_type_for([b4_defact])[ yydefact[] =
|
||||||
|
{
|
||||||
|
]b4_defact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFGOTO[NTERM-NUM]. */
|
||||||
|
static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
|
||||||
|
{
|
||||||
|
]b4_defgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
|
STATE-NUM. */
|
||||||
#define YYPACT_NINF ]b4_pact_ninf[
|
#define YYPACT_NINF ]b4_pact_ninf[
|
||||||
|
static const ]b4_int_type_for([b4_pact])[ yypact[] =
|
||||||
|
{
|
||||||
|
]b4_pact[
|
||||||
|
};
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
|
||||||
|
{
|
||||||
|
]b4_pgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If zero, do what YYDEFACT says.
|
||||||
|
If YYTABLE_NINF, syntax error. */
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
|
static const ]b4_int_type_for([b4_table])[ yytable[] =
|
||||||
|
{
|
||||||
|
]b4_table[
|
||||||
|
};
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
{
|
||||||
|
]b4_check[
|
||||||
|
};
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||||
|
symbol of state STATE-NUM. */
|
||||||
|
static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
||||||
|
{
|
||||||
|
]b4_stos[
|
||||||
|
};
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus = 0)
|
#define yyerrok (yyerrstatus = 0)
|
||||||
#define yyclearin (yychar = YYEMPTY)
|
#define yyclearin (yychar = YYEMPTY)
|
||||||
@@ -682,26 +744,24 @@ do { \
|
|||||||
`------------------------------------------------*/
|
`------------------------------------------------*/
|
||||||
|
|
||||||
]b4_c_function_def([yy_reduce_print], [static void],
|
]b4_c_function_def([yy_reduce_print], [static void],
|
||||||
[[yytype_int16 *yyssp], [yyssp]],
|
[[YYSTYPE *yyvsp], [yyvsp]],
|
||||||
[[YYSTYPE *yyvsp], [yyvsp]],
|
|
||||||
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
||||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
unsigned long int yylno = yyrline[yyrule];
|
|
||||||
int yynrhs = yyr2[yyrule];
|
int yynrhs = yyr2[yyrule];
|
||||||
int yyi;
|
int yyi;
|
||||||
|
unsigned long int yylno = yyrline[yyrule];
|
||||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||||
yyrule - 1, yylno);
|
yyrule - 1, yylno);
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||||
yystos[yyssp[yyi + 1 - yynrhs]],
|
&]b4_rhs_value(yynrhs, yyi + 1)[
|
||||||
&]b4_rhs_value(yynrhs, yyi + 1)[
|
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
||||||
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
b4_user_args[);
|
||||||
b4_user_args[);
|
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -709,7 +769,7 @@ do { \
|
|||||||
# define YY_REDUCE_PRINT(Rule) \
|
# define YY_REDUCE_PRINT(Rule) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
yy_reduce_print (yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
@@ -828,14 +888,14 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Copy into YYRESULT an error message about the unexpected token
|
/* Copy into YYRESULT an error message about the unexpected token
|
||||||
YYTOKEN while in state YYSTATE. Return the number of bytes copied,
|
YYCHAR while in state YYSTATE. Return the number of bytes copied,
|
||||||
including the terminating null byte. If YYRESULT is null, do not
|
including the terminating null byte. If YYRESULT is null, do not
|
||||||
copy anything; just return the number of bytes that would be
|
copy anything; just return the number of bytes that would be
|
||||||
copied. As a special case, return 0 if an ordinary "syntax error"
|
copied. As a special case, return 0 if an ordinary "syntax error"
|
||||||
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
|
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
|
||||||
size calculation. */
|
size calculation. */
|
||||||
static YYSIZE_T
|
static YYSIZE_T
|
||||||
yysyntax_error (char *yyresult, int yystate, int yytoken)
|
yysyntax_error (char *yyresult, int yystate, int yychar)
|
||||||
{
|
{
|
||||||
int yyn = yypact[yystate];
|
int yyn = yypact[yystate];
|
||||||
|
|
||||||
@@ -843,62 +903,67 @@ yysyntax_error (char *yyresult, int yystate, int yytoken)
|
|||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
|
int yytype = YYTRANSLATE (yychar);
|
||||||
|
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
YYSIZE_T yysize1;
|
YYSIZE_T yysize1;
|
||||||
int yysize_overflow = 0;
|
int yysize_overflow = 0;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
|
||||||
const char *yyformat = 0;
|
|
||||||
/* Arguments of yyformat. */
|
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
|
int yyx;
|
||||||
|
|
||||||
|
# if 0
|
||||||
|
/* This is so xgettext sees the translatable formats that are
|
||||||
|
constructed on the fly. */
|
||||||
|
YY_("syntax error, unexpected %s");
|
||||||
|
YY_("syntax error, unexpected %s, expecting %s");
|
||||||
|
YY_("syntax error, unexpected %s, expecting %s or %s");
|
||||||
|
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
|
||||||
|
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
|
||||||
|
# endif
|
||||||
|
char *yyfmt;
|
||||||
|
char const *yyf;
|
||||||
|
static char const yyunexpected[] = "syntax error, unexpected %s";
|
||||||
|
static char const yyexpecting[] = ", expecting %s";
|
||||||
|
static char const yyor[] = " or %s";
|
||||||
|
char yyformat[sizeof yyunexpected
|
||||||
|
+ sizeof yyexpecting - 1
|
||||||
|
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
|
||||||
|
* (sizeof yyor - 1))];
|
||||||
|
char const *yyprefix = yyexpecting;
|
||||||
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. In other words, skip the first -YYN actions for this
|
YYCHECK. */
|
||||||
state because they are default actions. */
|
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
int yychecklim = YYLAST - yyn + 1;
|
int yychecklim = YYLAST - yyn + 1;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
int yycount = 1;
|
||||||
"expected"). */
|
|
||||||
int yycount = 0;
|
|
||||||
int yyx;
|
|
||||||
|
|
||||||
yyarg[yycount++] = yytname[yytoken];
|
yyarg[0] = yytname[yytype];
|
||||||
|
yyfmt = yystpcpy (yyformat, yyunexpected);
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||||||
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
yycount = 1;
|
yycount = 1;
|
||||||
yysize = yysize0;
|
yysize = yysize0;
|
||||||
|
yyformat[sizeof yyunexpected - 1] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
|
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
|
||||||
yysize_overflow |= (yysize1 < yysize);
|
yysize_overflow |= (yysize1 < yysize);
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
|
yyfmt = yystpcpy (yyfmt, yyprefix);
|
||||||
|
yyprefix = yyor;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (yycount)
|
yyf = YY_(yyformat);
|
||||||
{
|
yysize1 = yysize + yystrlen (yyf);
|
||||||
#define YYCASE_(N, S) \
|
|
||||||
case N: \
|
|
||||||
yyformat = S; \
|
|
||||||
break
|
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
|
||||||
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
|
||||||
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
|
||||||
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
|
||||||
#undef YYCASE_
|
|
||||||
}
|
|
||||||
|
|
||||||
yysize1 = yysize + yystrlen (yyformat);
|
|
||||||
yysize_overflow |= (yysize1 < yysize);
|
yysize_overflow |= (yysize1 < yysize);
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
|
|
||||||
@@ -912,17 +977,19 @@ yysyntax_error (char *yyresult, int yystate, int yytoken)
|
|||||||
produced a string with the wrong number of "%s"s. */
|
produced a string with the wrong number of "%s"s. */
|
||||||
char *yyp = yyresult;
|
char *yyp = yyresult;
|
||||||
int yyi = 0;
|
int yyi = 0;
|
||||||
while ((*yyp = *yyformat) != '\0')
|
while ((*yyp = *yyf) != '\0')
|
||||||
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
{
|
||||||
{
|
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
||||||
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
{
|
||||||
yyformat += 2;
|
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
||||||
}
|
yyf += 2;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
yyp++;
|
{
|
||||||
yyformat++;
|
yyp++;
|
||||||
}
|
yyf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return yysize;
|
return yysize;
|
||||||
}
|
}
|
||||||
@@ -1279,7 +1346,7 @@ yybackup:
|
|||||||
|
|
||||||
/* First try to decide what to do without reference to lookahead token. */
|
/* First try to decide what to do without reference to lookahead token. */
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (yypact_value_is_default (yyn))
|
if (yyn == YYPACT_NINF)
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
/* Not known => get a lookahead token if don't already have one. */
|
/* Not known => get a lookahead token if don't already have one. */
|
||||||
@@ -1329,7 +1396,7 @@ yyread_pushed_token:]])[
|
|||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yytable_value_is_error (yyn))
|
if (yyn == 0 || yyn == YYTABLE_NINF)
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
@@ -1424,7 +1491,7 @@ yyerrlab:
|
|||||||
yyerror (]b4_yyerror_args[YY_("syntax error"));
|
yyerror (]b4_yyerror_args[YY_("syntax error"));
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize = yysyntax_error (0, yystate, yytoken);
|
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
|
||||||
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
||||||
{
|
{
|
||||||
YYSIZE_T yyalloc = 2 * yysize;
|
YYSIZE_T yyalloc = 2 * yysize;
|
||||||
@@ -1444,7 +1511,7 @@ yyerrlab:
|
|||||||
|
|
||||||
if (0 < yysize && yysize <= yymsg_alloc)
|
if (0 < yysize && yysize <= yymsg_alloc)
|
||||||
{
|
{
|
||||||
(void) yysyntax_error (yymsg, yystate, yytoken);
|
(void) yysyntax_error (yymsg, yystate, yychar);
|
||||||
yyerror (]b4_yyerror_args[yymsg);
|
yyerror (]b4_yyerror_args[yymsg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1513,7 +1580,7 @@ yyerrlab1:
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (yyn != YYPACT_NINF)
|
||||||
{
|
{
|
||||||
yyn += YYTERROR;
|
yyn += YYTERROR;
|
||||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
||||||
@@ -1604,10 +1671,12 @@ yypushreturn:
|
|||||||
return YYID (yyresult);
|
return YYID (yyresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_epilogue[]dnl
|
|
||||||
|
]b4_epilogue
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[@output(b4_spec_defines_file@)
|
||||||
b4_copyright([Interface for Bison's Yacc-like parsers in C])dnl
|
b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
|
||||||
|
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
|
||||||
|
|
||||||
b4_percent_code_get([[requires]])[]dnl
|
b4_percent_code_get([[requires]])[]dnl
|
||||||
|
|
||||||
@@ -1670,4 +1739,3 @@ b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
|
|||||||
b4_percent_code_get([[provides]])[]dnl
|
b4_percent_code_get([[provides]])[]dnl
|
||||||
])dnl b4_defines_if
|
])dnl b4_defines_if
|
||||||
m4_divert_pop(0)
|
m4_divert_pop(0)
|
||||||
m4_popdef([b4_copyright_years])
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
# Requires GNU sed
|
# Requires GNU sed
|
||||||
|
|
||||||
## Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
## Copyright (C) 2005, 2006, 2007, 2008 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
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2006, 2007, 2008 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
-2
@@ -4,8 +4,7 @@ Rem Configure Bison for DJGPP.
|
|||||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
Rem Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
Rem Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
Rem Inc.
|
|
||||||
|
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-2
@@ -3,8 +3,7 @@
|
|||||||
# of the configure script generated by autoconf 2.62.
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
|
|
||||||
# Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
# Copyright (C) 2005, 2006, 2007, 2008 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
|
||||||
|
|||||||
+1
-2
@@ -3,8 +3,7 @@
|
|||||||
# This is the config.site file for configuring GNU packages
|
# This is the config.site file for configuring GNU packages
|
||||||
# which are to be built with DJGPP tools.
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
# Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
# Copyright (C) 2005, 2006, 2007, 2008 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
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
# sed script for DJGPP specific editing of config.hin
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
# Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
# Copyright (C) 2005, 2006, 2007, 2008 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
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
|
|||||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
Rem
|
Rem
|
||||||
Rem Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
Rem Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
Rem Inc.
|
|
||||||
Rem
|
Rem
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
## Copyright (C) 2008-2009 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/>.
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
djgpp/Makefile.maint \
|
|
||||||
djgpp/README.in \
|
|
||||||
djgpp/config.bat \
|
|
||||||
djgpp/config.sed \
|
|
||||||
djgpp/config.site \
|
|
||||||
djgpp/config_h.sed \
|
|
||||||
djgpp/djunpack.bat \
|
|
||||||
djgpp/fnchange.lst \
|
|
||||||
djgpp/subpipe.c \
|
|
||||||
djgpp/subpipe.h \
|
|
||||||
djgpp/testsuite.sed
|
|
||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
Copyright (C) 2005, 2006, 2007, 2008 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
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
Copyright (C) 2005, 2006, 2007, 2008-2009 Free Software Foundation,
|
Copyright (C) 2005, 2006, 2007, 2008 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
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# of the testsuite script generated by autoconf 2.61.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
|
|
||||||
|
|
||||||
# Copyright (C) 2007, 2008-2009 Free Software Foundation, Inc.
|
# Copyright (C) 2007, 2008 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
-4
@@ -1,11 +1,9 @@
|
|||||||
*.info*
|
Makefile
|
||||||
bison.1
|
|
||||||
bison.aux
|
bison.aux
|
||||||
bison.cp
|
bison.cp
|
||||||
bison.cps
|
bison.cps
|
||||||
bison.dvi
|
bison.dvi
|
||||||
bison.fn
|
bison.fn
|
||||||
bison.help
|
|
||||||
bison.html
|
bison.html
|
||||||
bison.ky
|
bison.ky
|
||||||
bison.log
|
bison.log
|
||||||
@@ -16,10 +14,11 @@ bison.toc
|
|||||||
bison.tp
|
bison.tp
|
||||||
bison.vr
|
bison.vr
|
||||||
cross-options.texi
|
cross-options.texi
|
||||||
gendocs_template
|
Makefile.in
|
||||||
refcard.dvi
|
refcard.dvi
|
||||||
refcard.log
|
refcard.log
|
||||||
refcard.ps
|
refcard.ps
|
||||||
|
*.info*
|
||||||
stamp-vti
|
stamp-vti
|
||||||
version.texi
|
version.texi
|
||||||
yacc.1
|
yacc.1
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*.info*
|
|
||||||
/bison.1
|
|
||||||
/bison.aux
|
|
||||||
/bison.cp
|
|
||||||
/bison.cps
|
|
||||||
/bison.dvi
|
|
||||||
/bison.fn
|
|
||||||
/bison.help
|
|
||||||
/bison.html
|
|
||||||
/bison.ky
|
|
||||||
/bison.log
|
|
||||||
/bison.pdf
|
|
||||||
/bison.pg
|
|
||||||
/bison.ps
|
|
||||||
/bison.toc
|
|
||||||
/bison.tp
|
|
||||||
/bison.vr
|
|
||||||
/cross-options.texi
|
|
||||||
/gendocs_template
|
|
||||||
/refcard.dvi
|
|
||||||
/refcard.log
|
|
||||||
/refcard.ps
|
|
||||||
/stamp-vti
|
|
||||||
/version.texi
|
|
||||||
/yacc.1
|
|
||||||
+1
-1
@@ -23,7 +23,7 @@ PROJECT_NAME = "@PACKAGE_NAME@"
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = "@PACKAGE_VERSION@"
|
PROJECT_NUMBER = "@PACKAGE_VERSION@ @ID@"
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
|
|||||||
+130
@@ -0,0 +1,130 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 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/>.
|
||||||
|
|
||||||
|
AM_MAKEINFOFLAGS = --no-split
|
||||||
|
info_TEXINFOS = bison.texinfo
|
||||||
|
bison_TEXINFOS = $(srcdir)/cross-options.texi gpl-3.0.texi fdl.texi
|
||||||
|
|
||||||
|
CLEANFILES = bison.fns
|
||||||
|
CLEANDIRS = *.t2d
|
||||||
|
clean-local:
|
||||||
|
rm -rf $(CLEANDIRS)
|
||||||
|
|
||||||
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
|
$(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL)
|
||||||
|
-rm -f $@ $@.tmp
|
||||||
|
cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
|
$(top_builddir)/src/bison --help | perl $(CROSS_OPTIONS_PL) >$@.tmp
|
||||||
|
mv $@.tmp $@
|
||||||
|
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
||||||
|
|
||||||
|
## ---------- ##
|
||||||
|
## Ref card. ##
|
||||||
|
## ---------- ##
|
||||||
|
|
||||||
|
EXTRA_DIST = refcard.tex
|
||||||
|
CLEANFILES += refcard.dvi refcard.log refcard.ps
|
||||||
|
|
||||||
|
refcard.dvi: refcard.tex
|
||||||
|
tex refcard.tex
|
||||||
|
|
||||||
|
refcard.ps: refcard.dvi
|
||||||
|
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## Man Pages. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
dist_man_MANS = $(srcdir)/bison.1
|
||||||
|
|
||||||
|
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
|
||||||
|
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
||||||
|
|
||||||
|
# Depend on configure.ac to get version number changes.
|
||||||
|
common_dep = $(top_srcdir)/configure.ac $(srcdir)/common.x
|
||||||
|
srcsrcdir = $(top_srcdir)/bin
|
||||||
|
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
|
||||||
|
|
||||||
|
# Output from --help and --version that must not appear in the man page.
|
||||||
|
neutralize = \
|
||||||
|
perl -0777 -pi -e 's/\.PP\nId:.*\n//g'
|
||||||
|
|
||||||
|
# Differences to ignore when comparing the man page (the date).
|
||||||
|
remove_time_stamp = \
|
||||||
|
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||||
|
|
||||||
|
MOSTLYCLEANFILES = $(srcdir)/*.t
|
||||||
|
|
||||||
|
SUFFIXES = .x .1
|
||||||
|
|
||||||
|
PREPATH = $(top_builddir)/src
|
||||||
|
.x.1:
|
||||||
|
@program=`expr "/$*" : '.*/\(.*\)'` && \
|
||||||
|
save_IFS=$IFS; \
|
||||||
|
IFS=$(PATH_SEPARATOR); \
|
||||||
|
for dir in $(PREPATH); do \
|
||||||
|
IFS=$save_IFS; \
|
||||||
|
echo cd $$dir '&&' $(MAKE) $(AM_MAKEFLAGS) $$program && \
|
||||||
|
(cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $$program) || exit; \
|
||||||
|
done
|
||||||
|
@echo "Updating man page $@"
|
||||||
|
PATH="$(PREPATH)$(PATH_SEPARATOR)$$PATH"; \
|
||||||
|
export PATH; \
|
||||||
|
$(HELP2MAN) \
|
||||||
|
--include=$*.x \
|
||||||
|
--include=$(srcdir)/common.x \
|
||||||
|
--output=$@.t `echo '$*' | sed 's,.*/,,'`
|
||||||
|
$(neutralize) $@.t
|
||||||
|
if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
||||||
|
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
||||||
|
touch $@; \
|
||||||
|
else \
|
||||||
|
mv $@.t $@; \
|
||||||
|
fi
|
||||||
|
rm -f $@*.t
|
||||||
|
|
||||||
|
nodist_man_MANS = yacc.1
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Doxygenation. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
DOXYGEN = doxygen
|
||||||
|
|
||||||
|
.PHONY: doc html
|
||||||
|
|
||||||
|
doc: html
|
||||||
|
|
||||||
|
html-local: Doxyfile
|
||||||
|
$(DOXYGEN)
|
||||||
|
|
||||||
|
edit = sed -e "s|@ID@|$$Id|" \
|
||||||
|
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||||
|
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||||
|
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||||
|
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||||
|
|
||||||
|
EXTRA_DIST += Doxyfile.in
|
||||||
|
CLEANFILES += Doxyfile
|
||||||
|
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||||
|
# configure, because the former is way faster than the latter.
|
||||||
|
# Moreover, this file is updated whenever ChangeLog is touched: using
|
||||||
|
# sed instead of configure saves us a lot of time.
|
||||||
|
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
|
||||||
|
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
|
||||||
|
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
||||||
|
|
||||||
|
CLEANDIRS += html latex
|
||||||
+197
@@ -0,0 +1,197 @@
|
|||||||
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
|
.TH BISON "1" "March 2008" "bison 2.3a+" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
bison \- GNU Project parser generator (yacc replacement)
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B bison
|
||||||
|
[\fIOPTION\fR]... \fIFILE\fR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.I Bison
|
||||||
|
is a parser generator in the style of
|
||||||
|
.IR yacc (1).
|
||||||
|
It should be upwardly compatible with input files designed
|
||||||
|
for
|
||||||
|
.IR yacc .
|
||||||
|
.PP
|
||||||
|
Input files should follow the
|
||||||
|
.I yacc
|
||||||
|
convention of ending in
|
||||||
|
.BR .y .
|
||||||
|
Unlike
|
||||||
|
.IR yacc ,
|
||||||
|
the generated files do not have fixed names, but instead use the prefix
|
||||||
|
of the input file.
|
||||||
|
Moreover, if you need to put
|
||||||
|
.I C++
|
||||||
|
code in the input file, you can end his name by a C++-like extension
|
||||||
|
(.ypp or .y++), then bison will follow your extension to name the
|
||||||
|
output file (.cpp or .c++).
|
||||||
|
For instance, a grammar description file named
|
||||||
|
.B parse.yxx
|
||||||
|
would produce the generated parser in a file named
|
||||||
|
.BR parse.tab.cxx ,
|
||||||
|
instead of
|
||||||
|
.IR yacc 's
|
||||||
|
.B y.tab.c
|
||||||
|
or old
|
||||||
|
.I Bison
|
||||||
|
version's
|
||||||
|
.BR parse.tab.c .
|
||||||
|
.PP
|
||||||
|
This description of the options that can be given to
|
||||||
|
.I bison
|
||||||
|
is adapted from the node
|
||||||
|
.B Invocation
|
||||||
|
in the
|
||||||
|
.B bison.texinfo
|
||||||
|
manual, which should be taken as authoritative.
|
||||||
|
.PP
|
||||||
|
.I Bison
|
||||||
|
supports both traditional single-letter options and mnemonic long
|
||||||
|
option names. Long option names are indicated with
|
||||||
|
.B \-\-
|
||||||
|
instead of
|
||||||
|
.BR \- .
|
||||||
|
Abbreviations for option names are allowed as long as they
|
||||||
|
are unique. When a long option takes an argument, like
|
||||||
|
.BR \-\-file-prefix ,
|
||||||
|
connect the option name and the argument with
|
||||||
|
.BR = .
|
||||||
|
.PP
|
||||||
|
Generate LALR(1) and GLR parsers.
|
||||||
|
.PP
|
||||||
|
Mandatory arguments to long options are mandatory for short options too.
|
||||||
|
The same is true for optional arguments.
|
||||||
|
.SS "Operation modes:"
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
display this help and exit
|
||||||
|
.TP
|
||||||
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
|
output version information and exit
|
||||||
|
.TP
|
||||||
|
\fB\-\-print\-localedir\fR
|
||||||
|
output directory containing locale\-dependent data
|
||||||
|
.TP
|
||||||
|
\fB\-\-print\-datadir\fR
|
||||||
|
output directory containing skeletons and XSLT
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-yacc\fR
|
||||||
|
emulate POSIX Yacc
|
||||||
|
.TP
|
||||||
|
\fB\-W\fR, \fB\-\-warnings\fR=\fI[CATEGORY]\fR
|
||||||
|
report the warnings falling in CATEGORY
|
||||||
|
.SS "Parser:"
|
||||||
|
.TP
|
||||||
|
\fB\-L\fR, \fB\-\-language\fR=\fILANGUAGE\fR
|
||||||
|
specify the output programming language
|
||||||
|
.TP
|
||||||
|
\fB\-S\fR, \fB\-\-skeleton\fR=\fIFILE\fR
|
||||||
|
specify the skeleton to use
|
||||||
|
.TP
|
||||||
|
\fB\-t\fR, \fB\-\-debug\fR
|
||||||
|
instrument the parser for debugging
|
||||||
|
.TP
|
||||||
|
\fB\-\-locations\fR
|
||||||
|
enable locations computation
|
||||||
|
.TP
|
||||||
|
\fB\-p\fR, \fB\-\-name\-prefix\fR=\fIPREFIX\fR
|
||||||
|
prepend PREFIX to the external symbols
|
||||||
|
.TP
|
||||||
|
\fB\-l\fR, \fB\-\-no\-lines\fR
|
||||||
|
don't generate `#line' directives
|
||||||
|
.TP
|
||||||
|
\fB\-k\fR, \fB\-\-token\-table\fR
|
||||||
|
include a table of token names
|
||||||
|
.SS "Output:"
|
||||||
|
.TP
|
||||||
|
\fB\-\-defines\fR[=\fIFILE\fR]
|
||||||
|
also produce a header file
|
||||||
|
.TP
|
||||||
|
\fB\-d\fR
|
||||||
|
likewise but cannot specify FILE (for POSIX Yacc)
|
||||||
|
.TP
|
||||||
|
\fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
|
||||||
|
also produce details on the automaton
|
||||||
|
.TP
|
||||||
|
\fB\-\-report\-file\fR=\fIFILE\fR
|
||||||
|
write report to FILE
|
||||||
|
.TP
|
||||||
|
\fB\-v\fR, \fB\-\-verbose\fR
|
||||||
|
same as `\-\-report=state'
|
||||||
|
.TP
|
||||||
|
\fB\-b\fR, \fB\-\-file\-prefix\fR=\fIPREFIX\fR
|
||||||
|
specify a PREFIX for output files
|
||||||
|
.TP
|
||||||
|
\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
|
||||||
|
leave output to FILE
|
||||||
|
.TP
|
||||||
|
\fB\-g\fR, \fB\-\-graph\fR[=\fIFILE\fR]
|
||||||
|
also output a graph of the automaton
|
||||||
|
.TP
|
||||||
|
\fB\-x\fR, \fB\-\-xml\fR[=\fIFILE\fR]
|
||||||
|
also output an XML report of the automaton
|
||||||
|
(the XML schema is experimental)
|
||||||
|
.SS "Warning categories include:"
|
||||||
|
.TP
|
||||||
|
`midrule\-values'
|
||||||
|
unset or unused midrule values
|
||||||
|
.TP
|
||||||
|
`yacc'
|
||||||
|
incompatibilities with POSIX YACC
|
||||||
|
.TP
|
||||||
|
`all'
|
||||||
|
all the warnings
|
||||||
|
.TP
|
||||||
|
`no\-CATEGORY'
|
||||||
|
turn off warnings in CATEGORY
|
||||||
|
.TP
|
||||||
|
`none'
|
||||||
|
turn off all the warnings
|
||||||
|
.TP
|
||||||
|
`error'
|
||||||
|
treat warnings as errors
|
||||||
|
.SS "THINGS is a list of comma separated words that can include:"
|
||||||
|
.TP
|
||||||
|
`state'
|
||||||
|
describe the states
|
||||||
|
.TP
|
||||||
|
`itemset'
|
||||||
|
complete the core item sets with their closure
|
||||||
|
.TP
|
||||||
|
`lookahead'
|
||||||
|
explicitly associate lookahead tokens to items
|
||||||
|
.TP
|
||||||
|
`solved'
|
||||||
|
describe shift/reduce conflicts solving
|
||||||
|
.TP
|
||||||
|
`all'
|
||||||
|
include all the above information
|
||||||
|
.TP
|
||||||
|
`none'
|
||||||
|
disable the report
|
||||||
|
.SH AUTHOR
|
||||||
|
Written by Robert Corbett and Richard Stallman.
|
||||||
|
.SH "REPORTING BUGS"
|
||||||
|
Report bugs to <bug\-[email protected]>.
|
||||||
|
.SH COPYRIGHT
|
||||||
|
Copyright \(co 2007 Free Software Foundation, Inc.
|
||||||
|
.br
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR lex (1),
|
||||||
|
.BR flex (1),
|
||||||
|
.BR yacc (1).
|
||||||
|
.PP
|
||||||
|
The full documentation for
|
||||||
|
.B bison
|
||||||
|
is maintained as a Texinfo manual. If the
|
||||||
|
.B info
|
||||||
|
and
|
||||||
|
.B bison
|
||||||
|
programs are properly installed at your site, the command
|
||||||
|
.IP
|
||||||
|
.B info bison
|
||||||
|
.PP
|
||||||
|
should give you access to the complete manual.
|
||||||
+556
-1270
File diff suppressed because it is too large
Load Diff
@@ -53,8 +53,3 @@ are unique. When a long option takes an argument, like
|
|||||||
.BR \-\-file-prefix ,
|
.BR \-\-file-prefix ,
|
||||||
connect the option name and the argument with
|
connect the option name and the argument with
|
||||||
.BR = .
|
.BR = .
|
||||||
|
|
||||||
[see also]
|
|
||||||
.BR lex (1),
|
|
||||||
.BR flex (1),
|
|
||||||
.BR yacc (1).
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[see also]
|
||||||
|
.BR lex (1),
|
||||||
|
.BR flex (1),
|
||||||
|
.BR yacc (1).
|
||||||
-143
@@ -1,143 +0,0 @@
|
|||||||
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
|
|
||||||
## 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/>.
|
|
||||||
|
|
||||||
AM_MAKEINFOFLAGS = --no-split
|
|
||||||
info_TEXINFOS = doc/bison.texinfo
|
|
||||||
doc_bison_TEXINFOS = \
|
|
||||||
$(CROSS_OPTIONS_TEXI) \
|
|
||||||
doc/fdl.texi \
|
|
||||||
doc/gpl-3.0.texi
|
|
||||||
|
|
||||||
CLEANFILES = doc/bison.fns
|
|
||||||
CLEANDIRS = doc/*.t2d
|
|
||||||
clean-local:
|
|
||||||
rm -rf $(CLEANDIRS)
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
|
||||||
|
|
||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
|
||||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
|
||||||
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
|
||||||
# Create $@~ which is the previous contents. Don't use `mv' here so
|
|
||||||
# that even if we are interrupted, the file is still available for
|
|
||||||
# diff in the next run. Note that $@ might not exist yet.
|
|
||||||
{ test ! -f $@ || cat $@; } >$@~
|
|
||||||
test ! -f $@.tmp || rm -f $@.tmp
|
|
||||||
src/bison$(EXEEXT) --help | \
|
|
||||||
perl $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
|
||||||
diff -u $@~ $@.tmp || true
|
|
||||||
mv $@.tmp $@
|
|
||||||
MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
|
|
||||||
|
|
||||||
## ---------- ##
|
|
||||||
## Ref card. ##
|
|
||||||
## ---------- ##
|
|
||||||
|
|
||||||
EXTRA_DIST += doc/refcard.tex
|
|
||||||
CLEANFILES += doc/refcard.dvi doc/refcard.log doc/refcard.ps
|
|
||||||
|
|
||||||
doc/refcard.dvi: doc/refcard.tex
|
|
||||||
cd doc && tex refcard.tex
|
|
||||||
|
|
||||||
doc/refcard.ps: doc/refcard.dvi
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## doc/bison.help. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
# Some of our targets (cross-option.texi, bison.1) use "bison --help".
|
|
||||||
# Since we want to ship the generated file to avoid additional
|
|
||||||
# requirements over the user environment, we used not depend on
|
|
||||||
# src/bison itself, but on src/getargs.c and other files. Yet, we
|
|
||||||
# need "bison --help" to work to make help2man happy, so we used to
|
|
||||||
# include "make src/bison" in the commands. Then we may have a
|
|
||||||
# problem with concurrent builds, since one make might be aiming one
|
|
||||||
# of its jobs at compiling src/bison, and another job at generating
|
|
||||||
# the man page. If the latter is faster than the former, then we have
|
|
||||||
# two makes that concurrently try to compile src/bison. Doomed to
|
|
||||||
# failure.
|
|
||||||
#
|
|
||||||
# As a simple scheme to get our way out, make a stamp file,
|
|
||||||
# bison.help, which contains --version then --help. This file can
|
|
||||||
# depend on bison, which ensures its correctness. But update it
|
|
||||||
# *only* if needed (content changes). This way, we avoid useless
|
|
||||||
# compilations of cross-option.texi and bison.1. At the cost of
|
|
||||||
# repeated builds of bison.help.
|
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
|
||||||
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
|
||||||
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
|
||||||
$< --version >doc/bison.help.t
|
|
||||||
$< --help >>doc/bison.help.t
|
|
||||||
$(top_srcdir)/build-aux/move-if-change doc/bison.help.t $@
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
|
||||||
## Man Pages. ##
|
|
||||||
## ----------- ##
|
|
||||||
|
|
||||||
dist_man_MANS = $(top_srcdir)/doc/bison.1
|
|
||||||
|
|
||||||
EXTRA_DIST += $(dist_man_MANS:.1=.x)
|
|
||||||
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
|
||||||
|
|
||||||
# Differences to ignore when comparing the man page (the date).
|
|
||||||
remove_time_stamp = \
|
|
||||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
|
||||||
|
|
||||||
# Depend on configure to get version number changes.
|
|
||||||
$(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
|
||||||
@echo "Updating man page $@"
|
|
||||||
$(HELP2MAN) \
|
|
||||||
--include=$(top_srcdir)/doc/bison.x \
|
|
||||||
--output=$@.t src/bison$(EXEEXT)
|
|
||||||
if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
|
||||||
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
|
||||||
touch $@; \
|
|
||||||
else \
|
|
||||||
mv $@.t $@; \
|
|
||||||
fi
|
|
||||||
rm -f $@*.t
|
|
||||||
|
|
||||||
nodist_man_MANS = doc/yacc.1
|
|
||||||
|
|
||||||
## -------------- ##
|
|
||||||
## Doxygenation. ##
|
|
||||||
## -------------- ##
|
|
||||||
|
|
||||||
DOXYGEN = doxygen
|
|
||||||
|
|
||||||
.PHONY: doc html
|
|
||||||
|
|
||||||
doc: html
|
|
||||||
|
|
||||||
html-local: doc/Doxyfile
|
|
||||||
cd doc && $(DOXYGEN)
|
|
||||||
|
|
||||||
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
|
||||||
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
|
||||||
-e 's,@top_builddir\@,$(top_builddir),g' \
|
|
||||||
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
|
||||||
|
|
||||||
EXTRA_DIST += doc/Doxyfile.in
|
|
||||||
CLEANFILES += doc/Doxyfile
|
|
||||||
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
|
||||||
# configure, because the former is way faster than the latter.
|
|
||||||
doc/Doxyfile: $(top_srcdir)/doc/Doxyfile.in
|
|
||||||
$(edit) $(top_srcdir)/doc/Doxyfile.in >doc/Doxyfile
|
|
||||||
|
|
||||||
CLEANDIRS += html latex
|
|
||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009 Free Software Foundation, Inc.
|
% Copyright (c) 1998, 2001 Free Software Foundation, Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
bench.pl
|
bench.pl
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
/bench.pl
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
## Copyright (C) 2006 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/>.
|
||||||
|
|
||||||
|
nodist_noinst_SCRIPTS = bench.pl
|
||||||
+1
-1
@@ -19,7 +19,7 @@ straightforward use of _build/src/bison would.)
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+35
-785
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
#
|
#
|
||||||
@@ -17,230 +17,17 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
bench.pl - bench marks for Bison parsers.
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
./bench.pl [OPTIONS]... DIRECTIVES
|
|
||||||
|
|
||||||
=head1 DIRECTIVES
|
|
||||||
|
|
||||||
Specify the set of benches to run. The following grammar defines the
|
|
||||||
I<directives>:
|
|
||||||
|
|
||||||
directives ::=
|
|
||||||
directives | directives -- Alternation
|
|
||||||
| directives & directives -- Concatenation
|
|
||||||
| [ directives> ] -- Optional
|
|
||||||
| ( directives> ) -- Parentheses
|
|
||||||
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
|
||||||
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
|
||||||
| %s skeleton -- %skeleton "skeleton"
|
|
||||||
| directive
|
|
||||||
|
|
||||||
Parentheses only group to override precedence. For instance:
|
|
||||||
|
|
||||||
[ %debug ] & [ %error-verbose ] & [ %define variant ]
|
|
||||||
|
|
||||||
will generate eight different cases.
|
|
||||||
|
|
||||||
=head1 OPTIONS
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item B<-b>, B<--bench>
|
|
||||||
|
|
||||||
Predefined benches, that is, combimation between a grammar and a I<directives>
|
|
||||||
request.
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item I<push>
|
|
||||||
|
|
||||||
Test the push parser vs. the pull interface. Use the C parser.
|
|
||||||
|
|
||||||
=item I<variant>
|
|
||||||
|
|
||||||
Test the use of variants instead of union in the C++ parser.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=item B<-c>, B<--cflags>=I<flags>
|
|
||||||
|
|
||||||
Flags to pass to the C or C++ compiler. Defaults to -O2.
|
|
||||||
|
|
||||||
=item B<-d>, B<--directive>=I<directives>
|
|
||||||
|
|
||||||
Add a set of Bison directives to bench against each other.
|
|
||||||
|
|
||||||
=item B<-g>, B<--grammar>=I<grammar>
|
|
||||||
|
|
||||||
Select the base I<grammar> to use. Defaults to I<calc>.
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item I<calc>
|
|
||||||
|
|
||||||
Traditional calculator.
|
|
||||||
|
|
||||||
=item I<list>
|
|
||||||
|
|
||||||
C++ grammar that uses std::string and std::list. Can be used with
|
|
||||||
or without %define variant.
|
|
||||||
|
|
||||||
=item I<triangular>
|
|
||||||
|
|
||||||
Artificial grammar with very long rules.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=item B<-h>, B<--help>
|
|
||||||
|
|
||||||
Display this message and exit succesfully. The more verbose, the more
|
|
||||||
details.
|
|
||||||
|
|
||||||
=item B<-i>, B<--iterations>=I<integer>
|
|
||||||
|
|
||||||
Say how many times a single test of the bench must be run. If
|
|
||||||
negative, specify the minimum number of CPU seconds to run. Defaults
|
|
||||||
to -1.
|
|
||||||
|
|
||||||
=item B<-q>, B<--quiet>
|
|
||||||
|
|
||||||
Decrease the verbosity level (defaults to 1).
|
|
||||||
|
|
||||||
=item B<-v>, B<--verbose>
|
|
||||||
|
|
||||||
Raise the verbosity level (defaults to 1).
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use IO::File;
|
use IO::File;
|
||||||
|
use Benchmark qw (:all);
|
||||||
|
|
||||||
|
my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison';
|
||||||
|
my $cc = $ENV{'CC'} || 'gcc';
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=head1 VARIABLES
|
sub triangular_grammar ($$$)
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item C<@bench>
|
|
||||||
|
|
||||||
The list of benches to run.
|
|
||||||
|
|
||||||
=item C<$bison>
|
|
||||||
|
|
||||||
The Bison program to use to compile the grammar.
|
|
||||||
|
|
||||||
=item C<$cc>
|
|
||||||
|
|
||||||
The C compiler.
|
|
||||||
|
|
||||||
=item C<$cxx>
|
|
||||||
|
|
||||||
The C++ compiler.
|
|
||||||
|
|
||||||
=item C<$cflags>
|
|
||||||
|
|
||||||
Compiler flags (C or C++).
|
|
||||||
|
|
||||||
=item C<@directive>
|
|
||||||
|
|
||||||
A list of directive sets to measure against each other.
|
|
||||||
|
|
||||||
=item C<$iterations>
|
|
||||||
|
|
||||||
The number of times the parser is run for a bench.
|
|
||||||
|
|
||||||
=item C<$verbose>
|
|
||||||
|
|
||||||
Verbosity level.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
my $bench;
|
|
||||||
my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison';
|
|
||||||
my $cc = $ENV{'CC'} || 'gcc';
|
|
||||||
my $cxx = $ENV{'CXX'} || 'g++';
|
|
||||||
my $cflags = '-O2';
|
|
||||||
my @directive = ();
|
|
||||||
my $grammar = 'calc';
|
|
||||||
my $iterations = -1;
|
|
||||||
my $verbose = 1;
|
|
||||||
|
|
||||||
=head1 FUNCTIONS
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item C<verbose($level, $message)>
|
|
||||||
|
|
||||||
Report the C<$message> is C<$level> E<lt>= C<$verbose>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub verbose($$)
|
|
||||||
{
|
{
|
||||||
my ($level, $message) = @_;
|
my ($base, $max, $directives) = @_;
|
||||||
print STDERR $message
|
|
||||||
if $level <= $verbose;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
=item C<directives($bench, @directive)>
|
|
||||||
|
|
||||||
Format the list of directives for Bison for bench named C<$bench>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub directives($@)
|
|
||||||
{
|
|
||||||
my ($bench, @directive) = @_;
|
|
||||||
my $res = "/* Directives for bench `$bench'. */\n";
|
|
||||||
$res .= join ("\n", @directive) . "\n";
|
|
||||||
$res .= "/* End of directives for bench `$bench'. */\n";
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
=item C<generate_grammar_triangular ($base, $max, @directive)>
|
|
||||||
|
|
||||||
Create a large triangular grammar which looks like :
|
|
||||||
|
|
||||||
input:
|
|
||||||
exp { if ($1 != 0) abort (); $$ = $1; }
|
|
||||||
| input exp { if ($2 != $1 + 1) abort (); $$ = $2; }
|
|
||||||
;
|
|
||||||
|
|
||||||
exp:
|
|
||||||
END { $$ = 0; }
|
|
||||||
| "1" END { $$ = 1; }
|
|
||||||
| "1" "2" END { $$ = 2; }
|
|
||||||
| "1" "2" "3" END { $$ = 3; }
|
|
||||||
| "1" "2" "3" "4" END { $$ = 4; }
|
|
||||||
| "1" "2" "3" "4" "5" END { $$ = 5; }
|
|
||||||
;
|
|
||||||
|
|
||||||
C<$base> is the base name for the file to create (F<$base.y>).
|
|
||||||
C<$max> is the number of such rules (here, 5). You may pass
|
|
||||||
additional Bison C<@directive>.
|
|
||||||
|
|
||||||
The created parser is self contained: it includes its scanner, and
|
|
||||||
source of input.
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar_triangular ($$@)
|
|
||||||
{
|
|
||||||
my ($base, $max, @directive) = @_;
|
|
||||||
my $directives = directives ($base, @directive);
|
|
||||||
|
|
||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
@@ -254,7 +41,6 @@ sub generate_grammar_triangular ($$@)
|
|||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
static void yyerror (const char *msg);
|
static void yyerror (const char *msg);
|
||||||
%}
|
%}
|
||||||
$directives
|
|
||||||
%union
|
%union
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
@@ -326,15 +112,6 @@ EOF
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<calc_input ($base, $max)>
|
|
||||||
|
|
||||||
Generate the input file F<$base.input> for the calc parser. The input
|
|
||||||
is composed of two expressions. The first one is using left recursion
|
|
||||||
only and consumes no stack. The second one requires a deep stack.
|
|
||||||
These two expressions are repeated C<$max> times in the output file.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub calc_input ($$)
|
sub calc_input ($$)
|
||||||
{
|
{
|
||||||
my ($base, $max) = @_;
|
my ($base, $max) = @_;
|
||||||
@@ -349,22 +126,9 @@ sub calc_input ($$)
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<generate_grammar_calc ($base, $max, @directive)>
|
sub calc_grammar ($$$)
|
||||||
|
|
||||||
Generate a Bison file F<$base.y> for a calculator parser in C. Pass
|
|
||||||
the additional Bison C<@directive>. C<$max> is ignored, but left to
|
|
||||||
have the same interface as C<triangular_grammar>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar_calc ($$@)
|
|
||||||
{
|
{
|
||||||
my ($base, $max, @directive) = @_;
|
my ($base, $max, $directives) = @_;
|
||||||
my $directives = directives ($base, @directive);
|
|
||||||
|
|
||||||
# Putting this request here is stupid, since the input will be
|
|
||||||
# generated each time we generate a grammar.
|
|
||||||
calc_input ('calc', 200);
|
|
||||||
|
|
||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
@@ -384,9 +148,9 @@ static semantic_value global_result = 0;
|
|||||||
static int global_count = 0;
|
static int global_count = 0;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
/* Exercise %union. */
|
||||||
$directives
|
$directives
|
||||||
%error-verbose
|
%error-verbose
|
||||||
/* Exercise %union. */
|
|
||||||
%union
|
%union
|
||||||
{
|
{
|
||||||
semantic_value ival;
|
semantic_value ival;
|
||||||
@@ -506,7 +270,9 @@ yylex (void)
|
|||||||
|
|
||||||
/* Skip white space. */
|
/* Skip white space. */
|
||||||
while ((c = get_char ()) == ' ' || c == '\t')
|
while ((c = get_char ()) == ' ' || c == '\t')
|
||||||
continue;
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* process numbers */
|
/* process numbers */
|
||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
@@ -563,560 +329,44 @@ EOF
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<generate_grammar_list ($base, $max, @directive)>
|
|
||||||
|
|
||||||
Generate a Bison file F<$base.y> for a C++ parser that uses C++
|
|
||||||
objects (std::string, std::list). Tailored for using %define variant.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar_list ($$@)
|
|
||||||
{
|
|
||||||
my ($base, $max, @directive) = @_;
|
|
||||||
my $directives = directives ($base, @directive);
|
|
||||||
my $variant = grep { /%define "?variant"?/ } @directive;
|
|
||||||
my $lex_symbol = grep { /%define "?lex_symbol"?/ } @directive;
|
|
||||||
my $out = new IO::File ">$base.y"
|
|
||||||
or die;
|
|
||||||
print $out <<EOF;
|
|
||||||
%language "C++"
|
|
||||||
%defines
|
|
||||||
%locations
|
|
||||||
$directives
|
|
||||||
|
|
||||||
%code requires // *.h
|
|
||||||
{
|
|
||||||
#include <string>
|
|
||||||
}
|
|
||||||
|
|
||||||
%code // *.c
|
|
||||||
{
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#define STAGE_MAX ($max * 10) // max = $max
|
|
||||||
|
|
||||||
#define USE_LEX_SYMBOL $lex_symbol
|
|
||||||
#define USE_VARIANTS $variant
|
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
|
||||||
static
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
yy::parser::symbol_type yylex();
|
|
||||||
#else
|
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|
||||||
yy::parser::location_type* yylloc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Conversion to string.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
string_cast (const T& t)
|
|
||||||
{
|
|
||||||
std::ostringstream o;
|
|
||||||
o << t;
|
|
||||||
return o.str ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%token END_OF_FILE 0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if ($variant)
|
|
||||||
{
|
|
||||||
print $out <<'EOF';
|
|
||||||
%token <std::string> TEXT
|
|
||||||
%token <int> NUMBER
|
|
||||||
%printer { std::cerr << "Number: " << $$; } <int>
|
|
||||||
%printer { std::cerr << "Text: " << $$; } <std::string>
|
|
||||||
%type <std::string> text result
|
|
||||||
|
|
||||||
%%
|
|
||||||
result:
|
|
||||||
text { /* Throw away the result. */ }
|
|
||||||
;
|
|
||||||
|
|
||||||
text:
|
|
||||||
/* nothing */ { /* This will generate an empty string */ }
|
|
||||||
| text TEXT { std::swap ($$, $2); }
|
|
||||||
| text NUMBER { $$ = string_cast($2); }
|
|
||||||
;
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Not using Bison variants.
|
|
||||||
print $out <<'EOF';
|
|
||||||
%union {int ival; std::string* sval;}
|
|
||||||
%token <sval> TEXT
|
|
||||||
%token <ival> NUMBER
|
|
||||||
%printer { std::cerr << "Number: " << $$; } <ival>
|
|
||||||
%printer { std::cerr << "Text: " << *$$; } <sval>
|
|
||||||
%type <sval> text result
|
|
||||||
|
|
||||||
%%
|
|
||||||
result:
|
|
||||||
text { delete $1; }
|
|
||||||
;
|
|
||||||
|
|
||||||
text:
|
|
||||||
/* nothing */ { $$ = new std::string; }
|
|
||||||
| text TEXT { delete $1; $$ = $2; }
|
|
||||||
| text NUMBER { delete $1; $$ = new std::string (string_cast ($2)); }
|
|
||||||
;
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
print $out <<'EOF';
|
|
||||||
%%
|
|
||||||
#
|
|
||||||
|
|
||||||
static
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
yy::parser::symbol_type yylex()
|
|
||||||
#else
|
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|
||||||
yy::parser::location_type* yylloc)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
typedef yy::parser::location_type location_type;
|
|
||||||
typedef yy::parser::token token;
|
|
||||||
static int stage = -1;
|
|
||||||
++stage;
|
|
||||||
if (stage == STAGE_MAX)
|
|
||||||
{
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
return yy::parser::make_END_OF_FILE (location_type ());
|
|
||||||
#else
|
|
||||||
*yylloc = location_type ();
|
|
||||||
return token::END_OF_FILE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (stage % 2)
|
|
||||||
{
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
return yy::parser::make_NUMBER (stage, location_type ());
|
|
||||||
#else
|
|
||||||
# if defined ONE_STAGE_BUILD
|
|
||||||
yylval->build(stage);
|
|
||||||
# elif USE_VARIANTS
|
|
||||||
yylval->build<int>() = stage;
|
|
||||||
# else
|
|
||||||
yylval->ival = stage;
|
|
||||||
# endif
|
|
||||||
*yylloc = location_type ();
|
|
||||||
return token::NUMBER;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
return yy::parser::make_TEXT ("A string.", location_type ());
|
|
||||||
#else
|
|
||||||
# if defined ONE_STAGE_BUILD
|
|
||||||
yylval->build(std::string("A string."));
|
|
||||||
# elif USE_VARIANTS
|
|
||||||
yylval->build<std::string>() = std::string("A string.");
|
|
||||||
# else
|
|
||||||
yylval->sval = new std::string("A string.");
|
|
||||||
# endif
|
|
||||||
*yylloc = location_type ();
|
|
||||||
return token::TEXT;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mandatory error function
|
|
||||||
void
|
|
||||||
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
|
||||||
{
|
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
yy::parser p;
|
|
||||||
#if YYDEBUG
|
|
||||||
p.set_debug_level(!!getenv("YYDEBUG"));
|
|
||||||
#endif
|
|
||||||
p.parse();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
=item C<generate_grammar ($name, $base, @directive)>
|
|
||||||
|
|
||||||
Generate F<$base.y> by calling C<&generate_grammar_$name>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar ($$@)
|
|
||||||
{
|
|
||||||
my ($name, $base, @directive) = @_;
|
|
||||||
verbose 3, "Generating $base.y\n";
|
|
||||||
my %generator =
|
|
||||||
(
|
|
||||||
"calc" => \&generate_grammar_calc,
|
|
||||||
"list" => \&generate_grammar_list,
|
|
||||||
"triangular" => \&generate_grammar_triangular,
|
|
||||||
);
|
|
||||||
&{$generator{$name}}($base, 200, @directive);
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
=item C<run ($command)>
|
|
||||||
|
|
||||||
Run, possibly verbosely, the shell C<$command>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub run ($)
|
|
||||||
{
|
|
||||||
my ($command) = @_;
|
|
||||||
verbose 3, "$command\n";
|
|
||||||
system ("$command") == 0
|
|
||||||
or die "$command failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
=item C<compile ($base)>
|
|
||||||
|
|
||||||
Compile C<$base.y> to an executable C, Using the C or C++ compiler
|
|
||||||
depending on the %language specification in C<$base.y>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub compile ($)
|
sub compile ($)
|
||||||
{
|
{
|
||||||
my ($base) = @_;
|
my ($base) = @_;
|
||||||
my $language = `sed -ne '/%language "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
system ("$bison $base.y -o $base.c") == 0
|
||||||
chomp $language;
|
or die;
|
||||||
|
system ("$cc -o $base $base.c") == 0
|
||||||
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
or die;
|
||||||
|
|
||||||
run "$bison $base.y -o $base.c";
|
|
||||||
run "$compiler -o $base $cflags $base.c";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
sub bench_grammar ($)
|
||||||
|
|
||||||
=item C<bench ($grammar, @token)>
|
|
||||||
|
|
||||||
Generate benches for the C<$grammar> and the directive specification
|
|
||||||
given in the list of C<@token>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub bench ($@)
|
|
||||||
{
|
{
|
||||||
my ($grammar, @token) = @_;
|
my ($gram) = @_;
|
||||||
use Benchmark qw (:all :hireswallclock);
|
my %test =
|
||||||
|
(
|
||||||
|
"pull-impure" => '',
|
||||||
|
"pull-pure" => '%define api.pure',
|
||||||
|
"push-impure" => '%define api.push_pull "both"',
|
||||||
|
"push-pure" => '%define api.push_pull "both" %define api.pure',
|
||||||
|
);
|
||||||
|
|
||||||
my @directive = parse (@token);
|
|
||||||
|
|
||||||
# Set up the benches as expected by timethese.
|
|
||||||
my %bench;
|
my %bench;
|
||||||
# A counter of directive sets.
|
while (my ($name, $directives) = each %test)
|
||||||
my $count = 1;
|
|
||||||
for my $d (@directive)
|
|
||||||
{
|
{
|
||||||
$bench{$count} = $d;
|
print STDERR "$name\n";
|
||||||
printf " %2d. %s\n", $count, join (' ', split ("\n", $d));
|
my $generator = "$gram" . "_grammar";
|
||||||
$count++;
|
&$generator ($name, 200, $directives);
|
||||||
};
|
|
||||||
|
|
||||||
# For each bench, capture the size.
|
|
||||||
my %size;
|
|
||||||
|
|
||||||
while (my ($name, $directives) = each %bench)
|
|
||||||
{
|
|
||||||
generate_grammar ($grammar, $name, $directives);
|
|
||||||
# Compile the executable.
|
|
||||||
compile ($name);
|
compile ($name);
|
||||||
$bench{$name} = "system ('./$name');";
|
$bench{$name} = "system ('./$name');";
|
||||||
chop($size{$name} = `wc -c <$name`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run the benches.
|
print "$gram:\n";
|
||||||
#
|
my $res = timethese (50, \%bench, 'nop');
|
||||||
# STYLE can be any of 'all', 'none', 'noc', 'nop' or 'auto'. 'all'
|
|
||||||
# shows each of the 5 times available ('wallclock' time, user time,
|
|
||||||
# system time, user time of children, and system time of
|
|
||||||
# children). 'noc' shows all except the two children times. 'nop'
|
|
||||||
# shows only wallclock and the two children times. 'auto' (the
|
|
||||||
# default) will act as 'all' unless the children times are both
|
|
||||||
# zero, in which case it acts as 'noc'. 'none' prevents output.
|
|
||||||
verbose 3, "Running the benches for $grammar\n";
|
|
||||||
my $res = timethese ($iterations, \%bench, 'nop');
|
|
||||||
|
|
||||||
# Output the speed result.
|
|
||||||
cmpthese ($res, 'nop');
|
cmpthese ($res, 'nop');
|
||||||
|
|
||||||
# Display the sizes.
|
|
||||||
print "Sizes (decreasing):\n";
|
|
||||||
my $width = 10;
|
|
||||||
for my $bench (keys %size)
|
|
||||||
{
|
|
||||||
$width = length $bench
|
|
||||||
if $width < length $bench;
|
|
||||||
}
|
|
||||||
# Benches sorted by decreasing size.
|
|
||||||
my @benches_per_size = sort {$size{$b} <=> $size{$a}} keys %size;
|
|
||||||
for my $bench (@benches_per_size)
|
|
||||||
{
|
|
||||||
printf "%${width}s: %5.2fkB\n", $bench, $size{$bench} / 1024;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
print STDERR "Using $bison, $cc.\n";
|
||||||
|
calc_input ('calc', 200);
|
||||||
=item C<bench_push_parser ()>
|
bench_grammar ('calc');
|
||||||
|
|
||||||
Bench the C push parser against the pull parser, pure and impure
|
|
||||||
interfaces.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub bench_push_parser ()
|
|
||||||
{
|
|
||||||
bench ('calc',
|
|
||||||
qw(
|
|
||||||
[ %d api.pure ]
|
|
||||||
&
|
|
||||||
[ %d api.push-pull=both ]
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
=item C<bench_variant_parser ()>
|
|
||||||
|
|
||||||
Bench the C++ lalr1.cc parser using variants or %union.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub bench_variant_parser ()
|
|
||||||
{
|
|
||||||
bench ('list',
|
|
||||||
qw(
|
|
||||||
[
|
|
||||||
%d variant
|
|
||||||
&
|
|
||||||
[ #d ONE_STAGE_BUILD | %d lex_symbol ]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
sub help ($)
|
|
||||||
{
|
|
||||||
my ($verbose) = @_;
|
|
||||||
use Pod::Usage;
|
|
||||||
# See <URL:http://perldoc.perl.org/pod2man.html#NOTES>.
|
|
||||||
pod2usage( { -message => "Bench Bison parsers",
|
|
||||||
-exitval => 0,
|
|
||||||
-verbose => $verbose,
|
|
||||||
-output => \*STDOUT });
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
# The end of the directives to parse.
|
|
||||||
my $eod = "end of directives";
|
|
||||||
# The list of tokens parsed by the following functions.
|
|
||||||
my @token;
|
|
||||||
|
|
||||||
# eat ($EXPECTED)
|
|
||||||
# ---------------
|
|
||||||
# Check that the current token is $EXPECTED, and move to the next.
|
|
||||||
sub eat ($)
|
|
||||||
{
|
|
||||||
my ($expected) = @_;
|
|
||||||
die "expected $expected, unexpected: $token[0] (@token)\n"
|
|
||||||
unless $token[0] eq $expected;
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parse directive specifications:
|
|
||||||
# expr: term (| term)*
|
|
||||||
# term: fact (& fact)*
|
|
||||||
# fact: ( expr ) | [ expr ] | dirs
|
|
||||||
# dirs: %s SKELETON | #d NAME[=VALUE] | %d NAME[=VALUE] | directive
|
|
||||||
sub parse (@)
|
|
||||||
{
|
|
||||||
@token = (@_, $eod);
|
|
||||||
verbose 3, "Parsing: @token\n";
|
|
||||||
my @res = parse_expr ();
|
|
||||||
eat ($eod);
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_expr ()
|
|
||||||
{
|
|
||||||
my @res = parse_term ();
|
|
||||||
while ($token[0] eq '|')
|
|
||||||
{
|
|
||||||
eat ('|');
|
|
||||||
# Alternation.
|
|
||||||
push @res, parse_term ();
|
|
||||||
}
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_term ()
|
|
||||||
{
|
|
||||||
my @res = parse_fact ();
|
|
||||||
while ($token[0] eq '&')
|
|
||||||
{
|
|
||||||
eat ('&');
|
|
||||||
# Cartesian product.
|
|
||||||
my @lhs = @res;
|
|
||||||
@res = ();
|
|
||||||
for my $rhs (parse_fact ())
|
|
||||||
{
|
|
||||||
for my $lhs (@lhs)
|
|
||||||
{
|
|
||||||
push @res, $lhs . ($lhs && $rhs ? "\n" : "") . $rhs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_fact ()
|
|
||||||
{
|
|
||||||
my @res;
|
|
||||||
die "unexpected end of expression"
|
|
||||||
unless defined $token[0];
|
|
||||||
|
|
||||||
if ($token[0] eq '(')
|
|
||||||
{
|
|
||||||
eat ('(');
|
|
||||||
@res = parse_expr ();
|
|
||||||
eat (')');
|
|
||||||
}
|
|
||||||
elsif ($token[0] eq '[')
|
|
||||||
{
|
|
||||||
eat ('[');
|
|
||||||
@res = (parse_expr (), '');
|
|
||||||
eat (']');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@res = parse_dirs ();
|
|
||||||
}
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_dirs ()
|
|
||||||
{
|
|
||||||
my @res;
|
|
||||||
die "unexpected end of expression"
|
|
||||||
unless defined $token[0];
|
|
||||||
|
|
||||||
if ($token[0] eq '#d')
|
|
||||||
{
|
|
||||||
eat ('#d');
|
|
||||||
$token[0] =~ s/(.*?)=(.*)/$1 $2/;
|
|
||||||
@res = ("%code {\n#define $token[0]\n}");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
elsif ($token[0] eq '%d')
|
|
||||||
{
|
|
||||||
shift @token;
|
|
||||||
$token[0] =~ s/(.*?)=(.*)/$1 "$2"/;
|
|
||||||
@res = ("%define $token[0]");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
elsif ($token[0] eq '%s')
|
|
||||||
{
|
|
||||||
shift @token;
|
|
||||||
@res = ("%skeleton \"$token[0]\"");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@res = $token[0];
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
sub getopt ()
|
|
||||||
{
|
|
||||||
use Getopt::Long;
|
|
||||||
my %option = (
|
|
||||||
"b|bench=s" => \$bench,
|
|
||||||
"c|cflags=s" => \$cflags,
|
|
||||||
"d|directive=s" => \@directive,
|
|
||||||
"g|grammar=s" => \$grammar,
|
|
||||||
"h|help" => sub { help ($verbose) },
|
|
||||||
"i|iterations=i" => \$iterations,
|
|
||||||
"q|quiet" => sub { --$verbose },
|
|
||||||
"v|verbose" => sub { ++$verbose },
|
|
||||||
);
|
|
||||||
Getopt::Long::Configure ("bundling", "pass_through");
|
|
||||||
GetOptions (%option)
|
|
||||||
or exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
getopt;
|
|
||||||
|
|
||||||
# Create the directory we work in.
|
|
||||||
mkdir "benches" or die "cannot create benches"
|
|
||||||
unless -d "benches";
|
|
||||||
my $count = 1;
|
|
||||||
++$count
|
|
||||||
while -d "benches/$count";
|
|
||||||
my $dir = "benches/$count";
|
|
||||||
mkdir $dir
|
|
||||||
or die "cannot create $dir";
|
|
||||||
chdir $dir
|
|
||||||
or die "cannot chdir $dir";
|
|
||||||
|
|
||||||
# The following message is tailored to please Emacs' compilation-mode.
|
|
||||||
verbose 1, "Entering directory `$dir'\n";
|
|
||||||
verbose 1, "Using bison=$bison.\n";
|
|
||||||
verbose 2, "Using cc=$cc.\n";
|
|
||||||
verbose 2, "Using cxx=$cxx.\n";
|
|
||||||
verbose 2, "Using cflags=$cflags.\n";
|
|
||||||
verbose 2, "Grammar: $grammar\n";
|
|
||||||
|
|
||||||
|
|
||||||
# Support -b: predefined benches.
|
|
||||||
my %bench =
|
|
||||||
(
|
|
||||||
"push" => \&bench_push_parser,
|
|
||||||
"variant" => \&bench_variant_parser,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (defined $bench)
|
|
||||||
{
|
|
||||||
die "invalid argument for --bench: $bench"
|
|
||||||
unless defined $bench{$bench};
|
|
||||||
&{$bench{$bench}}();
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Launch the bench marking.
|
|
||||||
bench ($grammar, @ARGV);
|
|
||||||
}
|
|
||||||
|
|
||||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||||
## Local Variables:
|
## Local Variables:
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
## Copyright (C) 2006, 2008-2009 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/>.
|
|
||||||
|
|
||||||
nodist_noinst_SCRIPTS = etc/bench.pl
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use IO::File;
|
|
||||||
|
|
||||||
my $prefix = "lib/";
|
|
||||||
|
|
||||||
# contents ($FILE_NAME)
|
|
||||||
# ---------------------
|
|
||||||
sub contents ($)
|
|
||||||
{
|
|
||||||
my ($file) = @_;
|
|
||||||
local $/; # Turn on slurp-mode.
|
|
||||||
my $f = new IO::File "< $file" or die "$file";
|
|
||||||
my $contents = $f->getline or die "$file";
|
|
||||||
$f->close;
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
# prefix_word ($WORD)
|
|
||||||
# -------------------
|
|
||||||
# Do not prefix special words such as variable dereferences. Also,
|
|
||||||
# "Makefile" is really "Makefile", since precisely there is no
|
|
||||||
# lib/Makefile.
|
|
||||||
sub prefix_word ($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
$_ = $prefix . $_
|
|
||||||
unless m{^\$\(\w+\)} || $_ eq "Makefile";
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# prefix_words ($TEXT)
|
|
||||||
# --------------------
|
|
||||||
sub prefix_words ($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
s{(\S+)}{prefix_word($1)}gem;
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# prefix_assignment ($LHS-AND-ASSIGN-OP, $RHS)
|
|
||||||
# --------------------------------------------
|
|
||||||
sub prefix_assignment ($$)
|
|
||||||
{
|
|
||||||
my ($lhs_and_assign_op, $rhs) = @_;
|
|
||||||
my $res;
|
|
||||||
|
|
||||||
# Some variables are initialized by gnulib.mk, and we don't want
|
|
||||||
# that. Change '=' to '+='.
|
|
||||||
if ($lhs_and_assign_op =~ /^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES|CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES|AM_CFLAGS|AM_CPPFLAGS|AM_GNU_GETTEXT) =/)
|
|
||||||
{
|
|
||||||
$lhs_and_assign_op =~ s/=/+=/;
|
|
||||||
}
|
|
||||||
# We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them.
|
|
||||||
elsif ($lhs_and_assign_op =~ /^AUTOMAKE_OPTIONS =/)
|
|
||||||
{
|
|
||||||
$lhs_and_assign_op =~ s/^/# /;
|
|
||||||
}
|
|
||||||
# Don't touch suffixes.
|
|
||||||
elsif ($lhs_and_assign_op =~ /^SUFFIXES /)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
# The words are (probably) paths to files in lib/: prefix them.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$rhs = prefix_words($rhs)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Variables which name depend on the location: libbison_a_SOURCES =>
|
|
||||||
# lib_libbison_a_SOURCES.
|
|
||||||
$lhs_and_assign_op =~ s/(libbison)/lib_$1/g;
|
|
||||||
|
|
||||||
return $lhs_and_assign_op . $rhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
# prefix $CONTENTS
|
|
||||||
# ----------------
|
|
||||||
# $CONTENTS is a Makefile content. Post-process it so that each file-name
|
|
||||||
# is prefixed with $prefix (e.g., "lib/").
|
|
||||||
#
|
|
||||||
# Relies heavily on the regularity of the file generated by gnulib-tool.
|
|
||||||
sub prefix ($)
|
|
||||||
{
|
|
||||||
# Work on $_.
|
|
||||||
local ($_) = @_;
|
|
||||||
|
|
||||||
# Prefix all the occurrence of files in rules. If there is nothing
|
|
||||||
# after in the :, it's probably a phony target, or a suffix rule.
|
|
||||||
# Don't touch it.
|
|
||||||
s{^([\w./]+ *: *\w.*)$}
|
|
||||||
{prefix_words($1)}gem;
|
|
||||||
|
|
||||||
# Prefix files in variables.
|
|
||||||
s{^([\w.]+\s*\+?=)(.*)$}
|
|
||||||
{prefix_assignment($1, $2)}gem;
|
|
||||||
|
|
||||||
# These three guys escape all the other regular rules.
|
|
||||||
s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g;
|
|
||||||
# Unfortunately, as a result we sometimes have lib/lib.
|
|
||||||
s{($prefix){2}}{$1}g;
|
|
||||||
|
|
||||||
# $(srcdir) is actually $(top_srcdir)/lib.
|
|
||||||
s{\$\(srcdir\)}{\$(top_srcdir)/lib}g;
|
|
||||||
|
|
||||||
# Sometimes, t-$@ is used instead of $@-t, which, of course, does
|
|
||||||
# not work when we have a $@ with a directory in it.
|
|
||||||
s{t-\$\@}{\$\@-t}g;
|
|
||||||
|
|
||||||
# Some AC_SUBST patterns remain and would better be Make macros.
|
|
||||||
s{\@(MKDIR_P)\@}{\$($1)}g;
|
|
||||||
|
|
||||||
# Adjust paths in mkdir.
|
|
||||||
s{(\$\(MKDIR_P\))\s*(\w+)}{$1 $prefix$2}g;
|
|
||||||
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
# process ($IN)
|
|
||||||
# -------------
|
|
||||||
sub process ($)
|
|
||||||
{
|
|
||||||
my ($file) = @_;
|
|
||||||
my ($bak) = "$file.bak";
|
|
||||||
rename ($file, $bak) or die;
|
|
||||||
my $contents = contents ($bak);
|
|
||||||
$contents = prefix ($contents);
|
|
||||||
my $out = new IO::File(">$file") or die;
|
|
||||||
print $out $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
process ("${prefix}gnulib.mk")
|
|
||||||
|
|
||||||
|
|
||||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
|
||||||
## Local Variables:
|
|
||||||
## perl-indent-level: 2
|
|
||||||
## perl-continued-statement-offset: 2
|
|
||||||
## perl-continued-brace-offset: 0
|
|
||||||
## perl-brace-offset: 0
|
|
||||||
## perl-brace-imaginary-offset: 0
|
|
||||||
## perl-label-offset: -2
|
|
||||||
## cperl-indent-level: 2
|
|
||||||
## cperl-brace-offset: 0
|
|
||||||
## cperl-continued-brace-offset: 0
|
|
||||||
## cperl-label-offset: -2
|
|
||||||
## cperl-extra-newline-before-brace: t
|
|
||||||
## cperl-merge-trailing-else: nil
|
|
||||||
## cperl-continued-statement-offset: 2
|
|
||||||
## End:
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2005 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/>.
|
||||||
|
|
||||||
|
if BISON_CXX_WORKS
|
||||||
|
SUBDIRS = calc++
|
||||||
|
endif
|
||||||
|
|
||||||
|
dist_noinst_SCRIPTS = extexi
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/*.cc
|
|
||||||
/*.hh
|
|
||||||
/*.ll
|
|
||||||
/*.o
|
|
||||||
/*.output
|
|
||||||
/*.stamp
|
|
||||||
/*.tmp
|
|
||||||
/*.yy
|
|
||||||
/.deps
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/calc++
|
|
||||||
/calc++.exe
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
## Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
|
## Copyright (C) 2005, 2006 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,7 +22,7 @@ BISON = $(top_builddir)/tests/bison
|
|||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
|
|
||||||
$(BISON): $(BISON_IN)
|
$(BISON): $(BISON_IN)
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) tests/bison
|
cd $(top_builddir)/tests && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Extracting. ##
|
## Extracting. ##
|
||||||
@@ -31,16 +31,12 @@ $(BISON): $(BISON_IN)
|
|||||||
doc = $(top_srcdir)/doc/bison.texinfo
|
doc = $(top_srcdir)/doc/bison.texinfo
|
||||||
extexi = $(top_srcdir)/examples/extexi
|
extexi = $(top_srcdir)/examples/extexi
|
||||||
# Extract in src.
|
# Extract in src.
|
||||||
$(srcdir)/calc.stamp: $(doc) $(extexi)
|
$(calc_extracted): $(doc) $(extexi)
|
||||||
rm -f $@ $@.tmp
|
|
||||||
touch $@.tmp
|
|
||||||
cd $(srcdir) && \
|
cd $(srcdir) && \
|
||||||
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
||||||
../../doc/bison.texinfo -- calc++-parser.yy \
|
../../doc/bison.texinfo -- calc++-parser.yy \
|
||||||
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
||||||
mv $@.tmp $@
|
|
||||||
|
|
||||||
$(calc_extracted): $(srcdir)/calc.stamp
|
|
||||||
|
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
## Parser generation. ##
|
## Parser generation. ##
|
||||||
@@ -54,16 +50,13 @@ MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES)
|
|||||||
# Compile the parser and save cycles.
|
# Compile the parser and save cycles.
|
||||||
# This code comes from "Handling Tools that Produce Many Outputs",
|
# This code comes from "Handling Tools that Produce Many Outputs",
|
||||||
# from the Automake documentation.
|
# from the Automake documentation.
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = $(srcdir)/calc++-parser.stamp $(srcdir)/calc++-parser.yy
|
||||||
$(srcdir)/calc++-parser.stamp \
|
|
||||||
$(srcdir)/calc++-parser.yy \
|
|
||||||
$(srcdir)/calc.stamp
|
|
||||||
# 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.
|
||||||
$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
|
$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
|
||||||
@rm -f calc++-parser.tmp
|
@rm -f calc++-parser.tmp
|
||||||
@touch calc++-parser.tmp
|
@touch calc++-parser.tmp
|
||||||
$(BISON) -d -ra -o $(srcdir)/calc++-parser.cc \
|
$(BISON) -d -ra -S lalr1.cc -o $(srcdir)/calc++-parser.cc \
|
||||||
$(srcdir)/calc++-parser.yy
|
$(srcdir)/calc++-parser.yy
|
||||||
@mv -f calc++-parser.tmp $@
|
@mv -f calc++-parser.tmp $@
|
||||||
|
|
||||||
|
|||||||
+5
-53
@@ -5,42 +5,6 @@ test -z "$VERBOSE" && {
|
|||||||
set -x
|
set -x
|
||||||
}
|
}
|
||||||
|
|
||||||
me=`basename $0`
|
|
||||||
|
|
||||||
# Number of the current test.
|
|
||||||
number=1
|
|
||||||
|
|
||||||
# Exit status of this script.
|
|
||||||
exit=true
|
|
||||||
|
|
||||||
# run EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS]
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
run ()
|
|
||||||
{
|
|
||||||
# Effective and expected exit status.
|
|
||||||
local sta_exp=$1
|
|
||||||
shift
|
|
||||||
local out_exp=$1
|
|
||||||
shift
|
|
||||||
./calc++ "$@" input >out_eff
|
|
||||||
local sta_eff=$?
|
|
||||||
local out_eff=`cat out_eff`
|
|
||||||
if test $sta_eff -eq $sta_exp; then
|
|
||||||
if test "$out_eff" = "$out_exp"; then
|
|
||||||
printf "$me: PASS: %2d\n" $number
|
|
||||||
else
|
|
||||||
printf "$me: FAIL: %2d (expected output: %s, effective: %s\n" \
|
|
||||||
$number "$out_exp" "$out_eff"
|
|
||||||
exit=false
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "$me: FAIL: %2d (expected status: %d, effective: %d\n" \
|
|
||||||
$number $sta_exp $sta_eff
|
|
||||||
exit=false
|
|
||||||
fi
|
|
||||||
number=`expr $number + 1`
|
|
||||||
}
|
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
a := 1
|
a := 1
|
||||||
b := 2
|
b := 2
|
||||||
@@ -48,32 +12,20 @@ c := 3
|
|||||||
d := a + b * c
|
d := a + b * c
|
||||||
d
|
d
|
||||||
EOF
|
EOF
|
||||||
run 0 7
|
|
||||||
run 0 7 -p
|
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
a := 1
|
|
||||||
b := 2
|
|
||||||
c := 3
|
|
||||||
d := (a + b) * c
|
|
||||||
d
|
|
||||||
EOF
|
|
||||||
run 0 9
|
|
||||||
|
|
||||||
|
./calc++ input
|
||||||
|
./calc++ -p input
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
a := 1
|
a := 1
|
||||||
d := a + b * c
|
d := a + b * c
|
||||||
EOF
|
EOF
|
||||||
run 1 '' input
|
./calc++ input
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
toto := 1
|
toto := 1
|
||||||
toto
|
toto
|
||||||
EOF
|
EOF
|
||||||
run 0 1 -s
|
./calc++ -s input
|
||||||
|
|
||||||
rm input out_eff
|
rm input
|
||||||
$exit
|
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
# Extract all examples from the manual source. -*- AWK -*-
|
# Extract all examples from the manual source. -*- AWK -*-
|
||||||
|
|
||||||
# This file is part of GNU Bison
|
# This file is part of GNU Bison
|
||||||
# Copyright (C) 1992, 2000, 2001, 2005, 2006, 2009 Free Software
|
# Copyright 1992, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
|
||||||
# Foundation, Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
## Copyright (C) 2005, 2008-2009 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/>.
|
|
||||||
|
|
||||||
dist_noinst_SCRIPTS = examples/extexi
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
%skeleton "lalr1.cc"
|
|
||||||
%defines
|
|
||||||
%define parse.assert
|
|
||||||
%define parse.trace
|
|
||||||
%define variant
|
|
||||||
%define lex_symbol
|
|
||||||
%locations
|
|
||||||
|
|
||||||
%code requires // *.hh
|
|
||||||
{
|
|
||||||
#include <list>
|
|
||||||
#include <string>
|
|
||||||
typedef std::list<std::string> strings_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
%code // *.cc
|
|
||||||
{
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
|
||||||
static yy::parser::symbol_type yylex ();
|
|
||||||
|
|
||||||
// Printing a list of strings.
|
|
||||||
// Koening look up will look into std, since that's an std::list.
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
std::ostream&
|
|
||||||
operator<< (std::ostream& o, const strings_type& s)
|
|
||||||
{
|
|
||||||
std::copy (s.begin (), s.end (),
|
|
||||||
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conversion to string.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
string_cast (const T& t)
|
|
||||||
{
|
|
||||||
std::ostringstream o;
|
|
||||||
o << t;
|
|
||||||
return o.str ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%token <::std::string> TEXT;
|
|
||||||
%token <int> NUMBER;
|
|
||||||
%printer { debug_stream () << $$; }
|
|
||||||
<int> <::std::string> <::std::list<std::string>>;
|
|
||||||
%token END_OF_FILE 0;
|
|
||||||
|
|
||||||
%type <::std::string> item;
|
|
||||||
%type <::std::list<std::string>> list;
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
result:
|
|
||||||
list { std::cout << $1 << std::endl; }
|
|
||||||
;
|
|
||||||
|
|
||||||
list:
|
|
||||||
/* nothing */ { /* Generates an empty string list */ }
|
|
||||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
|
||||||
;
|
|
||||||
|
|
||||||
item:
|
|
||||||
TEXT { std::swap ($$, $1); }
|
|
||||||
| NUMBER { $$ = string_cast ($1); }
|
|
||||||
;
|
|
||||||
%%
|
|
||||||
|
|
||||||
// The yylex function providing subsequent tokens:
|
|
||||||
// TEXT "I have three numbers for you:"
|
|
||||||
// NUMBER 1
|
|
||||||
// NUMBER 2
|
|
||||||
// NUMBER 3
|
|
||||||
// TEXT " and that's all!"
|
|
||||||
// END_OF_FILE
|
|
||||||
|
|
||||||
static
|
|
||||||
yy::parser::symbol_type
|
|
||||||
yylex ()
|
|
||||||
{
|
|
||||||
static int stage = -1;
|
|
||||||
++stage;
|
|
||||||
yy::parser::location_type loc(0, stage + 1, stage + 1);
|
|
||||||
switch (stage)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return yy::parser::make_TEXT ("I have three numbers for you.", loc);
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
return yy::parser::make_NUMBER (stage, loc);
|
|
||||||
case 4:
|
|
||||||
return yy::parser::make_TEXT ("And that's all!", loc);
|
|
||||||
default:
|
|
||||||
return yy::parser::make_END_OF_FILE (loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mandatory error function
|
|
||||||
void
|
|
||||||
yy::parser::error (const yy::parser::location_type& loc, const std::string& msg)
|
|
||||||
{
|
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
yy::parser p;
|
|
||||||
p.set_debug_level (!!getenv ("YYDEBUG"));
|
|
||||||
return p.parse ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Local Variables:
|
|
||||||
// mode: C++
|
|
||||||
// End:
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
external: gnulib
|
|
||||||
-1
Submodule gnulib deleted from 3ef64012bf
@@ -4,7 +4,6 @@ Makefile.in
|
|||||||
argmatch.c
|
argmatch.c
|
||||||
argmatch.h
|
argmatch.h
|
||||||
basename.c
|
basename.c
|
||||||
bitrotate.h
|
|
||||||
c-ctype.c
|
c-ctype.c
|
||||||
c-ctype.h
|
c-ctype.h
|
||||||
c-strcase.h
|
c-strcase.h
|
||||||
@@ -18,7 +17,6 @@ configmake.h
|
|||||||
dirname.c
|
dirname.c
|
||||||
dirname.h
|
dirname.h
|
||||||
dup-safer.c
|
dup-safer.c
|
||||||
errno.in.h
|
|
||||||
error.c
|
error.c
|
||||||
error.h
|
error.h
|
||||||
exitfail.c
|
exitfail.c
|
||||||
@@ -31,7 +29,6 @@ getopt.in.h
|
|||||||
getopt1.c
|
getopt1.c
|
||||||
getopt_.h
|
getopt_.h
|
||||||
getopt_int.h
|
getopt_int.h
|
||||||
getpagesize.c
|
|
||||||
gettext.h
|
gettext.h
|
||||||
gnulib.mk
|
gnulib.mk
|
||||||
hash.c
|
hash.c
|
||||||
@@ -43,12 +40,8 @@ inttypes_.h
|
|||||||
localcharset.c
|
localcharset.c
|
||||||
localcharset.h
|
localcharset.h
|
||||||
malloc.c
|
malloc.c
|
||||||
mbrtowc.c
|
|
||||||
mbsinit.c
|
|
||||||
mbswidth.c
|
mbswidth.c
|
||||||
mbswidth.h
|
mbswidth.h
|
||||||
memchr.c
|
|
||||||
memchr.valgrind
|
|
||||||
obstack.c
|
obstack.c
|
||||||
obstack.h
|
obstack.h
|
||||||
pipe-safer.c
|
pipe-safer.c
|
||||||
@@ -64,7 +57,6 @@ stamp-h1
|
|||||||
stdbool.h
|
stdbool.h
|
||||||
stdbool.in.h
|
stdbool.in.h
|
||||||
stdbool_.h
|
stdbool_.h
|
||||||
stddef.in.h
|
|
||||||
stdint.h
|
stdint.h
|
||||||
stdint.in.h
|
stdint.in.h
|
||||||
stdint_.h
|
stdint_.h
|
||||||
@@ -95,7 +87,6 @@ unitypes.h
|
|||||||
uniwidth
|
uniwidth
|
||||||
uniwidth.h
|
uniwidth.h
|
||||||
unlocked-io.h
|
unlocked-io.h
|
||||||
unsetenv.c
|
|
||||||
verify.h
|
verify.h
|
||||||
wchar.h
|
wchar.h
|
||||||
wchar.in.h
|
wchar.in.h
|
||||||
|
|||||||
-115
@@ -1,115 +0,0 @@
|
|||||||
/*.a
|
|
||||||
/*.o
|
|
||||||
/*~
|
|
||||||
/.deps
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/argmatch.c
|
|
||||||
/argmatch.h
|
|
||||||
/basename.c
|
|
||||||
/bitrotate.h
|
|
||||||
/c-ctype.c
|
|
||||||
/c-ctype.h
|
|
||||||
/c-strcase.h
|
|
||||||
/c-strcasecmp.c
|
|
||||||
/c-strncasecmp.c
|
|
||||||
/charset.alias
|
|
||||||
/config.charset
|
|
||||||
/config.h
|
|
||||||
/config.hin
|
|
||||||
/configmake.h
|
|
||||||
/dirname.c
|
|
||||||
/dirname.h
|
|
||||||
/dup-safer.c
|
|
||||||
/errno.in.h
|
|
||||||
/error.c
|
|
||||||
/error.h
|
|
||||||
/exitfail.c
|
|
||||||
/exitfail.h
|
|
||||||
/fd-safer.c
|
|
||||||
/fopen-safer.c
|
|
||||||
/getopt.c
|
|
||||||
/getopt.h
|
|
||||||
/getopt.in.h
|
|
||||||
/getopt1.c
|
|
||||||
/getopt_.h
|
|
||||||
/getopt_int.h
|
|
||||||
/getpagesize.c
|
|
||||||
/gettext.h
|
|
||||||
/gnulib.mk
|
|
||||||
/hash.c
|
|
||||||
/hash.h
|
|
||||||
/intprops.h
|
|
||||||
/inttypes.h
|
|
||||||
/inttypes.in.h
|
|
||||||
/inttypes_.h
|
|
||||||
/localcharset.c
|
|
||||||
/localcharset.h
|
|
||||||
/malloc.c
|
|
||||||
/mbrtowc.c
|
|
||||||
/mbsinit.c
|
|
||||||
/mbswidth.c
|
|
||||||
/mbswidth.h
|
|
||||||
/memchr.c
|
|
||||||
/memchr.valgrind
|
|
||||||
/obstack.c
|
|
||||||
/obstack.h
|
|
||||||
/pipe-safer.c
|
|
||||||
/quote.c
|
|
||||||
/quote.h
|
|
||||||
/quotearg.c
|
|
||||||
/quotearg.h
|
|
||||||
/ref-add.sed
|
|
||||||
/ref-add.sin
|
|
||||||
/ref-del.sed
|
|
||||||
/ref-del.sin
|
|
||||||
/stamp-h1
|
|
||||||
/stdbool.h
|
|
||||||
/stdbool.in.h
|
|
||||||
/stdbool_.h
|
|
||||||
/stddef.in.h
|
|
||||||
/stdint.h
|
|
||||||
/stdint.in.h
|
|
||||||
/stdint_.h
|
|
||||||
/stdio--.h
|
|
||||||
/stdio-safer.h
|
|
||||||
/stdlib.h
|
|
||||||
/stdlib.in.h
|
|
||||||
/stdlib_.h
|
|
||||||
/stpcpy.c
|
|
||||||
/streq.h
|
|
||||||
/strerror.c
|
|
||||||
/string.h
|
|
||||||
/string.in.h
|
|
||||||
/string_.h
|
|
||||||
/stripslash.c
|
|
||||||
/strndup.c
|
|
||||||
/strnlen.c
|
|
||||||
/strtol.c
|
|
||||||
/strtoul.c
|
|
||||||
/strverscmp.c
|
|
||||||
/strverscmp.h
|
|
||||||
/unistd--.h
|
|
||||||
/unistd-safer.h
|
|
||||||
/unistd.h
|
|
||||||
/unistd.in.h
|
|
||||||
/unistd_.h
|
|
||||||
/unitypes.h
|
|
||||||
/uniwidth
|
|
||||||
/uniwidth.h
|
|
||||||
/unlocked-io.h
|
|
||||||
/unsetenv.c
|
|
||||||
/verify.h
|
|
||||||
/wchar.h
|
|
||||||
/wchar.in.h
|
|
||||||
/wchar_.h
|
|
||||||
/wctype.h
|
|
||||||
/wctype.in.h
|
|
||||||
/wctype_.h
|
|
||||||
/wcwidth.c
|
|
||||||
/wcwidth.h
|
|
||||||
/xalloc-die.c
|
|
||||||
/xalloc.h
|
|
||||||
/xmalloc.c
|
|
||||||
/xstrndup.c
|
|
||||||
/xstrndup.h
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Make bison/lib.
|
||||||
|
|
||||||
|
# Copyright (C) 2001, 2002, 2003, 2004, 2006 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 gnulib.mk
|
||||||
|
|
||||||
|
AM_CFLAGS = $(WARNING_CFLAGS)
|
||||||
|
|
||||||
|
# Implementation of bitsets.
|
||||||
|
bitsets_sources = \
|
||||||
|
abitset.c abitset.h bbitset.h bitset.c bitset.h bitset_stats.c \
|
||||||
|
bitset_stats.h bitsetv.c bitsetv.h ebitset.c ebitset.h lbitset.c \
|
||||||
|
lbitset.h libiberty.h vbitset.c vbitset.h
|
||||||
|
|
||||||
|
# Additional bitset operations.
|
||||||
|
additional_bitsets_sources = \
|
||||||
|
bitsetv-print.h bitsetv-print.c
|
||||||
|
|
||||||
|
# timevars, stolen from GCC.
|
||||||
|
timevars_sources = \
|
||||||
|
timevar.h timevar.c timevar.def
|
||||||
|
|
||||||
|
# Non-gnulib sources in Bison's internal library.
|
||||||
|
libbison_a_SOURCES += \
|
||||||
|
get-errno.h get-errno.c \
|
||||||
|
subpipe.h subpipe.c \
|
||||||
|
$(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)
|
||||||
|
|
||||||
|
# The Yacc compatibility library.
|
||||||
|
lib_LIBRARIES = $(YACC_LIBRARY)
|
||||||
|
EXTRA_LIBRARIES = liby.a
|
||||||
|
liby_a_SOURCES = main.c yyerror.c
|
||||||
+15
-10
@@ -1,10 +1,10 @@
|
|||||||
/* Array bitsets.
|
/* Array bitsets.
|
||||||
Copyright (C) 2002, 2003, 2006, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
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 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -13,9 +13,13 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -30,13 +34,14 @@
|
|||||||
|
|
||||||
|
|
||||||
static bitset_bindex
|
static bitset_bindex
|
||||||
abitset_resize (bitset src, bitset_bindex size)
|
abitset_resize (bitset src ATTRIBUTE_UNUSED,
|
||||||
|
bitset_bindex size ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
/* These bitsets have a fixed size. */
|
if (BITSET_SIZE_ (src) == size)
|
||||||
if (BITSET_SIZE_ (src) != size)
|
return size;
|
||||||
abort ();
|
|
||||||
|
|
||||||
return size;
|
/* These bitsets have a fixed size. */
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find list of up to NUM bits set in BSET starting from and including
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
|
|||||||
+14
-13
@@ -1,27 +1,28 @@
|
|||||||
/* Functions to support abitsets.
|
/* Functions to support abitsets.
|
||||||
Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
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 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _ABITSET_H
|
#ifndef _ABITSET_H
|
||||||
#define _ABITSET_H
|
#define _ABITSET_H
|
||||||
|
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
extern size_t abitset_bytes (bitset_bindex);
|
extern size_t abitset_bytes PARAMS ((bitset_bindex));
|
||||||
|
|
||||||
extern bitset abitset_init (bitset, bitset_bindex);
|
extern bitset abitset_init PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+65
-63
@@ -1,29 +1,30 @@
|
|||||||
/* Base bitset stuff.
|
/* Base bitset stuff.
|
||||||
Copyright (C) 2002, 2003, 2004, 2006, 2009 Free Software Foundation,
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
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 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _BBITSET_H
|
#ifndef _BBITSET_H
|
||||||
#define _BBITSET_H
|
#define _BBITSET_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/* Currently we support five flavours of bitsets:
|
/* Currently we support five flavours of bitsets:
|
||||||
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
|
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
|
||||||
@@ -48,8 +49,8 @@ extern const char * const bitset_type_names[];
|
|||||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
||||||
|
|
||||||
/* Data type used to store a word of bits. */
|
/* Data type used to store a word of bits. */
|
||||||
typedef unsigned long int bitset_word;
|
typedef unsigned long bitset_word;
|
||||||
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
|
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
||||||
|
|
||||||
/* Bit index. In theory we might need a type wider than size_t, but
|
/* Bit index. In theory we might need a type wider than size_t, but
|
||||||
in practice we lose at most a factor of CHAR_BIT by going with
|
in practice we lose at most a factor of CHAR_BIT by going with
|
||||||
@@ -111,45 +112,46 @@ typedef union bitset_union *bitset;
|
|||||||
/* The contents of this structure should be considered private. */
|
/* The contents of this structure should be considered private. */
|
||||||
struct bitset_vtable
|
struct bitset_vtable
|
||||||
{
|
{
|
||||||
void (*set) (bitset, bitset_bindex);
|
void (*set) PARAMS ((bitset, bitset_bindex));
|
||||||
void (*reset) (bitset, bitset_bindex);
|
void (*reset) PARAMS ((bitset, bitset_bindex));
|
||||||
bool (*toggle) (bitset, bitset_bindex);
|
bool (*toggle) PARAMS ((bitset, bitset_bindex));
|
||||||
bool (*test) (bitset, bitset_bindex);
|
bool (*test) PARAMS ((bitset, bitset_bindex));
|
||||||
bitset_bindex (*resize) (bitset, bitset_bindex);
|
bitset_bindex (*resize) PARAMS ((bitset, bitset_bindex));
|
||||||
bitset_bindex (*size) (bitset);
|
bitset_bindex (*size) PARAMS ((bitset));
|
||||||
bitset_bindex (*count) (bitset);
|
bitset_bindex (*count) PARAMS ((bitset));
|
||||||
|
|
||||||
bool (*empty_p) (bitset);
|
bool (*empty_p) PARAMS ((bitset));
|
||||||
void (*ones) (bitset);
|
void (*ones) PARAMS ((bitset));
|
||||||
void (*zero) (bitset);
|
void (*zero) PARAMS ((bitset));
|
||||||
|
|
||||||
void (*copy) (bitset, bitset);
|
void (*copy) PARAMS ((bitset, bitset));
|
||||||
bool (*disjoint_p) (bitset, bitset);
|
bool (*disjoint_p) PARAMS ((bitset, bitset));
|
||||||
bool (*equal_p) (bitset, bitset);
|
bool (*equal_p) PARAMS ((bitset, bitset));
|
||||||
void (*not_) (bitset, bitset);
|
void (*not) PARAMS ((bitset, bitset));
|
||||||
bool (*subset_p) (bitset, bitset);
|
bool (*subset_p) PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
void (*and_) (bitset, bitset, bitset);
|
void (*and) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*and_cmp) (bitset, bitset, bitset);
|
bool (*and_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
void (*andn) (bitset, bitset, bitset);
|
void (*andn) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*andn_cmp) (bitset, bitset, bitset);
|
bool (*andn_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
void (*or_) (bitset, bitset, bitset);
|
void (*or) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*or_cmp) (bitset, bitset, bitset);
|
bool (*or_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
void (*xor_) (bitset, bitset, bitset);
|
void (*xor) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*xor_cmp) (bitset, bitset, bitset);
|
bool (*xor_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
|
|
||||||
void (*and_or) (bitset, bitset, bitset, bitset);
|
void (*and_or) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
bool (*and_or_cmp) (bitset, bitset, bitset, bitset);
|
bool (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
void (*andn_or) (bitset, bitset, bitset, bitset);
|
void (*andn_or) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
bool (*andn_or_cmp) (bitset, bitset, bitset, bitset);
|
bool (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
void (*or_and) (bitset, bitset, bitset, bitset);
|
void (*or_and) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
bool (*or_and_cmp) (bitset, bitset, bitset, bitset);
|
bool (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex,
|
bitset_bindex (*list) PARAMS ((bitset, bitset_bindex *,
|
||||||
bitset_bindex *);
|
bitset_bindex, bitset_bindex *));
|
||||||
bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex,
|
bitset_bindex (*list_reverse) PARAMS ((bitset,
|
||||||
bitset_bindex *);
|
bitset_bindex *, bitset_bindex,
|
||||||
void (*free) (bitset);
|
bitset_bindex *));
|
||||||
|
void (*free) PARAMS ((bitset));
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -218,14 +220,14 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
|
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
|
||||||
|
|
||||||
/* DST = ~SRC. */
|
/* DST = ~SRC. */
|
||||||
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
|
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not (DST, SRC)
|
||||||
|
|
||||||
/* Return DST == DST | SRC. */
|
/* Return DST == DST | SRC. */
|
||||||
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
|
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
|
||||||
|
|
||||||
|
|
||||||
/* DST = SRC1 & SRC2. */
|
/* DST = SRC1 & SRC2. */
|
||||||
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
|
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and (DST, SRC1, SRC2)
|
||||||
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
|
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 & ~SRC2. */
|
/* DST = SRC1 & ~SRC2. */
|
||||||
@@ -233,11 +235,11 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
|
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 | SRC2. */
|
/* DST = SRC1 | SRC2. */
|
||||||
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
|
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or (DST, SRC1, SRC2)
|
||||||
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
|
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 ^ SRC2. */
|
/* DST = SRC1 ^ SRC2. */
|
||||||
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
|
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor (DST, SRC1, SRC2)
|
||||||
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
|
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
|
||||||
@@ -279,24 +281,24 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
|
|
||||||
/* Private functions for bitset implementations. */
|
/* Private functions for bitset implementations. */
|
||||||
|
|
||||||
extern bool bitset_toggle_ (bitset, bitset_bindex);
|
extern bool bitset_toggle_ PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
extern bitset_bindex bitset_count_ (bitset);
|
extern bitset_bindex bitset_count_ PARAMS ((bitset));
|
||||||
|
|
||||||
extern bitset_bindex bitset_size_ (bitset);
|
extern bitset_bindex bitset_size_ PARAMS ((bitset));
|
||||||
|
|
||||||
extern bool bitset_copy_ (bitset, bitset);
|
extern bool bitset_copy_ PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
extern void bitset_and_or_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
extern void bitset_andn_or_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
extern void bitset_or_and_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
#endif /* _BBITSET_H */
|
#endif /* _BBITSET_H */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user