Compare commits

..
8 Commits
Author SHA1 Message Date
Valentin Tolmer c8c9212bbd news: new syntax (%gprec and %precr) 2013-08-01 15:56:00 +02:00
Valentin Tolmer d992a222af regen 2013-08-01 15:56:00 +02:00
Valentin Tolmer 86a2a43854 tests: new tests for %gprec and %precr
3 grammars: one typical, with normal test cases, one to display all the
warnings introduced, and one with the errors introduced.

* tests/conflicts.at: New
2013-08-01 15:24:52 +02:00
Valentin Tolmer d8de391c38 syntax: introducing %precr to add specific precedence relations
It is now possible to add specific precedence relations between two symbols,
or a symbol and a group, with the %precr keyword:

%gprec arith {
  %left '+' '-'
  %left '*' '/'
}
%gprec boolean {
  %left OR
  %left AND
}
%right '^'

%precr '^' > arith
%precr OR AND > '^'

Here, the symbol ^ is of higher priority than the the ones in arith, but of
lower priority than both OR and AND. OR and '+', for example, cannot be
compared.

* src/parse-gram.y, src/scan-gram.l: Lexer and grammar implementation of
%precr.
* src/symtab.c, src/symtab.h: implementation of the addition of single link
precedence relationships.
2013-08-01 15:24:52 +02:00
Valentin Tolmer f8a710c6f4 syntax: introducing %gprec for precedence groups
It is now possible to introduce precedence groups, with precedence
relationships inside the group, but not with the outside tokens.  Ex:

%gprec arith {
  %left '+' '-'
  %left '*' '/'
  %right '^'
}

%gprec {
  %left OR
  %left AND
}

%left OTHER
%precedence OTHER2

Here, the arithmetical operators (in the "arith" group) can be compared, the
boolean operators can be compared, but OTHER can only be compared to OTHER2.

* src/gram.c, src/gram.h, src/scan-gram.l, src/parse-gram.y: {} blocks after
%gprec are understood by the lexer
* src/parse-gram.y: New syntax
* tests/input.at, tests/regression.at: Fix due to lexer change
2013-08-01 15:24:52 +02:00
Valentin Tolmer 2d8fc07778 conflicts: switch to partial order precedence system
Even though it is not yet fully deployed, this commit lays the ground for
the partial order precedence system, by changing to a graph-based order and
introducing precedence groups (only the default one can be used for now).

* src/symtab.h (struct symbol): Removed extra fields
* src/symtab.h: New function declarations
* src/symtab.c: New functions for precedence and groups, new hash table for
groups
* src/AnnotationList.c, src/conflicts.c, src/gram.c, src/print-xml.c,
* src/symtab.c: Adaptation to the new prec_node structure
* tests/existing.at (GAWK LALR): Fix
2013-08-01 15:24:52 +02:00
Valentin Tolmer a910d26cfb introduction of the new structures to prepare for partial order precedence
New structures: symgroup, prec_link, prec_node, and an enum of the
precedence relation operators.  Symbols have two more fields to prepare for
the precedence graph and grouping to come.

* src/symtab.h (struct symbol): Two new fields
* src/symtab.h: New structures
2013-08-01 15:24:52 +02:00
Valentin TolmerandAkim Demaille a728075710 symbols: improve symbol aliasing
Rather than having duplicate info in the symbol and the alias that has
to be resolved later on, both the symbol and the alias have a common
pointer to a separate structure containing this info.

* src/symtab.h (sym_content): New structure.
* src/symtab.c (sym_content_new, sym_content_free, symbol_free): New

* src/AnnotationList.c, src/conflicts.c, src/gram.c, src/gram.h,
* src/graphviz.c, src/ielr.c, src/output.c, src/parse-gram.y, src/print.c
* src/print-xml.c, src/print_graph.c, src/reader.c, src/reduce.c,
* src/state.h, src/symlist.c, src/symtab.c, src/symtab.h, src/tables.c:
Adjust.

* tests/input.at: Fix expectations (order changes).
2013-08-01 12:49:51 +02:00
216 changed files with 4724 additions and 5296 deletions
+1 -10
View File
@@ -1,16 +1,7 @@
*.eps
*.log
*.o
*.pdf
*.png
*.stamp
*.trs
*~
.deps
.dirstamp
/*.cache /*.cache
/*.flc /*.flc
/*.prj /*.prj
/*~
/.tarball-version /.tarball-version
/.version /.version
/ABOUT-NLS /ABOUT-NLS
+1 -1
View File
@@ -1 +1 @@
3.0.4 3.0
+1 -1
View File
@@ -24,7 +24,7 @@ and nasty bugs.
----- -----
Copyright (C) 1998-2015, 2018 Free Software Foundation, Inc. Copyright (C) 1998-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -26733,8 +26733,8 @@
----- -----
Copyright (C) 1987-1988, 1991-2015, 2018 Free Software Copyright (C) 1987-1988, 1991-2013 Free Software Foundation,
Foundation, Inc. Inc.
Copying and distribution of this file, with or without Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice and this modification, are permitted provided the copyright notice and this
+5 -8
View File
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2001-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -24,10 +24,8 @@ SUBDIRS = po runtime-po .
aclocaldir = @aclocaldir@ aclocaldir = @aclocaldir@
aclocal_DATA = m4/bison-i18n.m4 aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \ EXTRA_DIST = .prev-version .version \
ChangeLog-1998 ChangeLog-2012 ChangeLog cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
## Running the bison from this tarball. To generate our own parser, ## Running the bison from this tarball. To generate our own parser,
## but also to run the tests. Of course, you ought to keep a sane ## but also to run the tests. Of course, you ought to keep a sane
@@ -39,9 +37,8 @@ AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
# Initialization before completion by local.mk's. # Initialization before completion by local.mk's.
AM_CFLAGS = $(WARN_CFLAGS) AM_CFLAGS = $(WARN_CFLAGS)
# Find builddir/src/scan-code.c etc. For some reason "-I./lib" # Find builddir/src/scan-code.c etc.
# instead of "-Ilib" avoids infinite recursions on #include_next. AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
BUILT_SOURCES = BUILT_SOURCES =
CLEANFILES = CLEANFILES =
DISTCLEANFILES = DISTCLEANFILES =
+23 -147
View File
@@ -1,157 +1,33 @@
GNU Bison NEWS GNU Bison NEWS
* Noteworthy changes in release 3.0.5 (2018-05-27) [stable] * Noteworthy changes in release ?.? (????-??-??) [?]
** Bug fixes ** New syntax: partial-order precedence relationships
*** C++: Fix support of 'syntax_error' Formerly, the precedence order of tokens was linear, depending only on the
order in which they were declared. With the new syntax, all the tokens are
not necessarily comparable. It is possible to declare a group of tokens with
no links outside of the group, and to later on add only those needed.
The uncomparability of tokens would allow for more feedback on new conflicts
silently resolved via precedence.
One incorrect 'inline' resulted in linking errors about the constructor of An example of the new syntax applied to arithmetic and boolean operators,
the syntax_error exception. with '^' serving as both numerical power and boolean XOR:
*** C++: Fix warnings %gprec arith {
%left '+' '-'
%left '*' '/'
}
%gprec bool {
%left OR
%left AND
}
%gprec { %right '^' }
GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference %precr '^' > arith
warnings about yyformat being possibly null. It also warned about the %precr OR AND > '^'
deprecated implicit definition of copy constructors when there's a
user-defined (copy) assignment operator.
*** Location of errors Here, AND is not comparable with '+', but '^' > '+' and AND > '^'
In C++ parsers, out-of-bounds errors can happen when a rule with an empty
ride-hand side raises a syntax error. The behavior of the default parser
(yacc.c) in such a condition was undefined.
Now all the parsers match the behavior of glr.c: @$ is used as the
location of the error. This handles gracefully rules with and without
rhs.
*** Portability fixes in the test suite
On some platforms, some Java and/or C++ tests were failing.
* Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
** Bug fixes
*** C++ with Variants (lalr1.cc)
Fix a compiler warning when no %destructor use $$.
*** Test suites
Several portability issues in tests were fixed.
* Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
** Bug fixes
*** C++ with Variants (lalr1.cc)
Problems with %destructor and '%define parse.assert' have been fixed.
*** Named %union support (yacc.c, glr.c)
Bison 3.0 introduced a regression on named %union such as
%union foo { int ival; };
The possibility to use a name was introduced "for Yacc compatibility".
It is however not required by POSIX Yacc, and its usefulness is not clear.
*** %define api.value.type union with %defines (yacc.c, glr.c)
The C parsers were broken when %defines was used together with "%define
api.value.type union".
*** Redeclarations are reported in proper order
On
%token FOO "foo"
%printer {} "foo"
%printer {} FOO
bison used to report:
/tmp/foo.yy:2.10-11: error: %printer redeclaration for FOO
%printer {} "foo"
^^
/tmp/foo.yy:3.10-11: previous declaration
%printer {} FOO
^^
Now, the "previous" declaration is always the first one.
** Documentation
Bison now installs various files in its docdir (which defaults to
'/usr/local/share/doc/bison'), including the three fully blown examples
extracted from the documentation:
- rpcalc
Reverse Polish Calculator, a simple introductory example.
- mfcalc
Multi-function Calc, a calculator with memory and functions and located
error messages.
- calc++
a calculator in C++ using variant support and token constructors.
* Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
** Bug fixes
*** Generated source files when errors are reported
When warnings are issued and -Werror is set, bison would still generate
the source files (*.c, *.h...). As a consequence, some runs of "make"
could fail the first time, but not the second (as the files were generated
anyway).
This is fixed: bison no longer generates this source files, but, of
course, still produces the various reports (*.output, *.xml, etc.).
*** %empty is used in reports
Empty right-hand sides are denoted by '%empty' in all the reports (text,
dot, XML and formats derived from it).
*** YYERROR and variants
When C++ variant support is enabled, an error triggered via YYERROR, but
not caught via error recovery, resulted in a double deletion.
* Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
** Bug fixes
*** Errors in caret diagnostics
On some platforms, some errors could result in endless diagnostics.
*** Fixes of the -Werror option
Options such as "-Werror -Wno-error=foo" were still turning "foo"
diagnostics into errors instead of warnings. This is fixed.
Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
leaves "foo" diagnostics as warnings. Similarly, with "-Werror=foo
-Wno-error", "foo" diagnostics are now errors.
*** GLR Predicates
As demonstrated in the documentation, one can now leave spaces between
"%?" and its "{".
*** Installation
The yacc.1 man page is no longer installed if --disable-yacc was
specified.
*** Fixes in the test suite
Bugs and portability issues.
* Noteworthy changes in release 3.0 (2013-07-25) [stable] * Noteworthy changes in release 3.0 (2013-07-25) [stable]
@@ -2778,7 +2654,7 @@ Output file does not redefine const for C++.
----- -----
Copyright (C) 1995-2015, 2018 Free Software Foundation, Inc. Copyright (C) 1995-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Parser Generator. This file is part of Bison, the GNU Parser Generator.
+1 -1
View File
@@ -36,7 +36,7 @@ to the bison package.
----- -----
Copyright (C) 2002, 2005, 2009-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -44,7 +44,7 @@ End:
----- -----
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2013 Free Software
Foundation, Inc. Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -12,7 +12,7 @@ the problems you encounter.
----- -----
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+98 -106
View File
@@ -9,19 +9,19 @@ Everything related to the development of Bison is on Savannah:
* Administrivia * Administrivia
** If you incorporate a change from somebody on the net: ** If you incorporate a change from somebody on the net:
First, if it is a large change, you must make sure they have signed the First, if it is a large change, you must make sure they have signed
appropriate paperwork. Second, be sure to add their name and email address the appropriate paperwork. Second, be sure to add their name and
to THANKS. email address to THANKS.
** If a change fixes a test, mention the test in the commit message. ** If a change fixes a test, mention the test in the commit message.
** Bug reports ** Bug reports
If somebody reports a new bug, mention his name in the commit message and in If somebody reports a new bug, mention his name in the commit message
the test case you write. Put him into THANKS. and in the test case you write. Put him into THANKS.
The correct response to most actual bugs is to write a new test case which The correct response to most actual bugs is to write a new test case
demonstrates the bug. Then fix the bug, re-run the test suite, and check which demonstrates the bug. Then fix the bug, re-run the test suite,
everything in. and check everything in.
* Hacking * Hacking
@@ -30,17 +30,17 @@ everything in.
Which include serious bug fixes, must be mentioned in NEWS. Which include serious bug fixes, must be mentioned in NEWS.
** Translations ** Translations
Only user visible strings are to be translated: error messages, bits of the Only user visible strings are to be translated: error messages, bits
.output file etc. This excludes impossible error messages (comparable to of the .output file etc. This excludes impossible error messages
assert/abort), and all the --trace output which is meant for the maintainers (comparable to assert/abort), and all the --trace output which is
only. meant for the maintainers only.
** Horizontal tabs ** Horizontal tabs
Do not add horizontal tab characters to any file in Bison's repository Do not add horizontal tab characters to any file in Bison's repository
except where required. For example, do not use tabs to format C code. except where required. For example, do not use tabs to format C code.
However, make files, ChangeLog, and some regular expressions require tabs. However, make files, ChangeLog, and some regular expressions require
Also, test cases might need to contain tabs to check that Bison properly tabs. Also, test cases might need to contain tabs to check that Bison
processes tabs in its input. properly processes tabs in its input.
* Working from the repository * Working from the repository
@@ -62,22 +62,13 @@ tools we depend upon, including:
- Gettext <http://www.gnu.org/software/gettext/> - Gettext <http://www.gnu.org/software/gettext/>
- Graphviz <http://www.graphviz.org> - Graphviz <http://www.graphviz.org>
- Gzip <http://www.gnu.org/software/gzip/> - Gzip <http://www.gnu.org/software/gzip/>
- Help2man <http://www.gnu.org/software/help2man/>
- Perl <http://www.cpan.org/> - Perl <http://www.cpan.org/>
- Rsync <http://samba.anu.edu.au/rsync/> - Rsync <http://samba.anu.edu.au/rsync/>
- Tar <http://www.gnu.org/software/tar/> - Tar <http://www.gnu.org/software/tar/>
- Texinfo <http://www.gnu.org/software/texinfo/>
Valgrind <http://valgrind.org/> is also highly recommended, if it supports Valgrind <http://valgrind.org/> is also highly recommended, if it supports
your architecture. your architecture.
If you're using a GNU/Linux distribution, the easiest way to install the
above packages depends on your system. The following shell command should
work for Debian-based systems such as Ubuntu:
sudo apt-get install \
autoconf automake autopoint flex graphviz help2man texinfo valgrind
Bison is written using Bison grammars, so there are bootstrapping issues. Bison is written using Bison grammars, so there are bootstrapping issues.
The bootstrap script attempts to discover when the C code generated from the The bootstrap script attempts to discover when the C code generated from the
grammars is out of date, and to bootstrap with an out-of-date version of the grammars is out of date, and to bootstrap with an out-of-date version of the
@@ -103,19 +94,15 @@ to perform the first checkout of the submodules, run
$ git submodule update --init $ git submodule update --init
Git submodule support is weak before versions 1.6 and later, you
should probably upgrade Git if your version is older.
The next step is to get other files needed to build, which are The next step is to get other files needed to build, which are
extracted from other source packages: extracted from other source packages:
$ ./bootstrap $ ./bootstrap
Bootstrapping updates the submodules to the versions registered in the And there you are! Just
top-level directory. To change gnulib, first check out the version you want
in `gnulib`, then commit this change in Bison's repository, and finally run
bootstrap.
If it fails with missing symbols (e.g., "error: possibly undefined macro:
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
initialization part. Otherwise, there you are! Just
$ ./configure $ ./configure
$ make $ make
@@ -139,12 +126,13 @@ explicitly by the user.
*** Updating Bison *** Updating Bison
If you pull a newer version of a branch, say via "git pull", you might If you pull a newer version of a branch, say via "git pull", you might
import requests for updated submodules. A simple "git diff" will reveal if import requests for updated submodules. A simple "git diff" will
the current version of the submodule (i.e., the actual contents of the reveal if the current version of the submodule (i.e., the actual
gnulib directory) and the current request from the subscriber (i.e., the contents of the gnulib directory) and the current request from the
reference of the version of gnulib that the Bison repository requests) subscriber (i.e., the reference of the version of gnulib that the
differ. To upgrade the submodules (i.e., to check out the version that is Bison repository requests) differ. To upgrade the submodules (i.e.,
actually requested by the subscriber, run "git submodule update". to check out the version that is actually requested by the subscriber,
run "git submodule update".
$ git pull $ git pull
$ git submodule update $ git submodule update
@@ -168,8 +156,8 @@ Register your changes.
$ git checkin ... $ git checkin ...
For a suggestion of what gnulib commit might be stable enough for a formal For a suggestion of what gnulib commit might be stable enough for a
release, see the ChangeLog in the latest gnulib snapshot at: formal release, see the ChangeLog in the latest gnulib snapshot at:
http://erislabs.net/ianb/projects/gnulib/ http://erislabs.net/ianb/projects/gnulib/
@@ -179,9 +167,9 @@ The Autoconf files we use are currently:
lib/m4sugar/m4sugar.m4 lib/m4sugar/m4sugar.m4
lib/m4sugar/foreach.m4 lib/m4sugar/foreach.m4
These files don't change very often in Autoconf, so it should be relatively These files don't change very often in Autoconf, so it should be
straight-forward to examine the differences in order to decide whether to relatively straight-forward to examine the differences in order to
update. decide whether to update.
* Test suite * Test suite
@@ -244,99 +232,102 @@ suite. So currently, do not try to run valgrind on Mac OS X.
Try to run the test suite with more severe conditions before a Try to run the test suite with more severe conditions before a
release: release:
- Configure the package with --enable-gcc-warnings, so that one checks that - Configure the package with --enable-gcc-warnings, so that one checks
1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too. that 1. Bison compiles cleanly, 2. the parsers it produces compile
cleanly too.
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that - Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules
can fix portability issues. See if you really want to pay attention to that can fix portability issues. See if you really want to pay
its warnings; there's no need to obey blindly to it attention to its warnings; there's no need to obey blindly to it
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>). (<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
- Check with "make syntax-check" if there are issues diagnosed by gnulib. - Check with "make syntax-check" if there are issues diagnosed by
gnulib.
- run "make maintainer-check" which: - run "make maintainer-check" which:
- runs "valgrind -q bison" to run Bison under Valgrind. - runs "valgrind -q bison" to run Bison under Valgrind.
- runs the parsers under Valgrind. - runs the parsers under Valgrind.
- runs the test suite with G++ as C compiler... - runs the test suite with G++ as C compiler...
- run "make maintainer-push-check", which runs "make maintainer-check" while - run "make maintainer-push-check", which runs "make maintainer-check"
activating the push implementation and its pull interface wrappers in many while activating the push implementation and its pull interface wrappers
test cases that were originally written to exercise only the pull in many test cases that were originally written to exercise only the
implementation. This makes certain the push implementation can perform pull implementation. This makes certain the push implementation can
every task the pull implementation can. perform every task the pull implementation can.
- run "make maintainer-xml-check", which runs "make maintainer-check" while - run "make maintainer-xml-check", which runs "make maintainer-check"
checking Bison's XML automaton report for every working grammar passed to while checking Bison's XML automaton report for every working grammar
Bison in the test suite. The check just diffs the output of Bison's passed to Bison in the test suite. The check just diffs the output of
included XSLT style sheets with the output of --report=all and --graph. Bison's included XSLT style sheets with the output of --report=all and
--graph.
- running "make maintainer-release-check" takes care of running - running "make maintainer-release-check" takes care of running
maintainer-check, maintainer-push-check and maintainer-xml-check. maintainer-check, maintainer-push-check and maintainer-xml-check.
- Change tests/atlocal/CFLAGS to add your preferred options. For instance, - Change tests/atlocal/CFLAGS to add your preferred options. For
"-traditional" to check that the parsers are K&R. Note that it does not instance, "-traditional" to check that the parsers are K&R. Note
make sense for glr.c, which should be ANSI, but currently is actually GNU that it does not make sense for glr.c, which should be ANSI, but
C, nor for lalr1.cc. currently is actually GNU C, nor for lalr1.cc.
- Test with a very recent version of GCC for both C and C++. Testing with - Test with a very recent version of GCC for both C and C++. Testing
older versions that are still in use is nice too. with older versions that are still in use is nice too.
* Release Procedure * Release Procedure
This section needs to be updated to take into account features from gnulib. This section needs to be updated to take into account features from
In particular, be sure to read README-release. gnulib. In particular, be sure to read README-release.
** Update the submodules. See above. ** Update the submodules. See above.
** Update maintainer tools, such as Autoconf. See above. ** Update maintainer tools, such as Autoconf. See above.
** Try to get the *.pot files to the Translation Project at least one ** Try to get the *.pot files to the Translation Project at least one
week before a stable release, to give them time to translate them. Before week before a stable release, to give them time to translate them.
generating the *.pot files, make sure that po/POTFILES.in and Before generating the *.pot files, make sure that po/POTFILES.in and
runtime-po/POTFILES.in list all files with translatable strings. This runtime-po/POTFILES.in list all files with translatable strings.
helps: grep -l '\<_(' * This helps: grep -l '\<_(' *
** Tests ** Tests
See above. See above.
** Update the foreign files ** Update the foreign files
Running "./bootstrap" in the top level should update them all for you. This Running "./bootstrap" in the top level should update them all for you.
covers PO files too. Sometimes a PO file contains problems that causes it This covers PO files too. Sometimes a PO file contains problems that
to be rejected by recent Gettext releases; please report these to the causes it to be rejected by recent Gettext releases; please report
Translation Project. these to the Translation Project.
** Update README ** Update README
Make sure the information in README is current. Most notably, make sure it Make sure the information in README is current. Most notably, make sure
recommends a version of GNU M4 that is compatible with the latest Bison it recommends a version of GNU M4 that is compatible with the latest
sources. Bison sources.
** Check copyright years. ** Check copyright years.
We update years in copyright statements throughout Bison once at the start We update years in copyright statements throughout Bison once at the
of every year by running "make update-copyright". However, before a start of every year by running "make update-copyright". However, before
release, it's good to verify that it's actually been run. Besides the a release, it's good to verify that it's actually been run. Besides the
copyright statement for each Bison file, check the copyright statements that copyright statement for each Bison file, check the copyright statements
the skeletons insert into generated parsers, and check all occurrences of that the skeletons insert into generated parsers, and check all
PACKAGE_COPYRIGHT_YEAR in configure.ac. occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
** Update NEWS, commit and tag. ** Update NEWS, commit and tag.
See do-release-commit-and-tag in README-release. For a while, we used beta See do-release-commit-and-tag in README-release. For a while, we used
names such as "2.6_rc1". Now that we use gnulib in the release procedure, beta names such as "2.6_rc1". Now that we use gnulib in the release
we must use "2.5.90", which has the additional benefit of being properly procedure, we must use "2.5.90", which has the additional benefit of
sorted in "git tag -l". being properly sorted in "git tag -l".
** make alpha, beta, or stable ** make alpha, beta, or stable
See README-release. See README-release.
** Upload ** Upload
There are two ways to upload the tarballs to the GNU servers: using gnupload There are two ways to upload the tarballs to the GNU servers: using
(from gnulib), or by hand. Obviously prefer the former. But in either gnupload (from gnulib), or by hand. Obviously prefer the former. But
case, be sure to read the following paragraph. in either case, be sure to read the following paragraph.
*** Setup *** Setup
You need "gnupg". You need "gnupg".
Make sure your public key has been uploaded at least to keys.gnupg.net. You Make sure your public key has been uploaded at least to
can upload it with: keys.gnupg.net. You can upload it with:
gpg --keyserver keys.gnupg.net --send-keys F125BDF3 gpg --keyserver keys.gnupg.net --send-keys F125BDF3
@@ -345,8 +336,8 @@ where F125BDF3 should be replaced with your key ID.
*** Using gnupload *** Using gnupload
You need "ncftp". You need "ncftp".
At the end "make stable" (or alpha/beta) will display the procedure to run. At the end "make stable" (or alpha/beta) will display the procedure to
Just copy and paste it in your shell. run. Just copy and paste it in your shell.
*** By hand *** By hand
@@ -408,9 +399,9 @@ sections that have been removed or renamed):
$ ls -lt $ ls -lt
Remove these files and commit their removal to CVS. For each of these Remove these files and commit their removal to CVS. For each of these
files, add a line to the file .symlinks. This will ensure that hyperlinks files, add a line to the file .symlinks. This will ensure that
to the removed files will redirect to the entire manual; this is better than hyperlinks to the removed files will redirect to the entire manual; this
a 404 error. is better than a 404 error.
There is a problem with 'index.html' being written twice (once for POSIX There is a problem with 'index.html' being written twice (once for POSIX
function 'index', once for the table of contents); you can ignore this function 'index', once for the table of contents); you can ignore this
@@ -429,18 +420,19 @@ Complete/fix the announcement file. The generated list of recipients
([email protected], [email protected], [email protected], ([email protected], [email protected], [email protected],
[email protected], and [email protected]) is [email protected], and [email protected]) is
appropriate for a stable release or a "serious beta". For any other appropriate for a stable release or a "serious beta". For any other
release, drop at least [email protected]. For an example of how to fill out release, drop at least [email protected]. For an example of how to
the rest of the template, search the mailing list archives for the most fill out the rest of the template, search the mailing list archives
recent release announcement. for the most recent release announcement.
For a stable release, send the same announcement on the comp.compilers For a stable release, send the same announcement on the comp.compilers
newsgroup by sending email to [email protected]. Do not make any Cc as the newsgroup by sending email to [email protected]. Do not make any Cc as
moderator will throw away anything cross-posted or Cc'ed. It really needs the moderator will throw away anything cross-posted or Cc'ed. It really
to be a separate message. needs to be a separate message.
** Prepare NEWS ** Prepare NEWS
So that developers don't accidentally add new items to the old NEWS entry, So that developers don't accidentally add new items to the old NEWS
create a new empty entry in line 3 (without the two leading spaces): entry, create a new empty entry in line 3 (without the two leading
spaces):
* Noteworthy changes in release ?.? (????-??-??) [?] * Noteworthy changes in release ?.? (????-??-??) [?]
@@ -448,7 +440,7 @@ Push these changes.
----- -----
Copyright (C) 2002-2005, 2007-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+3 -26
View File
@@ -1,8 +1,7 @@
Bison was originally written by Robert Corbett. It would not be what Bison was originally written by Robert Corbett. It would not be what
it is today without the invaluable help of these people: it is today without the invaluable help of these people:
Aaro Koskinen [email protected] Аскар Сафин [email protected]
Аскар Сафин [email protected]
Airy Andre [email protected] Airy Andre [email protected]
Akim Demaille [email protected] Akim Demaille [email protected]
Albert Chin-A-Young [email protected] Albert Chin-A-Young [email protected]
@@ -12,14 +11,11 @@ Andreas Schwab [email protected]
Andrew Suffield [email protected] Andrew Suffield [email protected]
Angelo Borsotti [email protected] Angelo Borsotti [email protected]
Anthony Heading [email protected] Anthony Heading [email protected]
Antonio Silva Correia [email protected]
Arnold Robbins [email protected] Arnold Robbins [email protected]
Art Haas [email protected] Art Haas [email protected]
Askar Safin [email protected]
Baron Schwartz [email protected] Baron Schwartz [email protected]
Ben Pfaff [email protected] Ben Pfaff [email protected]
Benoit Perrot [email protected] Benoit Perrot [email protected]
Bernd Edlinger [email protected]
Bernd Kiefer [email protected] Bernd Kiefer [email protected]
Bert Deknuydt [email protected] Bert Deknuydt [email protected]
Bill Allombert [email protected] Bill Allombert [email protected]
@@ -35,12 +31,10 @@ Cris van Pelt [email protected]
Csaba Raduly [email protected] Csaba Raduly [email protected]
Dagobert Michelsen [email protected] Dagobert Michelsen [email protected]
Daniel Frużyński [email protected] Daniel Frużyński [email protected]
Daniel Galloway [email protected]
Daniel Hagerty [email protected] Daniel Hagerty [email protected]
David J. MacKenzie [email protected] David J. MacKenzie [email protected]
David Kastrup [email protected] David Kastrup [email protected]
Dennis Clarke [email protected] Dennis Clarke [email protected]
Derek Clegg [email protected]
Derek M. Jones [email protected] Derek M. Jones [email protected]
Di-an Jan [email protected] Di-an Jan [email protected]
Dick Streefland [email protected] Dick Streefland [email protected]
@@ -50,7 +44,6 @@ Enrico Scholz [email protected]
Eric Blake [email protected] Eric Blake [email protected]
Evgeny Stambulchik [email protected] Evgeny Stambulchik [email protected]
Fabrice Bauzac [email protected] Fabrice Bauzac [email protected]
Ferdinand Thiessen [email protected]
Florian Krohm [email protected] Florian Krohm [email protected]
Frank Heckenbach [email protected] Frank Heckenbach [email protected]
Frans Englich [email protected] Frans Englich [email protected]
@@ -69,13 +62,11 @@ Jim Kent [email protected]
Jim Meyering [email protected] Jim Meyering [email protected]
Joel E. Denny [email protected] Joel E. Denny [email protected]
Johan van Selst [email protected] Johan van Selst [email protected]
John Horigan [email protected]
Jonathan Fabrizio [email protected] Jonathan Fabrizio [email protected]
Jonathan Nieder [email protected] Jonathan Nieder [email protected]
Juan Manuel Guerrero [email protected] Juan Manuel Guerrero [email protected]
Kees Zeelenberg [email protected] Kees Zeelenberg [email protected]
Keith Browne [email protected] Keith Browne [email protected]
Ken Moffat [email protected]
Laurent Mascherpa [email protected] Laurent Mascherpa [email protected]
Lie Yan [email protected] Lie Yan [email protected]
Magnus Fromreide [email protected] Magnus Fromreide [email protected]
@@ -87,20 +78,14 @@ Martin Mokrejs [email protected]
Martin Nylin [email protected] Martin Nylin [email protected]
Matt Kraai [email protected] Matt Kraai [email protected]
Matt Rosing [email protected] Matt Rosing [email protected]
Michael Catanzaro [email protected]
Michael Felt [email protected]
Michael Hayes [email protected] Michael Hayes [email protected]
Michael Raskin [email protected] Michael Raskin [email protected]
Michel d'Hooge [email protected]
Michiel De Wilde [email protected] Michiel De Wilde [email protected]
Mickael Labau [email protected] Mickael Labau [email protected]
Mike Castle [email protected] Mike Castle [email protected]
Mike Sullivan [email protected]
Nate Guerin [email protected]
Neil Booth [email protected] Neil Booth [email protected]
Nelson H. F. Beebe [email protected] Nelson H. F. Beebe [email protected]
Nick Bowler [email protected] Nick Bowler [email protected]
Nicolas Bedon [email protected]
Nicolas Burrus [email protected] Nicolas Burrus [email protected]
Nicolas Tisserand [email protected] Nicolas Tisserand [email protected]
Noah Friedman [email protected] Noah Friedman [email protected]
@@ -108,7 +93,6 @@ Odd Arild Olsen [email protected]
Oleg Smolsky [email protected] Oleg Smolsky [email protected]
Oleksii Taran [email protected] Oleksii Taran [email protected]
Paolo Bonzini [email protected] Paolo Bonzini [email protected]
Paolo Simone Gasparello [email protected]
Pascal Bart [email protected] Pascal Bart [email protected]
Paul Eggert [email protected] Paul Eggert [email protected]
Paul Hilfinger [email protected] Paul Hilfinger [email protected]
@@ -118,19 +102,16 @@ Peter Fales [email protected]
Peter Hamorsky [email protected] Peter Hamorsky [email protected]
Peter Simons [email protected] Peter Simons [email protected]
Petr Machata [email protected] Petr Machata [email protected]
Pho [email protected]
Piotr Gackiewicz [email protected] Piotr Gackiewicz [email protected]
Quentin Hocquet [email protected] Quentin Hocquet [email protected]
Quoc Peyrot [email protected] Quoc Peyrot [email protected]
R Blake [email protected] R Blake [email protected]
Raja R Harinath [email protected] Raja R Harinath [email protected]
Ralf Wildenhues [email protected] Ralf Wildenhues [email protected]
Rich Wilson [email protected]
Richard Stallman [email protected] Richard Stallman [email protected]
Rici Lake [email protected]
Rob Conde [email protected]
Rob Vermaas [email protected] Rob Vermaas [email protected]
Robert Anisko [email protected] Robert Anisko [email protected]
Rob Conde [email protected]
Roland Levillain [email protected] Roland Levillain [email protected]
Satya Kiran Popuri [email protected] Satya Kiran Popuri [email protected]
Sebastian Setzer [email protected] Sebastian Setzer [email protected]
@@ -138,16 +119,13 @@ Sebastien Fricker [email protected]
Sergei Steshenko [email protected] Sergei Steshenko [email protected]
Shura [email protected] Shura [email protected]
Stefano Lattarini [email protected] Stefano Lattarini [email protected]
Stephen Cameron [email protected]
Steve Murphy [email protected] Steve Murphy [email protected]
Sum Wu [email protected] Sum Wu [email protected]
Théophile Ranquet [email protected] Théophile Ranquet [email protected]
Thiru Ramakrishnan [email protected] Thiru Ramakrishnan [email protected]
Thomas Jahns [email protected]
Tim Josling [email protected] Tim Josling [email protected]
Tim Landscheidt [email protected] Tim Landscheidt [email protected]
Tim Van Holder [email protected] Tim Van Holder [email protected]
Tobias Frost [email protected]
Tom Lane [email protected] Tom Lane [email protected]
Tom Tromey [email protected] Tom Tromey [email protected]
Tommy Nordgren [email protected] Tommy Nordgren [email protected]
@@ -163,7 +141,6 @@ Wojciech Polak [email protected]
Wolfgang S. Kechel [email protected] Wolfgang S. Kechel [email protected]
Wolfram Wagner [email protected] Wolfram Wagner [email protected]
Wwp [email protected] Wwp [email protected]
xolodho [email protected]
Zack Weinberg [email protected] Zack Weinberg [email protected]
Many people are not named here because we lost track of them. We Many people are not named here because we lost track of them. We
@@ -176,7 +153,7 @@ End:
----- -----
Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2000-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Parser Generator. This file is part of Bison, the GNU Parser Generator.
+1 -2
View File
@@ -369,8 +369,7 @@ End:
----- -----
Copyright (C) 2001-2004, 2006, 2008-2015, 2018 Free Software Foundation, Copyright (C) 2001-2004, 2006, 2008-2013 Free Software Foundation, Inc.
Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+163 -204
View File
@@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2018-04-28.14; # UTC scriptversion=2013-07-03.20; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2018 Free Software Foundation, Inc. # Copyright (C) 2003-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ scriptversion=2018-04-28.14; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this # Originally written by Paul Eggert. The canonical version of this
# script is maintained as build-aux/bootstrap in gnulib, however, to # script is maintained as build-aux/bootstrap in gnulib, however, to
@@ -42,9 +42,6 @@ export LC_ALL
local_gl_dir=gl local_gl_dir=gl
# Honor $PERL, but work even if there is none.
PERL="${PERL-perl}"
me=$0 me=$0
usage() { usage() {
@@ -109,6 +106,9 @@ die() { warn_ "$@"; exit 1; }
# Configuration. # Configuration.
# Name of the Makefile.am
gnulib_mk=gnulib.mk
# List of gnulib modules needed. # List of gnulib modules needed.
gnulib_modules= gnulib_modules=
@@ -138,7 +138,7 @@ po_download_command_format=\
# Fallback for downloading .po files (if rsync fails). # Fallback for downloading .po files (if rsync fails).
po_download_command_format2=\ po_download_command_format2=\
"wget --mirror -nd -q -np -A.po -P '%s' \ "wget --mirror -nd -q -np -A.po -P '%s' \
https://translationproject.org/latest/%s/" http://translationproject.org/latest/%s/"
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else # Prefer a non-empty tarname (4th argument of AC_INIT if given), else
# fall back to the package name (1st argument with munging) # fall back to the package name (1st argument with munging)
@@ -167,15 +167,7 @@ source_base=lib
m4_base=m4 m4_base=m4
doc_base=doc doc_base=doc
tests_base=tests tests_base=tests
gnulib_extra_files=" gnulib_extra_files=''
build-aux/install-sh
build-aux/mdate-sh
build-aux/texinfo.tex
build-aux/depcomp
build-aux/config.guess
build-aux/config.sub
doc/INSTALL
"
# Additional gnulib-tool options to use. Use "\newline" to break lines. # Additional gnulib-tool options to use. Use "\newline" to break lines.
gnulib_tool_option_extras= gnulib_tool_option_extras=
@@ -217,26 +209,12 @@ bootstrap_sync=false
# Use git to update gnulib sources # Use git to update gnulib sources
use_git=true use_git=true
check_exists() {
if test "$1" = "--verbose"; then
($2 --version </dev/null) >/dev/null 2>&1
if test $? -ge 126; then
# If not found, run with diagnostics as one may be
# presented with env variables to set to find the right version
($2 --version </dev/null)
fi
else
($1 --version </dev/null) >/dev/null 2>&1
fi
test $? -lt 126
}
# find_tool ENVVAR NAMES... # find_tool ENVVAR NAMES...
# ------------------------- # -------------------------
# Search for a required program. Use the value of ENVVAR, if set, # Search for a required program. Use the value of ENVVAR, if set,
# otherwise find the first of the NAMES that can be run. # otherwise find the first of the NAMES that can be run (i.e.,
# If found, set ENVVAR to the program name, die otherwise. # supports --version). If found, set ENVVAR to the program name,
# die otherwise.
# #
# FIXME: code duplication, see also gnu-web-doc-update. # FIXME: code duplication, see also gnu-web-doc-update.
find_tool () find_tool ()
@@ -246,21 +224,27 @@ find_tool ()
find_tool_names=$@ find_tool_names=$@
eval "find_tool_res=\$$find_tool_envvar" eval "find_tool_res=\$$find_tool_envvar"
if test x"$find_tool_res" = x; then if test x"$find_tool_res" = x; then
for i; do for i
if check_exists $i; then do
find_tool_res=$i if ($i --version </dev/null) >/dev/null 2>&1; then
break find_tool_res=$i
break
fi fi
done done
else
find_tool_error_prefix="\$$find_tool_envvar: "
fi fi
if test x"$find_tool_res" = x; then test x"$find_tool_res" != x \
warn_ "one of these is required: $find_tool_names;" || die "one of these is required: $find_tool_names"
die "alternatively set $find_tool_envvar to a compatible tool" ($find_tool_res --version </dev/null) >/dev/null 2>&1 \
fi || die "${find_tool_error_prefix}cannot run $find_tool_res --version"
eval "$find_tool_envvar=\$find_tool_res" eval "$find_tool_envvar=\$find_tool_res"
eval "export $find_tool_envvar" eval "export $find_tool_envvar"
} }
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary. # Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory # Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap". # if we were invoked as "sh bootstrap".
@@ -269,18 +253,24 @@ case "$0" in
*) test -r "$0.conf" && . ./"$0.conf" ;; *) test -r "$0.conf" && . ./"$0.conf" ;;
esac esac
# Extra files from gnulib, which override files from other sources.
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
build-aux/install-sh
build-aux/mdate-sh
build-aux/texinfo.tex
build-aux/depcomp
build-aux/config.guess
build-aux/config.sub
doc/INSTALL
"
if test "$vc_ignore" = auto; then if test "$vc_ignore" = auto; then
vc_ignore= vc_ignore=
test -d .git && vc_ignore=.gitignore test -d .git && vc_ignore=.gitignore
test -d CVS && vc_ignore="$vc_ignore .cvsignore" test -d CVS && vc_ignore="$vc_ignore .cvsignore"
fi fi
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
use_gnulib=false
else
use_gnulib=true
fi
# Translate configuration into internal form. # Translate configuration into internal form.
# Parse options. # Parse options.
@@ -336,7 +326,7 @@ insert_if_absent() {
die "Error: Duplicate entries in $file: " $duplicate_entries die "Error: Duplicate entries in $file: " $duplicate_entries
fi fi
linesold=$(gitignore_entries $file | wc -l) linesold=$(gitignore_entries $file | wc -l)
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
if [ $linesold != $linesnew ] ; then if [ $linesold != $linesnew ] ; then
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|| die "insert_if_absent $file $str: failed" || die "insert_if_absent $file $str: failed"
@@ -417,30 +407,28 @@ sort_ver() { # sort -V is not generally available
done done
} }
get_version_sed='
# Move version to start of line.
s/.*[v ]\([0-9]\)/\1/
# Skip lines that do not start with version.
/^[0-9]/!d
# Remove characters after the version.
s/[^.a-z0-9-].*//
# The first component must be digits only.
s/^\([0-9]*\)[a-z-].*/\1/
#the following essentially does s/5.005/5.5/
s/\.0*\([1-9]\)/.\1/g
p
q'
get_version() { get_version() {
app=$1 app=$1
$app --version >/dev/null 2>&1 || { $app --version; return 1; } $app --version >/dev/null 2>&1 || return 1
$app --version 2>&1 | sed -n "$get_version_sed" $app --version 2>&1 |
sed -n '# Move version to start of line.
s/.*[v ]\([0-9]\)/\1/
# Skip lines that do not start with version.
/^[0-9]/!d
# Remove characters after the version.
s/[^.a-z0-9-].*//
# The first component must be digits only.
s/^\([0-9]*\)[a-z-].*/\1/
#the following essentially does s/5.005/5.5/
s/\.0*\([1-9]\)/.\1/g
p
q'
} }
check_versions() { check_versions() {
@@ -460,7 +448,6 @@ check_versions() {
test "$appvar" = TAR && appvar=AMTAR test "$appvar" = TAR && appvar=AMTAR
case $appvar in case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options. GZIP) ;; # Do not use $GZIP: it contains gzip options.
PERL::*) ;; # Keep perl modules as-is
*) eval "app=\${$appvar-$app}" ;; *) eval "app=\${$appvar-$app}" ;;
esac esac
@@ -478,22 +465,12 @@ check_versions() {
ret=1 ret=1
continue continue
} ;; } ;;
# Another check is for perl modules. These can be written as
# e.g. perl::XML::XPath in case of XML::XPath module, etc.
perl::*)
# Extract module name
app="${app#perl::}"
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
warn_ "Error: perl module '$app' not found"
ret=1
fi
continue
;;
esac esac
if [ "$req_ver" = "-" ]; then if [ "$req_ver" = "-" ]; then
# Merely require app to exist; not all prereq apps are well-behaved # Merely require app to exist; not all prereq apps are well-behaved
# so we have to rely on $? rather than get_version. # so we have to rely on $? rather than get_version.
if ! check_exists --verbose $app; then $app --version >/dev/null 2>&1
if [ 126 -le $? ]; then
warn_ "Error: '$app' not found" warn_ "Error: '$app' not found"
ret=1 ret=1
fi fi
@@ -526,12 +503,6 @@ print_versions() {
# can't depend on column -t # can't depend on column -t
} }
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
# Also find the compatible sha1 utility on the BSDs
if test x"$SKIP_PO" = x; then
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
fi
use_libtool=0 use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT, # We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
@@ -577,21 +548,13 @@ if ! printf "$buildreq" | check_versions; then
fi fi
fi fi
# Warn the user if autom4te appears to be broken; this causes known
# issues with at least gettext 0.18.3.
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
if test "x$probe" != xhi; then
warn_ "WARNING: your autom4te wrapper eats stdin;"
warn_ "if bootstrap fails, consider upgrading your autotools"
fi
echo "$0: Bootstrapping from checked-out $package sources..." echo "$0: Bootstrapping from checked-out $package sources..."
# See if we can use gnulib's git-merge-changelog merge driver. # See if we can use gnulib's git-merge-changelog merge driver.
if $use_git && test -d .git && check_exists git; then if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then if git config merge.merge-changelog.driver >/dev/null ; then
: :
elif check_exists git-merge-changelog; then elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
echo "$0: initializing git-merge-changelog driver" echo "$0: initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
@@ -611,87 +574,84 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@" test -f .gitmodules && git config --file .gitmodules "$@"
} }
if $use_gnulib; then if $use_git; then
if $use_git; then gnulib_path=$(git_modules_config submodule.gnulib.path)
gnulib_path=$(git_modules_config submodule.gnulib.path) test -z "$gnulib_path" && gnulib_path=gnulib
test -z "$gnulib_path" && gnulib_path=gnulib fi
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
# submodule, for use in the rest of the script.
case ${GNULIB_SRCDIR--} in
-)
# Note that $use_git is necessarily true in this case.
if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
git submodule init || exit $?
git submodule update || exit $?
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
shallow=
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
cleanup_gnulib
trap - 1 2 13 15
fi fi
GNULIB_SRCDIR=$gnulib_path
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a ;;
# submodule, for use in the rest of the script. *)
# Use GNULIB_SRCDIR directly or as a reference.
case ${GNULIB_SRCDIR--} in if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
-) git_modules_config submodule.gnulib.url >/dev/null; then
# Note that $use_git is necessarily true in this case. echo "$0: getting gnulib files..."
if git_modules_config submodule.gnulib.url >/dev/null; then if git submodule -h|grep -- --reference > /dev/null; then
echo "$0: getting gnulib files..." # Prefer the one-liner available in git 1.6.4 or newer.
git submodule init -- "$gnulib_path" || exit $? git submodule update --init --reference "$GNULIB_SRCDIR" \
git submodule update -- "$gnulib_path" || exit $? "$gnulib_path" || exit $?
else
elif [ ! -d "$gnulib_path" ]; then # This fallback allows at least git 1.5.5.
echo "$0: getting gnulib files..." if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete.
trap cleanup_gnulib 1 2 13 15 git submodule update || exit $?
else
shallow= # Older git can't clone into an empty directory.
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' rmdir "$gnulib_path" 2>/dev/null
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" || git clone --reference "$GNULIB_SRCDIR" \
cleanup_gnulib "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init && git submodule update \
trap - 1 2 13 15 || exit $?
fi
fi fi
GNULIB_SRCDIR=$gnulib_path GNULIB_SRCDIR=$gnulib_path
;;
*)
# Use GNULIB_SRCDIR directly or as a reference.
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
if git submodule -h|grep -- --reference > /dev/null; then
# Prefer the one-liner available in git 1.6.4 or newer.
git submodule update --init --reference "$GNULIB_SRCDIR" \
"$gnulib_path" || exit $?
else
# This fallback allows at least git 1.5.5.
if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete.
git submodule update -- "$gnulib_path" || exit $?
else
# Older git can't clone into an empty directory.
rmdir "$gnulib_path" 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" \
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init -- "$gnulib_path" \
&& git submodule update -- "$gnulib_path" \
|| exit $?
fi
fi
GNULIB_SRCDIR=$gnulib_path
fi
;;
esac
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
# we no longer need to use git or $gnulib_path below here.
if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..."
case $(sh -c 'echo "$1"' -- a) in
a) ignored=--;;
*) ignored=ignored;;
esac
exec sh -c \
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
"$0" "$@" --no-bootstrap-sync
}
fi fi
;;
esac
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool # $GNULIB_SRCDIR now points to the version of gnulib to use, and
<$gnulib_tool || exit $? # we no longer need to use git or $gnulib_path below here.
if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..."
case $(sh -c 'echo "$1"' -- a) in
a) ignored=--;;
*) ignored=ignored;;
esac
exec sh -c \
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
"$0" "$@" --no-bootstrap-sync
}
fi fi
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit $?
# Get translations. # Get translations.
download_po_files() { download_po_files() {
@@ -700,7 +660,7 @@ download_po_files() {
echo "$me: getting translations into $subdir for $domain..." echo "$me: getting translations into $subdir for $domain..."
cmd=$(printf "$po_download_command_format" "$domain" "$subdir") cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
eval "$cmd" && return eval "$cmd" && return
# Fallback to HTTPS. # Fallback to HTTP.
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain") cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
eval "$cmd" eval "$cmd"
} }
@@ -732,10 +692,11 @@ update_po_files() {
cksum_file="$ref_po_dir/$po.s1" cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" || if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" || ! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then ! $SHA1SUM -c --status "$cksum_file" \
< "$new_po" > /dev/null; then
echo "$me: updated $po_dir/$po.po..." echo "$me: updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \ cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file" || return && $SHA1SUM < "$new_po" > "$cksum_file"
fi fi
done done
} }
@@ -791,9 +752,9 @@ symlink_to_dir()
# Leave any existing symlink alone, if it already points to the source, # Leave any existing symlink alone, if it already points to the source,
# so that broken build tools that care about symlink times # so that broken build tools that care about symlink times
# aren't confused into doing unnecessary builds. Conversely, if the # aren't confused into doing unnecessary builds. Conversely, if the
# existing symlink's timestamp is older than the source, make it afresh, # existing symlink's time stamp is older than the source, make it afresh,
# so that broken tools aren't confused into skipping needed builds. See # so that broken tools aren't confused into skipping needed builds. See
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>. # <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" && test -h "$dst" &&
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
@@ -899,33 +860,31 @@ fi
# Import from gnulib. # Import from gnulib.
if $use_gnulib; then gnulib_tool_options="\
gnulib_tool_options="\ --import\
--no-changelog\ --no-changelog\
--aux-dir $build_aux\ --aux-dir $build_aux\
--doc-base $doc_base\ --doc-base $doc_base\
--lib $gnulib_name\ --lib $gnulib_name\
--m4-base $m4_base/\ --m4-base $m4_base/\
--source-base $source_base/\ --source-base $source_base/\
--tests-base $tests_base\ --tests-base $tests_base\
--local-dir $local_gl_dir\ --local-dir $local_gl_dir\
$gnulib_tool_option_extras\ $gnulib_tool_option_extras\
" "
if test $use_libtool = 1; then if test $use_libtool = 1; then
case "$gnulib_tool_options " in case "$gnulib_tool_options " in
*' --libtool '*) ;; *' --libtool '*) ;;
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;; *) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
esac esac
fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|| die "gnulib-tool failed"
for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file \
|| die "failed to symlink $file"
done
fi fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file \
|| die "failed to symlink $file"
done
bootstrap_post_import_hook \ bootstrap_post_import_hook \
|| die "bootstrap_post_import_hook failed" || die "bootstrap_post_import_hook failed"
@@ -1022,9 +981,9 @@ bootstrap_epilogue
echo "$0: done. Now you can run './configure'." echo "$0: done. Now you can run './configure'."
# Local variables: # Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0" # time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:
+4 -5
View File
@@ -1,6 +1,6 @@
# Bootstrap configuration. # Bootstrap configuration.
# Copyright (C) 2006-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2006-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -33,9 +33,8 @@ gnulib_modules='
quote quotearg quote quotearg
readme-release readme-release
realloc-posix realloc-posix
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
unistd unistd-safer unlink unlocked-io unistd unistd-safer unlocked-io update-copyright unsetenv verify
update-copyright unsetenv verify
warnings warnings
xalloc xalloc
xalloc-die xalloc-die
@@ -81,7 +80,7 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
bootstrap_post_import_hook() bootstrap_post_import_hook()
{ {
# Massage lib/gnulib.mk before using it later in the bootstrapping process. # Massage lib/gnulib.mk before using it later in the bootstrapping process.
build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/gnulib.mk build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
# Ensure that ChangeLog exists, for automake. # Ensure that ChangeLog exists, for automake.
test -f ChangeLog || touch ChangeLog test -f ChangeLog || touch ChangeLog
+5 -1
View File
@@ -1,4 +1,6 @@
/announce-gen /announce-gen
/arg-nonnull.h
/c++defs.h
/compile /compile
/config.guess /config.guess
/config.rpath /config.rpath
@@ -14,12 +16,14 @@
/install-sh /install-sh
/javacomp.sh.in /javacomp.sh.in
/javaexec.sh.in /javaexec.sh.in
/link-warning.h
/mdate-sh /mdate-sh
/missing /missing
/prefix-gnulib-mk
/test-driver /test-driver
/texinfo.tex /texinfo.tex
/update-copyright /update-copyright
/useless-if-before-free /useless-if-before-free
/vc-list-files /vc-list-files
/warn-on-use.h
/ylwrap /ylwrap
/prefix-gnulib-mk
-48
View File
@@ -1,48 +0,0 @@
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Valgrind suppression file for Bison.
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
# x86_64 GNU/Linux
{
Probably exception handling from G++ 5.1.
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
fun:pool
fun:__static_initialization_and_destruction_0
fun:_GLOBAL__sub_I_eh_alloc.cc
fun:call_init.part.0
fun:_dl_init
obj:/usr/lib/ld-2.21.so
}
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
# x86_64 GNU/Linux
{
index
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
fun:map_doit
fun:_dl_catch_error
fun:do_preload
fun:dl_main
fun:_dl_sysdep_start
fun:_dl_start
obj:/lib/ld-2.11.3.so
}
@@ -1,4 +1,4 @@
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2012-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
-3
View File
@@ -2,9 +2,6 @@
# option. It specifies what changes to make to each given SHA1's commit # option. It specifies what changes to make to each given SHA1's commit
# log and metadata, using Perl-eval'able expressions. # log and metadata, using Perl-eval'able expressions.
975bb564319aa4f4204c48aba265757ba207a80f
s/Edligner/Edlinger/;
0db2648930e3b6c376a539aabe368aade83ee29a 0db2648930e3b6c376a539aabe368aade83ee29a
s/--flags/--feature/; s/--flags/--feature/;
s/flag_flag/feature_flag/; s/flag_flag/feature_flag/;
+16
View File
@@ -0,0 +1,16 @@
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
# x86_64 GNU/Linux
{
index
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
fun:map_doit
fun:_dl_catch_error
fun:do_preload
fun:dl_main
fun:_dl_sysdep_start
fun:_dl_start
obj:/lib/ld-2.11.3.so
}
+7 -7
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2000-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -13,10 +13,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
EXTRA_DIST += \ EXTRA_DIST += \
build-aux/Darwin.valgrind \ build-aux/cross-options.pl \
build-aux/Linux.valgrind \ build-aux/darwin11.4.0.valgrind \
build-aux/cross-options.pl \ build-aux/linux-gnu.valgrind \
build-aux/move-if-change \ build-aux/move-if-change \
build-aux/prev-version.txt \ build-aux/prev-version.txt \
build-aux/update-b4-copyright build-aux/update-b4-copyright
+4
View File
@@ -0,0 +1,4 @@
/_Noreturn.h
/arg-nonnull.h
/c++defs.h
/warn-on-use.h
+1 -1
View File
@@ -3,7 +3,7 @@
# Update b4_copyright invocations or b4_copyright_years definitions to # Update b4_copyright invocations or b4_copyright_years definitions to
# include the current year. # include the current year.
# Copyright (C) 2009-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2009-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year. # In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
# Copyright (C) 2010-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2010-2013 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+18 -19
View File
@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*- # Customize maint.mk -*- makefile -*-
# Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2008-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -158,24 +158,23 @@ sc_space_before_open_paren:
exclude = \ exclude = \
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a)))) $(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
$(call exclude, \ $(call exclude, \
bindtextdomain=^lib/main.c$$ \ bindtextdomain=^lib/main.c$$ \
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \ preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
program_name=^lib/main.c$$ \ program_name=^lib/main.c$$ \
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \ prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \ prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
prohibit_always-defined_macros+=?|^tests/regression.at$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \ prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \ prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \ prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
prohibit_doubled_word=^tests/named-refs.at$$ \ prohibit_doubled_word=^tests/named-refs.at$$ \
prohibit_magic_number_exit=^doc/bison.texi$$ \ prohibit_magic_number_exit=^doc/bison.texi$$ \
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \ prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \ prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \ prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
space_before_open_paren=^(data/|djgpp/) \ space_before_open_paren=^(data/|djgpp/) \
two_space_separator_in_usage=^(bootstrap) \ unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
) )
+30 -34
View File
@@ -1,6 +1,6 @@
# Configure template for GNU Bison. -*-Autoconf-*- # Configure template for GNU Bison. -*-Autoconf-*-
# #
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2001-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -26,14 +26,18 @@ m4_pattern_forbid([^gl_[A-Z]])
AC_INIT([GNU Bison], AC_INIT([GNU Bison],
m4_esyscmd([build-aux/git-version-gen .tarball-version]), m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[[email protected]]) [[email protected]])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2018]) AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2013])
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR], AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
[The copyright year for this package]) [The copyright year for this package])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
# We use Automake 1.14's %D% and %C%. # Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
#
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
#
# To avoid 1.11, we make 1.11.1 the minimum version.
# #
# We want gnits strictness only when rolling a stable release. For # We want gnits strictness only when rolling a stable release. For
# release candidates, we use version strings like 2.4.3_rc1, but gnits # release candidates, we use version strings like 2.4.3_rc1, but gnits
@@ -41,7 +45,7 @@ AC_CONFIG_MACRO_DIR([m4])
# releases, we want to be able run make dist without being required to # releases, we want to be able run make dist without being required to
# add a bogus NEWS entry. In that case, the version string # add a bogus NEWS entry. In that case, the version string
# automatically contains a dash, which we also let disable gnits. # automatically contains a dash, which we also let disable gnits.
AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
color-tests parallel-tests color-tests parallel-tests
silent-rules] silent-rules]
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]], m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
@@ -71,18 +75,15 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
CFLAGS=$save_CFLAGS]) CFLAGS=$save_CFLAGS])
AC_ARG_ENABLE([gcc-warnings], AC_ARG_ENABLE([gcc-warnings],
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended). [ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
Also, issue synclines from the examples/ to
the corresponding source in the Texinfo doc.],
[case $enable_gcc_warnings in [case $enable_gcc_warnings in
yes|no) ;; yes|no) ;;
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);; *) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
esac], esac],
[enable_gcc_warnings=no]) [enable_gcc_warnings=no])
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
if test "$enable_gcc_warnings" = yes; then if test "$enable_gcc_warnings" = yes; then
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings' -Wformat -Wpointer-arith -Wwrite-strings'
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes' warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
warn_cxx='-Wnoexcept' warn_cxx='-Wnoexcept'
# Warnings for the test suite only. # Warnings for the test suite only.
@@ -90,12 +91,7 @@ if test "$enable_gcc_warnings" = yes; then
# -fno-color-diagnostics: Clang's use of colors in the error # -fno-color-diagnostics: Clang's use of colors in the error
# messages is confusing the tests looking at the compiler's output # messages is confusing the tests looking at the compiler's output
# (e.g., synclines.at). # (e.g., synclines.at).
# warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics'
# -Wno-keyword-macro: We use the "#define private public" dirty
# trick in the test suite to check some private implementation
# details for lalr1.cc.
warn_tests='-Wundef -pedantic -Wdeprecated -Wsign-compare -fno-color-diagnostics
-Wno-keyword-macro'
AC_LANG_PUSH([C]) AC_LANG_PUSH([C])
# Clang supports many of GCC's -W options, but only issues warnings # Clang supports many of GCC's -W options, but only issues warnings
@@ -165,17 +161,21 @@ AC_ARG_ENABLE([yacc],
[AC_HELP_STRING([--disable-yacc], [AC_HELP_STRING([--disable-yacc],
[do not build a yacc command or an -ly library])], [do not build a yacc command or an -ly library])],
, [enable_yacc=yes]) , [enable_yacc=yes])
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes]) case $enable_yacc in
yes)
YACC_SCRIPT=src/yacc
YACC_LIBRARY=lib/liby.a;;
*)
YACC_SCRIPT=
YACC_LIBRARY=;;
esac
AC_SUBST([YACC_SCRIPT])
AC_SUBST([YACC_LIBRARY])
# Checks for programs. # Checks for programs.
AM_MISSING_PROG([DOT], [dot]) AM_MISSING_PROG([DOT], [dot])
AC_PROG_LEX AC_PROG_LEX
$LEX_IS_FLEX || test "X$LEX" = X: || { $LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
AC_MSG_WARN([bypassing lex because flex is required])
LEX=:
}
AM_CONDITIONAL([FLEX_CXX_WORKS],
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
AC_PROG_YACC AC_PROG_YACC
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_GNU_M4 AC_PROG_GNU_M4
@@ -225,27 +225,23 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
AC_CONFIG_TESTDIR(tests) AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/atlocal]) AC_CONFIG_FILES([tests/atlocal])
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison]) AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
AC_CHECK_PROGS([VALGRIND], [valgrind]) AC_CHECK_PROGS([VALGRIND], [valgrind])
# Use something simpler that $host_os to select our suppression file. case $VALGRIND:$host_os in
uname=`uname`
case $VALGRIND:$uname in
'':*) ;; '':*) ;;
*:Darwin) *:darwin*)
# See README-hacking. # See README-hacking.
# VALGRIND+='-q --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
VALGRIND=;; VALGRIND=;;
*:*) *:*)
suppfile=build-aux/$uname.valgrind suppfile=build-aux/$host_os.valgrind
if test -f "$srcdir/$suppfile"; then if test -f "$srcdir/$suppfile"; then
AC_SUBST([VALGRIND_OPTS_SUPPRESSION], VALGRIND="$VALGRIND --gen-suppressions=all"
["--suppressions=\$(abs_top_srcdir)/$suppfile"]) VALGRIND="$VALGRIND --suppressions=\$(abs_top_srcdir)/$suppfile"
fi fi
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"])
;; ;;
esac esac
# Whether we cannot run the compiled bison.
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
AM_MISSING_PROG([AUTOM4TE], [autom4te]) AM_MISSING_PROG([AUTOM4TE], [autom4te])
# Needed by tests/atlocal.in. # Needed by tests/atlocal.in.
AC_SUBST([GCC]) AC_SUBST([GCC])
+1 -1
View File
@@ -52,7 +52,7 @@ into various formats.
----- -----
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+2 -4
View File
@@ -2,7 +2,7 @@
# Language-independent M4 Macros for Bison. # Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -437,6 +437,7 @@ m4_define([b4_symbol_action_location],
# b4_symbol_action(SYMBOL-NUM, KIND) # b4_symbol_action(SYMBOL-NUM, KIND)
# ---------------------------------- # ----------------------------------
# Run the action KIND (destructor or printer) for SYMBOL-NUM. # Run the action KIND (destructor or printer) for SYMBOL-NUM.
# Same as in C, but using references instead of pointers.
m4_define([b4_symbol_action], m4_define([b4_symbol_action],
[b4_symbol_if([$1], [has_$2], [b4_symbol_if([$1], [has_$2],
[b4_dollar_pushdef([(*yyvaluep)], [b4_dollar_pushdef([(*yyvaluep)],
@@ -1060,6 +1061,3 @@ b4_percent_define_ifdef([api.value.type],
[['%s' and '%s' cannot be used together]], [['%s' and '%s' cannot be used together]],
[%yacc], [%yacc],
[%define api.value.type "union"])])])]) [%define api.value.type "union"])])])])
# api.value.union.name.
b4_percent_define_check_kind([api.value.union.name], [keyword])
+1 -2
View File
@@ -2,8 +2,7 @@
# C++ skeleton dispatching for Bison. # C++ skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation, # Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
# Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+41 -76
View File
@@ -2,7 +2,7 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -17,11 +17,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Sanity checks, before defaults installed by c.m4.
b4_percent_define_ifdef([[api.value.union.name]],
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
[named %union is invalid in C++])])
m4_include(b4_pkgdatadir/[c.m4]) m4_include(b4_pkgdatadir/[c.m4])
# b4_comment(TEXT, [PREFIX]) # b4_comment(TEXT, [PREFIX])
@@ -30,16 +25,6 @@ m4_include(b4_pkgdatadir/[c.m4])
m4_define([b4_comment], m4_define([b4_comment],
[b4_comment_([$1], [$2// ], [$2// ])]) [b4_comment_([$1], [$2// ], [$2// ])])
# b4_inline(hh|cc)
# ----------------
# Expand to `inline\n ` if $1 is hh.
m4_define([b4_inline],
[m4_case([$1],
[cc], [],
[hh], [[inline
]],
[m4_fatal([$0: invalid argument: $1])])])
## -------- ## ## -------- ##
## Checks. ## ## Checks. ##
## -------- ## ## -------- ##
@@ -184,12 +169,9 @@ m4_define([b4_public_types_declare],
/// (External) token type, as returned by yylex. /// (External) token type, as returned by yylex.
typedef token::yytokentype token_type; typedef token::yytokentype token_type;
/// Symbol type: an internal symbol number. /// Internal symbol number.
typedef int symbol_number_type; typedef int symbol_number_type;
/// The symbol type number to denote an empty symbol.
enum { empty_symbol = -2 };
/// Internal symbol number for tokens (subsumed by symbol_number_type). /// Internal symbol number for tokens (subsumed by symbol_number_type).
typedef ]b4_int_type_for([b4_translate])[ token_number_type; typedef ]b4_int_type_for([b4_translate])[ token_number_type;
@@ -222,15 +204,8 @@ m4_define([b4_public_types_declare],
const semantic_type& v]b4_locations_if([, const semantic_type& v]b4_locations_if([,
const location_type& l])[); const location_type& l])[);
/// Destroy the symbol.
~basic_symbol (); ~basic_symbol ();
/// Destroy contents, and record that is empty.
void clear ();
/// Whether empty.
bool empty () const;
/// Destructive move, \a s is emptied into this. /// Destructive move, \a s is emptied into this.
void move (basic_symbol& s); void move (basic_symbol& s);
@@ -260,23 +235,21 @@ m4_define([b4_public_types_declare],
/// Constructor from (external) token numbers. /// Constructor from (external) token numbers.
by_type (kind_type t); by_type (kind_type t);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol type from \a that. /// Steal the symbol type from \a that.
void move (by_type& that); void move (by_type& that);
/// The (internal) type number (corresponding to \a type). /// The (internal) type number (corresponding to \a type).
/// \a empty when empty. /// -1 when this symbol is empty.
symbol_number_type type_get () const; symbol_number_type type_get () const;
/// The token. /// The token.
token_type token () const; token_type token () const;
enum { empty = 0 };
/// The symbol type. /// The symbol type.
/// \a empty_symbol when empty. /// -1 when this symbol is empty.
/// An int, not token_number_type, to be able to store empty_symbol. token_number_type type;
int type;
}; };
/// "External" symbols: returned by the scanner. /// "External" symbols: returned by the scanner.
@@ -285,22 +258,25 @@ m4_define([b4_public_types_declare],
]b4_symbol_constructor_declare]) ]b4_symbol_constructor_declare])
# b4_public_types_define(hh|cc) # b4_public_types_define
# ----------------------------- # ----------------------
# Provide the implementation needed by the public types. # Provide the implementation needed by the public types.
m4_define([b4_public_types_define], m4_define([b4_public_types_define],
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m) [[ inline
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
: std::runtime_error (m)]b4_locations_if([ : std::runtime_error (m)]b4_locations_if([
, location (l)])[ , location (l)])[
{} {}
// basic_symbol. // basic_symbol.
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol () ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
: value () : value ()
{} {}
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other) ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
: Base (other) : Base (other)
, value ()]b4_locations_if([ , value ()]b4_locations_if([
@@ -311,7 +287,9 @@ m4_define([b4_public_types_define],
[value = other.value;])[ [value = other.value;])[
} }
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
[const semantic_type& v], [const semantic_type& v],
@@ -328,6 +306,7 @@ m4_define([b4_public_types_define],
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[ ]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
/// Constructor for valueless symbols. /// Constructor for valueless symbols.
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
@@ -337,19 +316,11 @@ m4_define([b4_public_types_define],
{}]])[ {}]])[
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol () ]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
{
clear ();
}
template <typename Base>
void
]b4_parser_class_name[::basic_symbol<Base>::clear ()
{]b4_variant_if([[ {]b4_variant_if([[
// User destructor. // User destructor.
symbol_number_type yytype = this->type_get (); symbol_number_type yytype = this->type_get ();
basic_symbol<Base>& yysym = *this;
(void) yysym;
switch (yytype) switch (yytype)
{ {
]b4_symbol_foreach([b4_symbol_destructor])dnl ]b4_symbol_foreach([b4_symbol_destructor])dnl
@@ -359,21 +330,14 @@ m4_define([b4_public_types_define],
// Type destructor. // Type destructor.
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[ ]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
Base::clear ();
}
template <typename Base>
bool
]b4_parser_class_name[::basic_symbol<Base>::empty () const
{
return Base::type_get () == empty_symbol;
} }
template <typename Base> template <typename Base>
inline
void void
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s) ]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
{ {
super_type::move (s); super_type::move(s);
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move], ]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
[s.value])], [s.value])],
[value = s.value;])[]b4_locations_if([ [value = s.value;])[]b4_locations_if([
@@ -381,38 +345,38 @@ m4_define([b4_public_types_define],
} }
// by_type. // by_type.
]b4_inline([$1])b4_parser_class_name[::by_type::by_type () inline
: type (empty_symbol) ]b4_parser_class_name[::by_type::by_type ()
: type (empty)
{} {}
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other) inline
]b4_parser_class_name[::by_type::by_type (const by_type& other)
: type (other.type) : type (other.type)
{} {}
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t) inline
]b4_parser_class_name[::by_type::by_type (token_type t)
: type (yytranslate_ (t)) : type (yytranslate_ (t))
{} {}
]b4_inline([$1])[void inline
]b4_parser_class_name[::by_type::clear () void
{
type = empty_symbol;
}
]b4_inline([$1])[void
]b4_parser_class_name[::by_type::move (by_type& that) ]b4_parser_class_name[::by_type::move (by_type& that)
{ {
type = that.type; type = that.type;
that.clear (); that.type = empty;
} }
]b4_inline([$1])[int inline
int
]b4_parser_class_name[::by_type::type_get () const ]b4_parser_class_name[::by_type::type_get () const
{ {
return type; return type;
} }
]b4_token_ctor_if([[ ]b4_token_ctor_if([[
]b4_inline([$1])b4_parser_class_name[::token_type inline
]b4_parser_class_name[::token_type
]b4_parser_class_name[::by_type::token () const ]b4_parser_class_name[::by_type::token () const
{ {
// YYTOKNUM[NUM] -- (External) token number corresponding to the // YYTOKNUM[NUM] -- (External) token number corresponding to the
@@ -438,13 +402,14 @@ m4_define([b4_symbol_constructor_declare], [])
m4_define([b4_symbol_constructor_define], []) m4_define([b4_symbol_constructor_define], [])
# b4_yytranslate_define(cc|hh) # b4_yytranslate_define
# ---------------------------- # ---------------------
# Define yytranslate_. Sometimes used in the header file ($1=hh), # Define yytranslate_. Sometimes used in the header file,
# sometimes in the cc file. # sometimes in the cc file.
m4_define([b4_yytranslate_define], m4_define([b4_yytranslate_define],
[[ // Symbol number corresponding to token number t. [[ // Symbol number corresponding to token number t.
]b4_inline([$1])b4_parser_class_name[::token_number_type inline
]b4_parser_class_name[::token_number_type
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type], ]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
[int])[ t) [int])[ t)
{ {
@@ -454,12 +419,12 @@ m4_define([b4_yytranslate_define],
{ {
]b4_translate[ ]b4_translate[
}; };
const unsigned user_token_number_max_ = ]b4_user_token_number_max[; const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
const token_number_type undef_token_ = ]b4_undef_token_number[; const token_number_type undef_token_ = ]b4_undef_token_number[;
if (static_cast<int> (t) <= yyeof_) if (static_cast<int>(t) <= yyeof_)
return yyeof_; return yyeof_;
else if (static_cast<unsigned> (t) <= user_token_number_max_) else if (static_cast<unsigned int> (t) <= user_token_number_max_)
return translate_table[t]; return translate_table[t];
else else
return undef_token_; return undef_token_;
+1 -1
View File
@@ -2,7 +2,7 @@
# Common code for C-like languages (C, C++, Java, etc.) # Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2012-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -2
View File
@@ -2,8 +2,7 @@
# C skeleton dispatching for Bison. # C skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation, # Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
# Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+24 -45
View File
@@ -2,7 +2,7 @@
# C M4 Macros for Bison. # C M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -97,8 +97,7 @@ m4_define([b4_api_PREFIX],
m4_define_default([b4_prefix], [b4_api_prefix]) m4_define_default([b4_prefix], [b4_api_prefix])
# If the %union is not named, its name is YYSTYPE. # If the %union is not named, its name is YYSTYPE.
b4_percent_define_default([[api.value.union.name]], m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
[b4_api_PREFIX[][STYPE]])
## ------------------------ ## ## ------------------------ ##
@@ -206,32 +205,13 @@ m4_define([b4_table_value_equals],
# b4_attribute_define # b4_attribute_define
# ------------------- # -------------------
# Provide portable compiler "attributes". # Provide portability for __attribute__.
m4_define([b4_attribute_define], m4_define([b4_attribute_define],
[#ifndef YY_ATTRIBUTE [#ifndef __attribute__
# if (defined __GNUC__ \ /* This feature is available in gcc versions 2.5 and later. */
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ # if (! defined __GNUC__ || __GNUC__ < 2 \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
# define YY_ATTRIBUTE(Spec) __attribute__(Spec) # define __attribute__(Spec) /* empty */
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif # endif
#endif #endif
@@ -270,14 +250,14 @@ m4_define([b4_attribute_define],
# b4_null_define # b4_null_define
# -------------- # --------------
# Portability issues: define a YY_NULLPTR appropriate for the current # Portability issues: define a YY_NULL appropriate for the current
# language (C, C++98, or C++11). # language (C, C++98, or C++11).
m4_define([b4_null_define], m4_define([b4_null_define],
[# ifndef YY_NULLPTR [# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus # if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr # define YY_NULL nullptr
# else # else
# define YY_NULLPTR 0 # define YY_NULL 0
# endif # endif
# endif[]dnl # endif[]dnl
]) ])
@@ -286,7 +266,7 @@ m4_define([b4_null_define],
# b4_null # b4_null
# ------- # -------
# Return a null pointer constant. # Return a null pointer constant.
m4_define([b4_null], [YY_NULLPTR]) m4_define([b4_null], [YY_NULL])
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
# ------------------------------------------------------------- # -------------------------------------------------------------
@@ -561,15 +541,15 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
# b4_symbol_type_register(SYMBOL-NUM) # b4_symbol_type_register(SYMBOL-NUM)
# ----------------------------------- # -----------------------------------
# Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag. # Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag.
# Extend the definition of %union's body (b4_union_members) with a # Extend the definition of %union's body with a field of that type,
# field of that type, and extend the symbol's "type" field to point to # and extend the symbol's "type" field to point to the field name,
# the field name, instead of the type name. # instead of the type name.
m4_define([b4_symbol_type_register], m4_define([b4_symbol_type_register],
[m4_define([b4_symbol($1, type_tag)], [m4_define([b4_symbol($1, type_tag)],
[b4_symbol_if([$1], [has_id], [b4_symbol_if([$1], [has_id],
[b4_symbol([$1], [id])], [b4_symbol([$1], [id])],
[yytype_[]b4_symbol([$1], [number])])])dnl [yytype_[]b4_symbol([$1], [number])])])dnl
m4_append([b4_union_members], m4_append([b4_user_union_members],
m4_expand([ m4_expand([
b4_symbol_tag_comment([$1])dnl b4_symbol_tag_comment([$1])dnl
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);])) b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
@@ -609,9 +589,10 @@ m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
]) ])
# -------------------------- # # ---------------- #
# api.value.type = variant. # # api.value.type. #
# -------------------------- # # ---------------- #
# b4_value_type_setup_variant # b4_value_type_setup_variant
# --------------------------- # ---------------------------
@@ -686,13 +667,11 @@ typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
[m4_bmatch(b4_percent_define_get([[api.value.type]]), [m4_bmatch(b4_percent_define_get([[api.value.type]]),
[union\|union-directive], [union\|union-directive],
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED [[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
]b4_percent_define_get_syncline([[api.value.union.name]])[ typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
union ]b4_percent_define_get([[api.value.union.name]])[ union ]b4_union_name[
{ {
]b4_user_union_members[ ]b4_user_union_members[
}; };
]b4_percent_define_get_syncline([[api.value.union.name]])[
typedef union ]b4_percent_define_get([[api.value.union.name]])[ ]b4_api_PREFIX[STYPE;
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1 # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1 # define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
#endif #endif
@@ -804,7 +783,7 @@ m4_define([b4_yy_location_print_define],
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
YY_ATTRIBUTE_UNUSED __attribute__((__unused__))
]b4_function_define([yy_location_print_], ]b4_function_define([yy_location_print_],
[static unsigned], [static unsigned],
[[FILE *yyo], [yyo]], [[FILE *yyo], [yyo]],
+102 -126
View File
@@ -2,7 +2,7 @@
# GLR skeleton for Bison # GLR skeleton for Bison
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -178,42 +178,9 @@ m4_if(b4_skeleton, ["glr.c"],
## Output files. ## ## Output files. ##
## -------------- ## ## -------------- ##
# Unfortunately the order of generation between the header and the
# implementation file matters (for glr.c) because of the current
# implementation of api.value.type=union. In that case we still use a
# union for YYSTYPE, but we generate the contents of this union when
# setting up YYSTYPE. This is needed for other aspects, such as
# defining yy_symbol_value_print, since we need to now the name of the
# members of this union.
#
# To avoid this issue, just generate the header before the
# implementation file. But we should also make them more independant.
# ----------------- #
# The header file. #
# ----------------- #
# glr.cc produces its own header.
m4_if(b4_skeleton, ["glr.c"],
[b4_defines_if(
[b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2015, 2018])[
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file])[
]b4_output_end()
])])
# ------------------------- #
# The implementation file. #
# ------------------------- #
b4_output_begin([b4_parser_file_name]) b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison GLR parsers in C], b4_copyright([Skeleton implementation for Bison GLR parsers in C],
[2002-2015, 2018])[ [2002-2013])[
/* C GLR parser skeleton written by Paul Hilfinger. */ /* C GLR parser skeleton written by Paul Hilfinger. */
@@ -478,9 +445,9 @@ int yydebug;
struct yyGLRStack; struct yyGLRStack;
static void yypstack (struct yyGLRStack* yystackp, size_t yyk) static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
YY_ATTRIBUTE_UNUSED; __attribute__ ((__unused__));
static void yypdumpstack (struct yyGLRStack* yystackp) static void yypdumpstack (struct yyGLRStack* yystackp)
YY_ATTRIBUTE_UNUSED; __attribute__ ((__unused__));
#else /* !]b4_api_PREFIX[DEBUG */ #else /* !]b4_api_PREFIX[DEBUG */
@@ -702,15 +669,19 @@ struct yyGLRStack {
static void yyexpandGLRStack (yyGLRStack* yystackp); static void yyexpandGLRStack (yyGLRStack* yystackp);
#endif #endif
static _Noreturn void static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
__attribute__ ((__noreturn__));
static void
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg) yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
{ {
if (yymsg != YY_NULLPTR) if (yymsg != YY_NULL)
yyerror (]b4_yyerror_args[yymsg); yyerror (]b4_yyerror_args[yymsg);
YYLONGJMP (yystackp->yyexception_buffer, 1); YYLONGJMP (yystackp->yyexception_buffer, 1);
} }
static _Noreturn void static void yyMemoryExhausted (yyGLRStack* yystackp)
__attribute__ ((__noreturn__));
static void
yyMemoryExhausted (yyGLRStack* yystackp) yyMemoryExhausted (yyGLRStack* yystackp)
{ {
YYLONGJMP (yystackp->yyexception_buffer, 2); YYLONGJMP (yystackp->yyexception_buffer, 2);
@@ -731,7 +702,7 @@ yytokenName (yySymbol yytoken)
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
* containing the pointer to the next state in the chain. */ * containing the pointer to the next state in the chain. */
static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED; static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
static void static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{ {
@@ -748,7 +719,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
else else
/* The effect of using yysval or yyloc (in an immediate rule) is /* The effect of using yysval or yyloc (in an immediate rule) is
* undefined. */ * undefined. */
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[ yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[
yyvsp[i].yystate.yyloc = s->yyloc;]])[ yyvsp[i].yystate.yyloc = s->yyloc;]])[
s = yyvsp[i].yystate.yypred = s->yypred; s = yyvsp[i].yystate.yypred = s->yypred;
} }
@@ -758,7 +729,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
* For convenience, always return YYLOW1. */ * For convenience, always return YYLOW1. */
static inline int yyfill (yyGLRStackItem *, int *, int, yybool) static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
YY_ATTRIBUTE_UNUSED; __attribute__ ((__unused__));
static inline int static inline int
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
{ {
@@ -780,7 +751,8 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
yyGLRStack* yystackp, yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[) YYSTYPE* yyvalp]b4_locuser_formals[)
{ {
yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR); yybool yynormal __attribute__ ((__unused__)) =
(yystackp->yysplitPoint == YY_NULL);
int yylow; int yylow;
]b4_parse_param_use([yyvalp], [yylocp])dnl ]b4_parse_param_use([yyvalp], [yylocp])dnl
[ YYUSE (yyrhslen); [ YYUSE (yyrhslen);
@@ -808,7 +780,6 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
*yyvalp = yyval_default; *yyvalp = yyval_default;
else else
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[ *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
/* Default location. */
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
yystackp->yyerror_range[1].yystate.yyloc = *yylocp; yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
]])[ ]])[
@@ -865,10 +836,12 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
if (yydebug) if (yydebug)
{ {
if (yys->yysemantics.yyfirstVal) if (yys->yysemantics.yyfirstVal)
YYFPRINTF (stderr, "%s unresolved", yymsg); YYFPRINTF (stderr, "%s unresolved ", yymsg);
else else
YYFPRINTF (stderr, "%s incomplete", yymsg); YYFPRINTF (stderr, "%s incomplete ", yymsg);
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc); yy_symbol_print (stderr, yystos[yys->yylrState],
YY_NULL]b4_locuser_args([&yys->yyloc])[);
YYFPRINTF (stderr, "\n");
} }
#endif #endif
@@ -944,18 +917,14 @@ yygetLRActions (yyStateNum yystate, int yytoken,
} }
} }
/** Compute post-reduction state.
* \param yystate the current state
* \param yysym the nonterminal to push on the stack
*/
static inline yyStateNum static inline yyStateNum
yyLRgotoState (yyStateNum yystate, yySymbol yysym) yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
{ {
int yyr = yypgoto[yysym - YYNTOKENS] + yystate; int yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
return yytable[yyr]; return yytable[yyr];
else else
return yydefgoto[yysym - YYNTOKENS]; return yydefgoto[yylhs - YYNTOKENS];
} }
static inline yybool static inline yybool
@@ -997,7 +966,6 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
{ {
yySemanticOption* yynewOption = yySemanticOption* yynewOption =
&yynewGLRStackItem (yystackp, yyfalse)->yyoption; &yynewGLRStackItem (yystackp, yyfalse)->yyoption;
YYASSERT (!yynewOption->yyisState);
yynewOption->yystate = yyrhs; yynewOption->yystate = yyrhs;
yynewOption->yyrule = yyrule; yynewOption->yyrule = yyrule;
if (yystackp->yytops.yylookaheadNeeds[yyk]) if (yystackp->yytops.yylookaheadNeeds[yyk])
@@ -1025,7 +993,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
if (! yyset->yystates) if (! yyset->yystates)
return yyfalse; return yyfalse;
yyset->yystates[0] = YY_NULLPTR; yyset->yystates[0] = YY_NULL;
yyset->yylookaheadNeeds = yyset->yylookaheadNeeds =
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
if (! yyset->yylookaheadNeeds) if (! yyset->yylookaheadNeeds)
@@ -1055,8 +1023,8 @@ yyinitGLRStack (yyGLRStack* yystackp, size_t yysize)
if (!yystackp->yyitems) if (!yystackp->yyitems)
return yyfalse; return yyfalse;
yystackp->yynextFree = yystackp->yyitems; yystackp->yynextFree = yystackp->yyitems;
yystackp->yysplitPoint = YY_NULLPTR; yystackp->yysplitPoint = YY_NULL;
yystackp->yylastDeleted = YY_NULLPTR; yystackp->yylastDeleted = YY_NULL;
return yyinitStateSet (&yystackp->yytops); return yyinitStateSet (&yystackp->yytops);
} }
@@ -1095,10 +1063,10 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{ {
yyGLRState* yys0 = &yyp0->yystate; yyGLRState* yys0 = &yyp0->yystate;
yyGLRState* yys1 = &yyp1->yystate; yyGLRState* yys1 = &yyp1->yystate;
if (yys0->yypred != YY_NULLPTR) if (yys0->yypred != YY_NULL)
yys1->yypred = yys1->yypred =
YYRELOC (yyp0, yyp1, yys0->yypred, yystate); YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR) if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
yys1->yysemantics.yyfirstVal = yys1->yysemantics.yyfirstVal =
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
} }
@@ -1106,18 +1074,18 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{ {
yySemanticOption* yyv0 = &yyp0->yyoption; yySemanticOption* yyv0 = &yyp0->yyoption;
yySemanticOption* yyv1 = &yyp1->yyoption; yySemanticOption* yyv1 = &yyp1->yyoption;
if (yyv0->yystate != YY_NULLPTR) if (yyv0->yystate != YY_NULL)
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
if (yyv0->yynext != YY_NULLPTR) if (yyv0->yynext != YY_NULL)
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
} }
} }
if (yystackp->yysplitPoint != YY_NULLPTR) if (yystackp->yysplitPoint != YY_NULL)
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yysplitPoint, yystate); yystackp->yysplitPoint, yystate);
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
if (yystackp->yytops.yystates[yyn] != YY_NULLPTR) if (yystackp->yytops.yystates[yyn] != YY_NULL)
yystackp->yytops.yystates[yyn] = yystackp->yytops.yystates[yyn] =
YYRELOC (yystackp->yyitems, yynewItems, YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yytops.yystates[yyn], yystate); yystackp->yytops.yystates[yyn], yystate);
@@ -1141,7 +1109,7 @@ yyfreeGLRStack (yyGLRStack* yystackp)
static inline void static inline void
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys) yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
{ {
if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys) if (yystackp->yysplitPoint != YY_NULL && yystackp->yysplitPoint > yys)
yystackp->yysplitPoint = yys; yystackp->yysplitPoint = yys;
} }
@@ -1149,9 +1117,9 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
static inline void static inline void
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk) yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
{ {
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR) if (yystackp->yytops.yystates[yyk] != YY_NULL)
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
yystackp->yytops.yystates[yyk] = YY_NULLPTR; yystackp->yytops.yystates[yyk] = YY_NULL;
} }
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can /** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
@@ -1160,12 +1128,12 @@ yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
static void static void
yyundeleteLastStack (yyGLRStack* yystackp) yyundeleteLastStack (yyGLRStack* yystackp)
{ {
if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0) if (yystackp->yylastDeleted == YY_NULL || yystackp->yytops.yysize != 0)
return; return;
yystackp->yytops.yystates[0] = yystackp->yylastDeleted; yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
yystackp->yytops.yysize = 1; yystackp->yytops.yysize = 1;
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n")); YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
yystackp->yylastDeleted = YY_NULLPTR; yystackp->yylastDeleted = YY_NULL;
} }
static inline void static inline void
@@ -1175,7 +1143,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
yyi = yyj = 0; yyi = yyj = 0;
while (yyj < yystackp->yytops.yysize) while (yyj < yystackp->yytops.yysize)
{ {
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR) if (yystackp->yytops.yystates[yyi] == YY_NULL)
{ {
if (yyi == yyj) if (yyi == yyj)
{ {
@@ -1233,13 +1201,12 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
{ {
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
YYASSERT (yynewState->yyisState);
yynewState->yylrState = yylrState; yynewState->yylrState = yylrState;
yynewState->yyposn = yyposn; yynewState->yyposn = yyposn;
yynewState->yyresolved = yyfalse; yynewState->yyresolved = yyfalse;
yynewState->yypred = yystackp->yytops.yystates[yyk]; yynewState->yypred = yystackp->yytops.yystates[yyk];
yynewState->yysemantics.yyfirstVal = YY_NULLPTR; yynewState->yysemantics.yyfirstVal = YY_NULL;
yystackp->yytops.yystates[yyk] = yynewState; yystackp->yytops.yystates[yyk] = yynewState;
/* Invokes YY_RESERVE_GLRSTACK. */ /* Invokes YY_RESERVE_GLRSTACK. */
@@ -1299,7 +1266,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
{ {
int yynrhs = yyrhsLength (yyrule); int yynrhs = yyrhsLength (yyrule);
if (yystackp->yysplitPoint == YY_NULLPTR) if (yystackp->yysplitPoint == YY_NULL)
{ {
/* Standard special case: single stack. */ /* Standard special case: single stack. */
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
@@ -1351,13 +1318,14 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
{ {
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR) if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
{ {
YYSTYPE yysval;]b4_locations_if([[ YYRESULTTAG yyflag;
YYLTYPE yyloc;]])[ YYSTYPE yysval;]b4_locations_if([
YYLTYPE yyloc;])[
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[); yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR) if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL)
{ {
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
(unsigned long int) yyk, yyrule - 1)); (unsigned long int) yyk, yyrule - 1));
@@ -1390,7 +1358,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
"Now in state %d.\n", "Now in state %d.\n",
(unsigned long int) yyk, yyrule - 1, yynewLRState)); (unsigned long int) yyk, yyrule - 1, yynewLRState));
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR) if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
{ {
yyGLRState *yysplit = yystackp->yysplitPoint; yyGLRState *yysplit = yystackp->yysplitPoint;
yyGLRState *yyp = yystackp->yytops.yystates[yyi]; yyGLRState *yyp = yystackp->yytops.yystates[yyi];
@@ -1417,7 +1385,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
static size_t static size_t
yysplitStack (yyGLRStack* yystackp, size_t yyk) yysplitStack (yyGLRStack* yystackp, size_t yyk)
{ {
if (yystackp->yysplitPoint == YY_NULLPTR) if (yystackp->yysplitPoint == YY_NULL)
{ {
YYASSERT (yyk == 0); YYASSERT (yyk == 0);
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk]; yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
@@ -1427,7 +1395,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
yyGLRState** yynewStates; yyGLRState** yynewStates;
yybool* yynewLookaheadNeeds; yybool* yynewLookaheadNeeds;
yynewStates = YY_NULLPTR; yynewStates = YY_NULL;
if (yystackp->yytops.yycapacity if (yystackp->yytops.yycapacity
> (YYSIZEMAX / (2 * sizeof yynewStates[0]))) > (YYSIZEMAX / (2 * sizeof yynewStates[0])))
@@ -1438,7 +1406,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates, (yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
(yystackp->yytops.yycapacity (yystackp->yytops.yycapacity
* sizeof yynewStates[0])); * sizeof yynewStates[0]));
if (yynewStates == YY_NULLPTR) if (yynewStates == YY_NULL)
yyMemoryExhausted (yystackp); yyMemoryExhausted (yystackp);
yystackp->yytops.yystates = yynewStates; yystackp->yytops.yystates = yynewStates;
@@ -1446,7 +1414,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
(yystackp->yytops.yycapacity (yystackp->yytops.yycapacity
* sizeof yynewLookaheadNeeds[0])); * sizeof yynewLookaheadNeeds[0]));
if (yynewLookaheadNeeds == YY_NULLPTR) if (yynewLookaheadNeeds == YY_NULL)
yyMemoryExhausted (yystackp); yyMemoryExhausted (yystackp);
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
} }
@@ -1510,9 +1478,9 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal; yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
while (yytrue) while (yytrue)
{ {
if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR) if (yyz1 == *yyz0p || yyz1 == YY_NULL)
break; break;
else if (*yyz0p == YY_NULLPTR) else if (*yyz0p == YY_NULL)
{ {
*yyz0p = yyz1; *yyz0p = yyz1;
break; break;
@@ -1633,7 +1601,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred) for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
yystates[yyi] = yys; yystates[yyi] = yys;
if (yys == YY_NULLPTR) if (yys == YY_NULL)
{ {
yyleftmost_state.yyposn = 0; yyleftmost_state.yyposn = 0;
yystates[0] = &yyleftmost_state; yystates[0] = &yyleftmost_state;
@@ -1704,7 +1672,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
int yynrhs; int yynrhs;
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal; yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
YYASSERT (yyoption != YY_NULLPTR); YYASSERT (yyoption != YY_NULL);
yynrhs = yyrhsLength (yyoption->yyrule); yynrhs = yyrhsLength (yyoption->yyrule);
if (yynrhs > 0) if (yynrhs > 0)
{ {
@@ -1763,7 +1731,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
YYRESULTTAG yyflag;]b4_locations_if([ YYRESULTTAG yyflag;]b4_locations_if([
YYLTYPE *yylocp = &yys->yyloc;])[ YYLTYPE *yylocp = &yys->yyloc;])[
for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; ) for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
{ {
yySemanticOption* yyp = *yypp; yySemanticOption* yyp = *yypp;
@@ -1805,7 +1773,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
int yyprec = yydprec[yybest->yyrule]; int yyprec = yydprec[yybest->yyrule];
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[); yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
if (yyflag == yyok) if (yyflag == yyok)
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext) for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
{ {
if (yyprec == yydprec[yyp->yyrule]) if (yyprec == yydprec[yyp->yyrule])
{ {
@@ -1832,14 +1800,14 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
yys->yysemantics.yysval = yysval; yys->yysemantics.yysval = yysval;
} }
else else
yys->yysemantics.yyfirstVal = YY_NULLPTR; yys->yysemantics.yyfirstVal = YY_NULL;
return yyflag; return yyflag;
} }
static YYRESULTTAG static YYRESULTTAG
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[) yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
{ {
if (yystackp->yysplitPoint != YY_NULLPTR) if (yystackp->yysplitPoint != YY_NULL)
{ {
yyGLRState* yys; yyGLRState* yys;
int yyn; int yyn;
@@ -1859,10 +1827,10 @@ yycompressStack (yyGLRStack* yystackp)
{ {
yyGLRState* yyp, *yyq, *yyr; yyGLRState* yyp, *yyq, *yyr;
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR) if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULL)
return; return;
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR; for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULL;
yyp != yystackp->yysplitPoint; yyp != yystackp->yysplitPoint;
yyr = yyp, yyp = yyq, yyq = yyp->yypred) yyr = yyp, yyp = yyq, yyq = yyp->yypred)
yyp->yypred = yyr; yyp->yypred = yyr;
@@ -1870,10 +1838,10 @@ yycompressStack (yyGLRStack* yystackp)
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1; yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems; yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
yystackp->yysplitPoint = YY_NULLPTR; yystackp->yysplitPoint = YY_NULL;
yystackp->yylastDeleted = YY_NULLPTR; yystackp->yylastDeleted = YY_NULL;
while (yyr != YY_NULLPTR) while (yyr != YY_NULL)
{ {
yystackp->yynextFree->yystate = *yyr; yystackp->yynextFree->yystate = *yyr;
yyr = yyr->yypred; yyr = yyr->yypred;
@@ -1888,7 +1856,7 @@ static YYRESULTTAG
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
size_t yyposn]b4_pure_formals[) size_t yyposn]b4_pure_formals[)
{ {
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR) while (yystackp->yytops.yystates[yyk] != YY_NULL)
{ {
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
@@ -2010,13 +1978,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
#else #else
{ {
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken)); size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken));
size_t yysize = yysize0; size_t yysize = yysize0;
yybool yysize_overflow = yyfalse; yybool yysize_overflow = yyfalse;
char* yymsg = YY_NULLPTR; char* yymsg = YY_NULL;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = YY_NULLPTR; const char *yyformat = YY_NULL;
/* Arguments of yyformat. */ /* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
@@ -2072,7 +2040,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
} }
yyarg[yycount++] = yytokenName (yyx); yyarg[yycount++] = yytokenName (yyx);
{ {
size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx)); size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
yysize_overflow |= yysz < yysize; yysize_overflow |= yysz < yysize;
yysize = yysz; yysize = yysz;
} }
@@ -2086,7 +2054,6 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error")); YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -2151,7 +2118,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{ {
yySymbol yytoken; yySymbol yytoken;
if (yychar == YYEOF) if (yychar == YYEOF)
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR); yyFail (yystackp][]b4_lpure_args[, YY_NULL);
if (yychar != YYEMPTY) if (yychar != YYEMPTY)
{]b4_locations_if([[ {]b4_locations_if([[
/* We throw away the lookahead, but the error range /* We throw away the lookahead, but the error range
@@ -2192,10 +2159,10 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Reduce to one stack. */ /* Reduce to one stack. */
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR) if (yystackp->yytops.yystates[yyk] != YY_NULL)
break; break;
if (yyk >= yystackp->yytops.yysize) if (yyk >= yystackp->yytops.yysize)
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR); yyFail (yystackp][]b4_lpure_args[, YY_NULL);
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1) for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
yyremoveDeletes (yystackp); yyremoveDeletes (yystackp);
@@ -2203,7 +2170,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Now pop stack until we find a state that shifts the error token. */ /* Now pop stack until we find a state that shifts the error token. */
yystackp->yyerrState = 3; yystackp->yyerrState = 3;
while (yystackp->yytops.yystates[0] != YY_NULLPTR) while (yystackp->yytops.yystates[0] != YY_NULL)
{ {
yyGLRState *yys = yystackp->yytops.yystates[0]; yyGLRState *yys = yystackp->yytops.yystates[0];
yyj = yypact[yys->yylrState]; yyj = yypact[yys->yylrState];
@@ -2227,14 +2194,14 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
} }
}]b4_locations_if([[ }]b4_locations_if([[
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
if (yys->yypred != YY_NULLPTR) if (yys->yypred != YY_NULL)
yydestroyGLRState ("Error: popping", yys]b4_user_args[); yydestroyGLRState ("Error: popping", yys]b4_user_args[);
yystackp->yytops.yystates[0] = yys->yypred; yystackp->yytops.yystates[0] = yys->yypred;
yystackp->yynextFree -= 1; yystackp->yynextFree -= 1;
yystackp->yyspaceLeft += 1; yystackp->yyspaceLeft += 1;
} }
if (yystackp->yytops.yystates[0] == YY_NULLPTR) if (yystackp->yytops.yystates[0] == YY_NULL)
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR); yyFail (yystackp][]b4_lpure_args[, YY_NULL);
} }
#define YYCHK1(YYE) \ #define YYCHK1(YYE) \
@@ -2307,8 +2274,8 @@ b4_dollar_popdef])[]dnl
{ {
yyrule = yydefaultAction (yystate); yyrule = yydefaultAction (yystate);
if (yyrule == 0) if (yyrule == 0)
{]b4_locations_if([[ {
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2347,8 +2314,8 @@ b4_dollar_popdef])[]dnl
yystack.yyerrState -= 1; yystack.yyerrState -= 1;
} }
else if (yyisErrorAction (yyaction)) else if (yyisErrorAction (yyaction))
{]b4_locations_if([[ {
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2393,8 +2360,8 @@ b4_dollar_popdef])[]dnl
if (yystack.yytops.yysize == 0) if (yystack.yytops.yysize == 0)
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[ YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2475,9 +2442,9 @@ b4_dollar_popdef])[]dnl
{ {
while (yystates[yyk]) while (yystates[yyk])
{ {
yyGLRState *yys = yystates[yyk];]b4_locations_if([[ yyGLRState *yys = yystates[yyk];
yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
if (yys->yypred != YY_NULLPTR) )[ if (yys->yypred != YY_NULL)
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[yyk] = yys->yypred; yystates[yyk] = yys->yypred;
yystack.yynextFree -= 1; yystack.yynextFree -= 1;
@@ -2509,7 +2476,7 @@ yy_yypstack (yyGLRState* yys)
static void static void
yypstates (yyGLRState* yyst) yypstates (yyGLRState* yyst)
{ {
if (yyst == YY_NULLPTR) if (yyst == YY_NULL)
YYFPRINTF (stderr, "<null>"); YYFPRINTF (stderr, "<null>");
else else
yy_yypstack (yyst); yy_yypstack (yyst);
@@ -2523,7 +2490,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk)
} }
#define YYINDEX(YYX) \ #define YYINDEX(YYX) \
((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) ((YYX) == YY_NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
static void static void
@@ -2537,8 +2504,6 @@ yypdumpstack (yyGLRStack* yystackp)
(unsigned long int) (yyp - yystackp->yyitems)); (unsigned long int) (yyp - yystackp->yyitems));
if (*(yybool *) yyp) if (*(yybool *) yyp)
{ {
YYASSERT (yyp->yystate.yyisState);
YYASSERT (yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
yyp->yystate.yyresolved, yyp->yystate.yylrState, yyp->yystate.yyresolved, yyp->yystate.yylrState,
(unsigned long int) yyp->yystate.yyposn, (unsigned long int) yyp->yystate.yyposn,
@@ -2550,8 +2515,6 @@ yypdumpstack (yyGLRStack* yystackp)
} }
else else
{ {
YYASSERT (!yyp->yystate.yyisState);
YYASSERT (!yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
yyp->yyoption.yyrule - 1, yyp->yyoption.yyrule - 1,
(long int) YYINDEX (yyp->yyoption.yystate), (long int) YYINDEX (yyp->yyoption.yystate),
@@ -2585,3 +2548,16 @@ m4_if(b4_prefix, [yy], [],
]b4_epilogue[]dnl ]b4_epilogue[]dnl
b4_output_end() b4_output_end()
# glr.cc produces its own header.
m4_if(b4_skeleton, ["glr.c"],
[b4_defines_if(
[b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2013])[
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file])[
]b4_output_end()
])])
+3 -3
View File
@@ -1,6 +1,6 @@
# C++ GLR skeleton for Bison # C++ GLR skeleton for Bison
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -177,7 +177,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
| Print this symbol. | | Print this symbol. |
`--------------------*/ `--------------------*/
void inline void
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep]b4_locations_if([[, const semantic_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[) const location_type* yylocationp]])[)
@@ -329,7 +329,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
b4_defines_if( b4_defines_if(
[b4_output_begin([b4_spec_defines_file]) [b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C++], b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002-2015, 2018])[ [2002-2013])[
// C++ GLR parser skeleton written by Akim Demaille. // C++ GLR parser skeleton written by Akim Demaille.
+1 -1
View File
@@ -2,7 +2,7 @@
# Java skeleton dispatching for Bison. # Java skeleton dispatching for Bison.
# Copyright (C) 2007, 2009-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Java language support for Bison # Java language support for Bison
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2007-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+142 -149
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -131,7 +131,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2015, 2018]) [2002-2013])
m4_define([b4_parser_class_name], m4_define([b4_parser_class_name],
[b4_percent_define_get([[parser_class_name]])]) [b4_percent_define_get([[parser_class_name]])])
@@ -142,23 +142,21 @@ b4_bison_locations_if([# Backward compatibility.
m4_include(b4_pkgdatadir/[stack.hh]) m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])]) b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
# b4_shared_declarations(hh|cc) # b4_shared_declarations
# ----------------------------- # ----------------------
# Declaration that might either go into the header (if --defines, $1 = hh) # Declaration that might either go into the header (if --defines)
# or open coded in the parser body. # or open coded in the parser body.
m4_define([b4_shared_declarations], m4_define([b4_shared_declarations],
[b4_percent_code_get([[requires]])[ [b4_percent_code_get([[requires]])[
]b4_parse_assert_if([# include <cassert>])[ ]b4_parse_assert_if([# include <cassert>])[
# include <cstdlib> // std::abort # include <vector>
# include <iostream> # include <iostream>
# include <stdexcept> # include <stdexcept>
# include <string> # include <string>]b4_defines_if([[
# include <vector>]b4_defines_if([[
# include "stack.hh" # include "stack.hh"
]b4_bison_locations_if([[# include "location.hh"]])])[ ]b4_bison_locations_if([[# include "location.hh"]])])[
]b4_variant_if([b4_variant_includes])[ ]b4_variant_if([b4_variant_includes])[
]b4_attribute_define[
]b4_YYDEBUG_define[ ]b4_YYDEBUG_define[
]b4_namespace_open[ ]b4_namespace_open[
@@ -185,14 +183,14 @@ b4_location_define])])[
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
/// The current debugging stream. /// The current debugging stream.
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE; std::ostream& debug_stream () const;
/// Set the current debugging stream. /// Set the current debugging stream.
void set_debug_stream (std::ostream &); void set_debug_stream (std::ostream &);
/// Type for debugging levels. /// Type for debugging levels.
typedef int debug_level_type; typedef int debug_level_type;
/// The current debugging level. /// The current debugging level.
debug_level_type debug_level () const YY_ATTRIBUTE_PURE; debug_level_type debug_level () const;
/// Set the current debugging level. /// Set the current debugging level.
void set_debug_level (debug_level_type l); void set_debug_level (debug_level_type l);
#endif #endif
@@ -215,14 +213,14 @@ b4_location_define])])[
/// Generate an error message. /// Generate an error message.
/// \param yystate the state where the error occurred. /// \param yystate the state where the error occurred.
/// \param yyla the lookahead token. /// \param yytoken the lookahead token type, or yyempty_.
virtual std::string yysyntax_error_ (state_type yystate, virtual std::string yysyntax_error_ (state_type yystate,
const symbol_type& yyla) const; symbol_number_type yytoken) const;
/// Compute post-reduction state. /// Compute post-reduction state.
/// \param yystate the current state /// \param yystate the current state
/// \param yysym the nonterminal to push on the stack /// \param yylhs the nonterminal to push on the stack
state_type yy_lr_goto_state_ (state_type yystate, int yysym); state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
/// Whether the given \c yypact_ value indicates a defaulted state. /// Whether the given \c yypact_ value indicates a defaulted state.
/// \param yyvalue the value to check /// \param yyvalue the value to check
@@ -269,7 +267,7 @@ b4_location_define])])[
/// \brief Reclaim the memory associated to a symbol. /// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed. /// \param yymsg Why this token is reclaimed.
/// If null, print nothing. /// If null, print nothing.
/// \param yysym The symbol. /// \param s The symbol.
template <typename Base> template <typename Base>
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const; void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
@@ -289,21 +287,16 @@ b4_location_define])])[
/// Copy constructor. /// Copy constructor.
by_state (const by_state& other); by_state (const by_state& other);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol type from \a that. /// Steal the symbol type from \a that.
void move (by_state& that); void move (by_state& that);
/// The (internal) type number (corresponding to \a state). /// The (internal) type number (corresponding to \a state).
/// \a empty_symbol when empty. /// "empty" when empty.
symbol_number_type type_get () const; symbol_number_type type_get () const;
/// The state number used to denote an empty symbol. enum { empty = 0 };
enum { empty_state = -1 };
/// The state. /// The state.
/// \a empty when empty.
state_type state; state_type state;
}; };
@@ -314,8 +307,6 @@ b4_location_define])])[
typedef basic_symbol<by_state> super_type; typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol. /// Construct an empty symbol.
stack_symbol_type (); stack_symbol_type ();
/// Copy construct.
stack_symbol_type (const stack_symbol_type& that);
/// Steal the contents from \a sym to build this. /// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, symbol_type& sym); stack_symbol_type (state_type s, symbol_type& sym);
/// Assignment, needed by push_back. /// Assignment, needed by push_back.
@@ -344,25 +335,26 @@ b4_location_define])])[
void yypush_ (const char* m, state_type s, symbol_type& sym); void yypush_ (const char* m, state_type s, symbol_type& sym);
/// Pop \a n symbols the three stacks. /// Pop \a n symbols the three stacks.
void yypop_ (unsigned n = 1); void yypop_ (unsigned int n = 1);
/// Constants. // Constants.
enum enum
{ {
yyeof_ = 0, yyeof_ = 0,
yylast_ = ]b4_last[, ///< Last index in yytable_. yylast_ = ]b4_last[, //< Last index in yytable_.
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols. yynnts_ = ]b4_nterms_number[, //< Number of nonterminal symbols.
yyfinal_ = ]b4_final_state_number[, ///< Termination state number. yyempty_ = -2,
yyfinal_ = ]b4_final_state_number[, //< Termination state number.
yyterror_ = 1, yyterror_ = 1,
yyerrcode_ = 256, yyerrcode_ = 256,
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens. yyntokens_ = ]b4_tokens_number[ //< Number of tokens.
}; };
]b4_parse_param_vars[ ]b4_parse_param_vars[
}; };
]b4_token_ctor_if([b4_yytranslate_define([$1])[ ]b4_token_ctor_if([b4_yytranslate_define
]b4_public_types_define([$1])])[ b4_public_types_define])[
]b4_namespace_close[ ]b4_namespace_close[
]b4_percent_define_flag_if([[global_tokens_and_yystype]], ]b4_percent_define_flag_if([[global_tokens_and_yystype]],
@@ -388,7 +380,7 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
// C++ LALR(1) parser skeleton written by Akim Demaille. // C++ LALR(1) parser skeleton written by Akim Demaille.
]b4_cpp_guard_open([b4_spec_defines_file])[ ]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations(hh)[ ]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file]) ]b4_cpp_guard_close([b4_spec_defines_file])
b4_output_end() b4_output_end()
]) ])
@@ -408,7 +400,7 @@ m4_if(b4_prefix, [yy], [],
]b4_null_define[ ]b4_null_define[
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], ]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
[b4_shared_declarations([cc])])[ [b4_shared_declarations])[
// User implementation prologue. // User implementation prologue.
]b4_user_post_prologue[ ]b4_user_post_prologue[
@@ -445,7 +437,7 @@ m4_if(b4_prefix, [yy], [],
{ \ { \
*yycdebug_ << Title << ' '; \ *yycdebug_ << Title << ' '; \
yy_print_ (*yycdebug_, Symbol); \ yy_print_ (*yycdebug_, Symbol); \
*yycdebug_ << '\n'; \ *yycdebug_ << std::endl; \
} \ } \
} while (false) } while (false)
@@ -464,14 +456,14 @@ m4_if(b4_prefix, [yy], [],
#else // !]b4_api_PREFIX[DEBUG #else // !]b4_api_PREFIX[DEBUG
# define YYCDEBUG if (false) std::cerr # define YYCDEBUG if (false) std::cerr
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol) # define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0) # define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
# define YY_STACK_PRINT() static_cast<void> (0) # define YY_STACK_PRINT() static_cast<void>(0)
#endif // !]b4_api_PREFIX[DEBUG #endif // !]b4_api_PREFIX[DEBUG
#define yyerrok (yyerrstatus_ = 0) #define yyerrok (yyerrstatus_ = 0)
#define yyclearin (yyla.clear ()) #define yyclearin (yyempty = true)
#define YYACCEPT goto yyacceptlab #define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab #define YYABORT goto yyabortlab
@@ -535,54 +527,45 @@ m4_if(b4_prefix, [yy], [],
| Symbol types. | | Symbol types. |
`---------------*/ `---------------*/
]b4_token_ctor_if([], [b4_public_types_define([cc])])[ ]b4_token_ctor_if([], [b4_public_types_define])[
// by_state. // by_state.
inline
]b4_parser_class_name[::by_state::by_state () ]b4_parser_class_name[::by_state::by_state ()
: state (empty_state) : state (empty)
{} {}
inline
]b4_parser_class_name[::by_state::by_state (const by_state& other) ]b4_parser_class_name[::by_state::by_state (const by_state& other)
: state (other.state) : state (other.state)
{} {}
void inline
]b4_parser_class_name[::by_state::clear ()
{
state = empty_state;
}
void void
]b4_parser_class_name[::by_state::move (by_state& that) ]b4_parser_class_name[::by_state::move (by_state& that)
{ {
state = that.state; state = that.state;
that.clear (); that.state = empty;
} }
inline
]b4_parser_class_name[::by_state::by_state (state_type s) ]b4_parser_class_name[::by_state::by_state (state_type s)
: state (s) : state (s)
{} {}
inline
]b4_parser_class_name[::symbol_number_type ]b4_parser_class_name[::symbol_number_type
]b4_parser_class_name[::by_state::type_get () const ]b4_parser_class_name[::by_state::type_get () const
{ {
if (state == empty_state) return state == empty ? 0 : yystos_[state];
return empty_symbol;
else
return yystos_[state];
} }
inline
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type () ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
{} {}
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
: super_type (that.state]b4_locations_if([, that.location])[)
{
]b4_variant_if([b4_symbol_variant([that.type_get ()],
[value], [copy], [that.value])],
[[value = that.value;]])[
}
inline
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that) ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
: super_type (s]b4_locations_if([, that.location])[) : super_type (s]b4_locations_if([, that.location])[)
{ {
@@ -590,9 +573,10 @@ m4_if(b4_prefix, [yy], [],
[value], [move], [that.value])], [value], [move], [that.value])],
[[value = that.value;]])[ [[value = that.value;]])[
// that is emptied. // that is emptied.
that.type = empty_symbol; that.type = empty;
} }
inline
]b4_parser_class_name[::stack_symbol_type& ]b4_parser_class_name[::stack_symbol_type&
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that) ]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
{ {
@@ -606,6 +590,7 @@ m4_if(b4_prefix, [yy], [],
template <typename Base> template <typename Base>
inline
void void
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const ]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
{ {
@@ -625,10 +610,6 @@ m4_if(b4_prefix, [yy], [],
std::ostream& yyoutput = yyo; std::ostream& yyoutput = yyo;
YYUSE (yyoutput); YYUSE (yyoutput);
symbol_number_type yytype = yysym.type_get (); symbol_number_type yytype = yysym.type_get ();
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
// below array bounds".
if (yysym.empty ())
std::abort ();
yyo << (yytype < yyntokens_ ? "token" : "nterm") yyo << (yytype < yyntokens_ ? "token" : "nterm")
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([ << ' ' << yytname_[yytype] << " ("]b4_locations_if([
<< yysym.location << ": "])[; << yysym.location << ": "])[;
@@ -637,6 +618,7 @@ m4_if(b4_prefix, [yy], [],
} }
#endif #endif
inline
void void
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym) ]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
{ {
@@ -644,6 +626,7 @@ m4_if(b4_prefix, [yy], [],
yypush_ (m, t); yypush_ (m, t);
} }
inline
void void
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s) ]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
{ {
@@ -652,8 +635,9 @@ m4_if(b4_prefix, [yy], [],
yystack_.push (s); yystack_.push (s);
} }
inline
void void
]b4_parser_class_name[::yypop_ (unsigned n) ]b4_parser_class_name[::yypop_ (unsigned int n)
{ {
yystack_.pop (n); yystack_.pop (n);
} }
@@ -685,23 +669,23 @@ m4_if(b4_prefix, [yy], [],
} }
#endif // ]b4_api_PREFIX[DEBUG #endif // ]b4_api_PREFIX[DEBUG
]b4_parser_class_name[::state_type inline ]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym) ]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
{ {
int yyr = yypgoto_[yysym - yyntokens_] + yystate; int yyr = yypgoto_[yylhs - yyntokens_] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr]; return yytable_[yyr];
else else
return yydefgoto_[yysym - yyntokens_]; return yydefgoto_[yylhs - yyntokens_];
} }
bool inline bool
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue) ]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
{ {
return yyvalue == yypact_ninf_; return yyvalue == yypact_ninf_;
} }
bool inline bool
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue) ]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
{ {
return yyvalue == yytable_ninf_; return yyvalue == yytable_ninf_;
@@ -710,9 +694,11 @@ m4_if(b4_prefix, [yy], [],
int int
]b4_parser_class_name[::parse () ]b4_parser_class_name[::parse ()
{ {
/// Whether yyla contains a lookahead.
bool yyempty = true;
// State. // State.
int yyn; int yyn;
/// Length of the RHS of the rule being reduced.
int yylen = 0; int yylen = 0;
// Error handling. // Error handling.
@@ -725,6 +711,9 @@ m4_if(b4_prefix, [yy], [],
/// The locations where the error started and ended. /// The locations where the error started and ended.
stack_symbol_type yyerror_range[3];]])[ stack_symbol_type yyerror_range[3];]])[
/// $$ and @@$.
stack_symbol_type yylhs;
/// The return value of parse (). /// The return value of parse ().
int yyresult; int yyresult;
@@ -732,7 +721,7 @@ m4_if(b4_prefix, [yy], [],
// avoid gratuitous conflicts when merging into the master branch. // avoid gratuitous conflicts when merging into the master branch.
try try
{ {
YYCDEBUG << "Starting parse\n"; YYCDEBUG << "Starting parse" << std::endl;
]m4_ifdef([b4_initial_action], [ ]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
@@ -745,11 +734,11 @@ b4_dollar_popdef])[]dnl
location values to have been already stored, initialize these location values to have been already stored, initialize these
stacks with a primary value. */ stacks with a primary value. */
yystack_.clear (); yystack_.clear ();
yypush_ (YY_NULLPTR, 0, yyla); yypush_ (YY_NULL, 0, yyla);
// A new symbol was pushed on the stack. // A new symbol was pushed on the stack.
yynewstate: yynewstate:
YYCDEBUG << "Entering state " << yystack_[0].state << '\n'; YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
// Accept? // Accept?
if (yystack_[0].state == yyfinal_) if (yystack_[0].state == yyfinal_)
@@ -766,7 +755,7 @@ b4_dollar_popdef])[]dnl
goto yydefault; goto yydefault;
// Read a lookahead token. // Read a lookahead token.
if (yyla.empty ()) if (yyempty)
{ {
YYCDEBUG << "Reading a token: "; YYCDEBUG << "Reading a token: ";
try try
@@ -780,6 +769,7 @@ b4_dollar_popdef])[]dnl
error (yyexc); error (yyexc);
goto yyerrlab1; goto yyerrlab1;
} }
yyempty = false;
} }
YY_SYMBOL_PRINT ("Next token is", yyla); YY_SYMBOL_PRINT ("Next token is", yyla);
@@ -799,6 +789,9 @@ b4_dollar_popdef])[]dnl
goto yyreduce; goto yyreduce;
} }
// Discard the token being shifted.
yyempty = true;
// Count tokens shifted since error; after three, turn off error status. // Count tokens shifted since error; after three, turn off error status.
if (yyerrstatus_) if (yyerrstatus_)
--yyerrstatus_; --yyerrstatus_;
@@ -821,56 +814,52 @@ b4_dollar_popdef])[]dnl
`-----------------------------*/ `-----------------------------*/
yyreduce: yyreduce:
yylen = yyr2_[yyn]; yylen = yyr2_[yyn];
{ yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
stack_symbol_type yylhs; /* Variants are always initialized to an empty instance of the
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([ correct type. The default $$=$1 action is NOT applied when using
/* Variants are always initialized to an empty instance of the variants. */
correct type. The default '$$ = $1' action is NOT applied b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
when using variants. */ /* If YYLEN is nonzero, implement the default value of the action:
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])], [ '$$ = $1'. Otherwise, use the top of the stack.
/* If YYLEN is nonzero, implement the default value of the
action: '$$ = $1'. Otherwise, use the top of the stack.
Otherwise, the following line sets YYLHS.VALUE to garbage. Otherwise, the following line sets YYLHS.VALUE to garbage.
This behavior is undocumented and Bison users should not rely This behavior is undocumented and Bison
upon it. */ users should not rely upon it. */
if (yylen) if (yylen)
yylhs.value = yystack_@{yylen - 1@}.value; yylhs.value = yystack_@{yylen - 1@}.value;
else else
yylhs.value = yystack_@{0@}.value;])[ yylhs.value = yystack_@{0@}.value;])[
]b4_locations_if([dnl ]b4_locations_if([dnl
[ [
// Default location. // Compute the default @@$.
{
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
}]])[
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
try
{ {
slice<stack_symbol_type, stack_type> slice (yystack_, yylen); switch (yyn)
YYLLOC_DEFAULT (yylhs.location, slice, yylen); {
yyerror_range[1].location = yylhs.location;
}]])[
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
try
{
switch (yyn)
{
]b4_user_actions[ ]b4_user_actions[
default: default:
break; break;
} }
} }
catch (const syntax_error& yyexc) catch (const syntax_error& yyexc)
{ {
error (yyexc); error (yyexc);
YYERROR; YYERROR;
} }
YY_SYMBOL_PRINT ("-> $$ =", yylhs); YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen); yypop_ (yylen);
yylen = 0; yylen = 0;
YY_STACK_PRINT (); YY_STACK_PRINT ();
// Shift the result of the reduction. // Shift the result of the reduction.
yypush_ (YY_NULLPTR, yylhs); yypush_ (YY_NULL, yylhs);
}
goto yynewstate; goto yynewstate;
/*--------------------------------------. /*--------------------------------------.
@@ -882,7 +871,8 @@ b4_dollar_popdef])[]dnl
{ {
++yynerrs_; ++yynerrs_;
error (]b4_join(b4_locations_if([yyla.location]), error (]b4_join(b4_locations_if([yyla.location]),
[[yysyntax_error_ (yystack_[0].state, yyla)]])[); [[yysyntax_error_ (yystack_[0].state,
yyempty ? yyempty_ : yyla.type_get ())]])[);
} }
]b4_locations_if([[ ]b4_locations_if([[
@@ -895,10 +885,10 @@ b4_dollar_popdef])[]dnl
// Return failure if at end of input. // Return failure if at end of input.
if (yyla.type_get () == yyeof_) if (yyla.type_get () == yyeof_)
YYABORT; YYABORT;
else if (!yyla.empty ()) else if (!yyempty)
{ {
yy_destroy_ ("Error: discarding", yyla); yy_destroy_ ("Error: discarding", yyla);
yyla.clear (); yyempty = true;
} }
} }
@@ -915,7 +905,11 @@ b4_dollar_popdef])[]dnl
YYERROR and the label yyerrorlab therefore never appears in user YYERROR and the label yyerrorlab therefore never appears in user
code. */ code. */
if (false) if (false)
goto yyerrorlab; goto yyerrorlab;]b4_locations_if([[
yyerror_range[1].location = yystack_[yylen - 1].location;]])b4_variant_if([[
/* $$ was initialized before running the user action. */
YY_SYMBOL_PRINT ("Error: discarding", yylhs);
yylhs.~stack_symbol_type();]])[
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */
yypop_ (yylen); yypop_ (yylen);
@@ -973,7 +967,7 @@ b4_dollar_popdef])[]dnl
goto yyreturn; goto yyreturn;
yyreturn: yyreturn:
if (!yyla.empty ()) if (!yyempty)
yy_destroy_ ("Cleanup: discarding lookahead", yyla); yy_destroy_ ("Cleanup: discarding lookahead", yyla);
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
@@ -989,15 +983,16 @@ b4_dollar_popdef])[]dnl
} }
catch (...) catch (...)
{ {
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n"; YYCDEBUG << "Exception caught: cleaning lookahead and stack"
<< std::endl;
// Do not try to display the values of the reclaimed symbols, // Do not try to display the values of the reclaimed symbols,
// as their printer might throw an exception. // as their printer might throw an exception.
if (!yyla.empty ()) if (!yyempty)
yy_destroy_ (YY_NULLPTR, yyla); yy_destroy_ (YY_NULL, yyla);
while (1 < yystack_.size ()) while (1 < yystack_.size ())
{ {
yy_destroy_ (YY_NULLPTR, yystack_[0]); yy_destroy_ (YY_NULL, yystack_[0]);
yypop_ (); yypop_ ();
} }
throw; throw;
@@ -1008,15 +1003,16 @@ b4_dollar_popdef])[]dnl
]b4_parser_class_name[::error (const syntax_error& yyexc) ]b4_parser_class_name[::error (const syntax_error& yyexc)
{ {
error (]b4_join(b4_locations_if([yyexc.location]), error (]b4_join(b4_locations_if([yyexc.location]),
[[yyexc.what ()]])[); [[yyexc.what()]])[);
} }
// Generate an error message. // Generate an error message.
std::string std::string
]b4_parser_class_name[::yysyntax_error_ (]dnl ]b4_parser_class_name[::yysyntax_error_ (]dnl
b4_error_verbose_if([state_type yystate, const symbol_type& yyla], b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
[state_type, const symbol_type&])[) const [state_type, symbol_number_type])[) const
{]b4_error_verbose_if([[ {]b4_error_verbose_if([[
std::string yyres;
// Number of reported tokens (one for the "unexpected", one per // Number of reported tokens (one for the "unexpected", one per
// "expected"). // "expected").
size_t yycount = 0; size_t yycount = 0;
@@ -1030,7 +1026,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
the only way this function was invoked is if the default action the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected is an error action. In that case, don't check for expected
tokens because there are none. tokens because there are none.
- The only way there can be no lookahead present (in yyla) is - The only way there can be no lookahead present (in yytoken) is
if this state is a consistent state with a default action. if this state is a consistent state with a default action.
Thus, detecting the absence of a lookahead is sufficient to Thus, detecting the absence of a lookahead is sufficient to
determine that there is no unexpected or expected token to determine that there is no unexpected or expected token to
@@ -1050,9 +1046,8 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
token that will not be accepted due to an error action in a token that will not be accepted due to an error action in a
later state. later state.
*/ */
if (!yyla.empty ()) if (yytoken != yyempty_)
{ {
int yytoken = yyla.type_get ();
yyarg[yycount++] = yytname_[yytoken]; yyarg[yycount++] = yytname_[yytoken];
int yyn = yypact_[yystate]; int yyn = yypact_[yystate];
if (!yy_pact_value_is_default_ (yyn)) if (!yy_pact_value_is_default_ (yyn))
@@ -1079,24 +1074,22 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
} }
} }
char const* yyformat = YY_NULLPTR; char const* yyformat = YY_NULL;
switch (yycount) switch (yycount)
{ {
#define YYCASE_(N, S) \ #define YYCASE_(N, S) \
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
default: // Avoid compiler warnings. YYCASE_(0, YY_("syntax error"));
YYCASE_ (0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_ (1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
#undef YYCASE_ #undef YYCASE_
} }
std::string yyres;
// Argument number. // Argument number.
size_t yyi = 0; size_t yyi = 0;
for (char const* yyp = yyformat; *yyp; ++yyp) for (char const* yyp = yyformat; *yyp; ++yyp)
@@ -1140,18 +1133,18 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
i_end = yystack_.end (); i_end = yystack_.end ();
i != i_end; ++i) i != i_end; ++i)
*yycdebug_ << ' ' << i->state; *yycdebug_ << ' ' << i->state;
*yycdebug_ << '\n'; *yycdebug_ << std::endl;
} }
// Report on the debug stream that the rule \a yyrule is going to be reduced. // Report on the debug stream that the rule \a yyrule is going to be reduced.
void void
]b4_parser_class_name[::yy_reduce_print_ (int yyrule) ]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
{ {
unsigned yylno = yyrline_[yyrule]; unsigned int yylno = yyrline_[yyrule];
int yynrhs = yyr2_[yyrule]; int yynrhs = yyr2_[yyrule];
// Print the symbols being reduced, and their result. // Print the symbols being reduced, and their result.
*yycdebug_ << "Reducing stack by rule " << yyrule - 1 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
<< " (line " << yylno << "):\n"; << " (line " << yylno << "):" << std::endl;
// The symbols being reduced. // The symbols being reduced.
for (int yyi = 0; yyi < yynrhs; yyi++) for (int yyi = 0; yyi < yynrhs; yyi++)
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
@@ -1159,7 +1152,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
} }
#endif // ]b4_api_PREFIX[DEBUG #endif // ]b4_api_PREFIX[DEBUG
]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[ ]b4_token_ctor_if([], [b4_yytranslate_define])[
]b4_namespace_close[ ]b4_namespace_close[
]b4_epilogue[]dnl ]b4_epilogue[]dnl
b4_output_end() b4_output_end()
+10 -16
View File
@@ -1,6 +1,6 @@
# Java skeleton for Bison -*- autoconf -*- # Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2007-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ m4_define([b4_define_state],[[
b4_output_begin([b4_parser_file_name]) b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java], b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2015, 2018]) [2007-2013])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]); b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */ ])[/* First part of user declarations. */
@@ -453,19 +453,6 @@ b4_define_state])[
return yyerrstatus_ == 0; return yyerrstatus_ == 0;
} }
/** Compute post-reduction state.
* @@param yystate the current state
* @@param yysym the nonterminal to push on the stack
*/
private int yy_lr_goto_state_ (int yystate, int yysym)
{
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr];
else
return yydefgoto_[yysym - yyntokens_];
}
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[ private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
{ {
]b4_yystype[ yyval; ]b4_yystype[ yyval;
@@ -496,7 +483,14 @@ b4_define_state])[
yylen = 0; yylen = 0;
/* Shift the result of the reduction. */ /* Shift the result of the reduction. */
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]); yyn = yyr1_[yyn];
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
if (0 <= yystate && yystate <= yylast_
&& yycheck_[yystate] == yystack.stateAt (0))
yystate = yytable_[yystate];
else
yystate = yydefgoto_[yyn - yyntokens_];
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[); yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
return YYNEWSTATE; return YYNEWSTATE;
} }
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2002, 2005-2015, 2018 Free Software Foundation, Inc. ## Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+40 -41
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2015, 2018]) [2002-2013])
# b4_position_define # b4_position_define
# ------------------ # ------------------
@@ -27,19 +27,20 @@ m4_define([b4_position_define],
{ {
public:]m4_ifdef([b4_location_constructors], [[ public:]m4_ifdef([b4_location_constructors], [[
/// Construct a position. /// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR, explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
unsigned l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
: filename (f) : filename (f)
, line (l) , line (l)
, column (c) , column (c)
{} {
}
]])[ ]])[
/// Initialization. /// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR, void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
unsigned l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
{ {
filename = fn; filename = fn;
line = l; line = l;
@@ -68,21 +69,21 @@ m4_define([b4_position_define],
/// File name to which this position refers. /// File name to which this position refers.
]b4_percent_define_get([[filename_type]])[* filename; ]b4_percent_define_get([[filename_type]])[* filename;
/// Current line number. /// Current line number.
unsigned line; unsigned int line;
/// Current column number. /// Current column number.
unsigned column; unsigned int column;
private: private:
/// Compute max(min, lhs+rhs) (provided min <= lhs). /// Compute max(min, lhs+rhs) (provided min <= lhs).
static unsigned add_ (unsigned lhs, int rhs, unsigned min) static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
{ {
return (0 < rhs || -static_cast<unsigned>(rhs) < lhs return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
? rhs + lhs ? rhs + lhs
: min); : min);
} }
}; };
/// Add \a width columns, in place. /// Add and assign a position.
inline position& inline position&
operator+= (position& res, int width) operator+= (position& res, int width)
{ {
@@ -90,21 +91,21 @@ m4_define([b4_position_define],
return res; return res;
} }
/// Add \a width columns. /// Add two position objects.
inline position inline position
operator+ (position res, int width) operator+ (position res, int width)
{ {
return res += width; return res += width;
} }
/// Subtract \a width columns, in place. /// Add and assign a position.
inline position& inline position&
operator-= (position& res, int width) operator-= (position& res, int width)
{ {
return res += -width; return res += -width;
} }
/// Subtract \a width columns. /// Add two position objects.
inline position inline position
operator- (position res, int width) operator- (position res, int width)
{ {
@@ -156,27 +157,30 @@ m4_define([b4_location_define],
location (const position& b, const position& e) location (const position& b, const position& e)
: begin (b) : begin (b)
, end (e) , end (e)
{} {
}
/// Construct a 0-width location in \a p. /// Construct a 0-width location in \a p.
explicit location (const position& p = position ()) explicit location (const position& p = position ())
: begin (p) : begin (p)
, end (p) , end (p)
{} {
}
/// Construct a 0-width location in \a f, \a l, \a c. /// Construct a 0-width location in \a f, \a l, \a c.
explicit location (]b4_percent_define_get([[filename_type]])[* f, explicit location (]b4_percent_define_get([[filename_type]])[* f,
unsigned l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
: begin (f, l, c) : begin (f, l, c)
, end (f, l, c) , end (f, l, c)
{} {
}
])[ ])[
/// Initialization. /// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR, void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
unsigned l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
{ {
begin.initialize (f, l, c); begin.initialize (f, l, c);
end = begin; end = begin;
@@ -212,42 +216,36 @@ m4_define([b4_location_define],
position end; position end;
}; };
/// Join two locations, in place. /// Join two location objects to create a location.
inline location& operator+= (location& res, const location& end) inline location operator+ (location res, const location& end)
{ {
res.end = end.end; res.end = end.end;
return res; return res;
} }
/// Join two locations. /// Change end position in place.
inline location operator+ (location res, const location& end)
{
return res += end;
}
/// Add \a width columns to the end position, in place.
inline location& operator+= (location& res, int width) inline location& operator+= (location& res, int width)
{ {
res.columns (width); res.columns (width);
return res; return res;
} }
/// Add \a width columns to the end position. /// Change end position.
inline location operator+ (location res, int width) inline location operator+ (location res, int width)
{ {
return res += width; return res += width;
} }
/// Subtract \a width columns to the end position, in place. /// Change end position in place.
inline location& operator-= (location& res, int width) inline location& operator-= (location& res, int width)
{ {
return res += -width; return res += -width;
} }
/// Subtract \a width columns to the end position. /// Change end position.
inline location operator- (location res, int width) inline location operator- (const location& begin, int width)
{ {
return res -= width; return begin + -width;
} }
]b4_percent_define_flag_if([[define_location_comparison]], [[ ]b4_percent_define_flag_if([[define_location_comparison]], [[
/// Compare two location objects. /// Compare two location objects.
@@ -274,8 +272,9 @@ m4_define([b4_location_define],
inline std::basic_ostream<YYChar>& inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc) operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{ {
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
ostr << loc.begin; ostr << loc.begin// << "(" << loc.end << ") "
;
if (loc.end.filename if (loc.end.filename
&& (!loc.begin.filename && (!loc.begin.filename
|| *loc.begin.filename != *loc.end.filename)) || *loc.begin.filename != *loc.end.filename))
+22 -20
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -16,13 +16,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2015, 2018]) [2002-2013])
# b4_stack_define # b4_stack_define
# --------------- # ---------------
m4_define([b4_stack_define], m4_define([b4_stack_define],
[[ /// A stack with random access from its top. [[ template <class T, class S = std::vector<T> >
template <class T, class S = std::vector<T> >
class stack class stack
{ {
public: public:
@@ -33,27 +32,23 @@ m4_define([b4_stack_define],
stack () stack ()
: seq_ () : seq_ ()
{ {
seq_.reserve (200);
} }
stack (unsigned n) stack (unsigned int n)
: seq_ (n) : seq_ (n)
{} {
}
/// Random access. inline
///
/// Index 0 returns the topmost element.
T& T&
operator[] (unsigned i) operator[] (unsigned int i)
{ {
return seq_[seq_.size () - 1 - i]; return seq_[seq_.size () - 1 - i];
} }
/// Random access. inline
///
/// Index 0 returns the topmost element.
const T& const T&
operator[] (unsigned i) const operator[] (unsigned int i) const
{ {
return seq_[seq_.size () - 1 - i]; return seq_[seq_.size () - 1 - i];
} }
@@ -61,6 +56,7 @@ m4_define([b4_stack_define],
/// Steal the contents of \a t. /// Steal the contents of \a t.
/// ///
/// Close to move-semantics. /// Close to move-semantics.
inline
void void
push (T& t) push (T& t)
{ {
@@ -68,8 +64,9 @@ m4_define([b4_stack_define],
operator[](0).move (t); operator[](0).move (t);
} }
inline
void void
pop (unsigned n = 1) pop (unsigned int n = 1)
{ {
for (; n; --n) for (; n; --n)
seq_.pop_back (); seq_.pop_back ();
@@ -81,18 +78,21 @@ m4_define([b4_stack_define],
seq_.clear (); seq_.clear ();
} }
inline
typename S::size_type typename S::size_type
size () const size () const
{ {
return seq_.size (); return seq_.size ();
} }
inline
const_iterator const_iterator
begin () const begin () const
{ {
return seq_.rbegin (); return seq_.rbegin ();
} }
inline
const_iterator const_iterator
end () const end () const
{ {
@@ -111,20 +111,22 @@ m4_define([b4_stack_define],
class slice class slice
{ {
public: public:
slice (const S& stack, unsigned range) slice (const S& stack, unsigned int range)
: stack_ (stack) : stack_ (stack)
, range_ (range) , range_ (range)
{} {
}
inline
const T& const T&
operator [] (unsigned i) const operator [] (unsigned int i) const
{ {
return stack_[range_ - i]; return stack_[range_ - i];
} }
private: private:
const S& stack_; const S& stack_;
unsigned range_; unsigned int range_;
}; };
]]) ]])
+18 -16
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
m4_define([b4_symbol_variant], m4_define([b4_symbol_variant],
[m4_pushdef([b4_dollar_dollar], [m4_pushdef([b4_dollar_dollar],
[$2.$3< $][3 > (m4_shift3($@))])dnl [$2.$3< $][3 > (m4_shift3($@))])dnl
switch ($1) switch ($1)
{ {
b4_type_foreach([b4_type_action_])[]dnl b4_type_foreach([b4_type_action_])[]dnl
default: default:
@@ -95,13 +95,13 @@ m4_define([b4_variant_define],
/// Empty construction. /// Empty construction.
variant ()]b4_parse_assert_if([ variant ()]b4_parse_assert_if([
: yytypeid_ (YY_NULLPTR)])[ : yytname_ (YY_NULL)])[
{} {}
/// Construct and fill. /// Construct and fill.
template <typename T> template <typename T>
variant (const T& t)]b4_parse_assert_if([ variant (const T& t)]b4_parse_assert_if([
: yytypeid_ (&typeid (T))])[ : yytname_ (typeid (T).name ())])[
{ {
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
new (yyas_<T> ()) T (t); new (yyas_<T> ()) T (t);
@@ -110,7 +110,7 @@ m4_define([b4_variant_define],
/// Destruction, allowed only if empty. /// Destruction, allowed only if empty.
~variant () ~variant ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (!yytypeid_); YYASSERT (!yytname_);
])[} ])[}
/// Instantiate an empty \a T in here. /// Instantiate an empty \a T in here.
@@ -118,9 +118,9 @@ m4_define([b4_variant_define],
T& T&
build () build ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (!yytypeid_); YYASSERT (!yytname_);
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);])[ yytname_ = typeid (T).name ();])[
return *new (yyas_<T> ()) T; return *new (yyas_<T> ()) T;
} }
@@ -129,9 +129,9 @@ m4_define([b4_variant_define],
T& T&
build (const T& t) build (const T& t)
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (!yytypeid_); YYASSERT (!yytname_);
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);])[ yytname_ = typeid (T).name ();])[
return *new (yyas_<T> ()) T (t); return *new (yyas_<T> ()) T (t);
} }
@@ -140,7 +140,7 @@ m4_define([b4_variant_define],
T& T&
as () as ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (*yytypeid_ == typeid (T)); YYASSERT (yytname_ == typeid (T).name ());
YYASSERT (sizeof (T) <= S);])[ YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> (); return *yyas_<T> ();
} }
@@ -150,7 +150,7 @@ m4_define([b4_variant_define],
const T& const T&
as () const as () const
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (*yytypeid_ == typeid (T)); YYASSERT (yytname_ == typeid (T).name ());
YYASSERT (sizeof (T) <= S);])[ YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> (); return *yyas_<T> ();
} }
@@ -167,8 +167,8 @@ m4_define([b4_variant_define],
void void
swap (self_type& other) swap (self_type& other)
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (yytypeid_); YYASSERT (yytname_);
YYASSERT (*yytypeid_ == *other.yytypeid_);])[ YYASSERT (yytname_ == other.yytname_);])[
std::swap (as<T> (), other.as<T> ()); std::swap (as<T> (), other.as<T> ());
} }
@@ -178,7 +178,8 @@ m4_define([b4_variant_define],
template <typename T> template <typename T>
void void
move (self_type& other) move (self_type& other)
{ {]b4_parse_assert_if([
YYASSERT (!yytname_);])[
build<T> (); build<T> ();
swap<T> (other); swap<T> (other);
other.destroy<T> (); other.destroy<T> ();
@@ -198,7 +199,7 @@ m4_define([b4_variant_define],
destroy () destroy ()
{ {
as<T> ().~T ();]b4_parse_assert_if([ as<T> ().~T ();]b4_parse_assert_if([
yytypeid_ = YY_NULLPTR;])[ yytname_ = YY_NULL;])[
} }
private: private:
@@ -233,7 +234,7 @@ m4_define([b4_variant_define],
} yybuffer_;]b4_parse_assert_if([ } yybuffer_;]b4_parse_assert_if([
/// Whether the content is built: if defined, the name of the stored type. /// Whether the content is built: if defined, the name of the stored type.
const std::type_info *yytypeid_;])[ const char *yytname_;])[
}; };
]]) ]])
@@ -320,6 +321,7 @@ b4_join(b4_symbol_if([$1], [has_type],
return symbol_type (b4_join([token::b4_symbol([$1], [id])], return symbol_type (b4_join([token::b4_symbol([$1], [id])],
b4_symbol_if([$1], [has_type], [v]), b4_symbol_if([$1], [has_type], [v]),
b4_locations_if([l]))); b4_locations_if([l])));
} }
])])]) ])])])
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- <!--
bison.xsl - common templates for Bison XSLT. bison.xsl - common templates for Bison XSLT.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2007-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+2 -6
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2dot.xsl - transform Bison XML Report into DOT. xml2dot.xsl - transform Bison XML Report into DOT.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2007-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -201,8 +201,6 @@
<xsl:if test="$point = 0"> <xsl:if test="$point = 0">
<xsl:text> .</xsl:text> <xsl:text> .</xsl:text>
</xsl:if> </xsl:if>
<!-- RHS -->
<xsl:for-each select="rhs/symbol|rhs/empty"> <xsl:for-each select="rhs/symbol|rhs/empty">
<xsl:apply-templates select="."/> <xsl:apply-templates select="."/>
<xsl:if test="$point = position()"> <xsl:if test="$point = position()">
@@ -216,9 +214,7 @@
<xsl:value-of select="."/> <xsl:value-of select="."/>
</xsl:template> </xsl:template>
<xsl:template match="empty"> <xsl:template match="empty"/>
<xsl:text> %empty</xsl:text>
</xsl:template>
<xsl:template match="lookaheads"> <xsl:template match="lookaheads">
<xsl:text> [</xsl:text> <xsl:text> [</xsl:text>
+7 -2
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2text.xsl - transform Bison XML Report into plain text. xml2text.xsl - transform Bison XML Report into plain text.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2007-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -350,7 +350,12 @@
<xsl:if test="position() = $point + 1"> <xsl:if test="position() = $point + 1">
<xsl:text> .</xsl:text> <xsl:text> .</xsl:text>
</xsl:if> </xsl:if>
<xsl:apply-templates select="."/> <xsl:if test="$itemset = 'true' and name(.) != 'empty'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="position() = last() and position() = $point"> <xsl:if test="position() = last() and position() = $point">
<xsl:text> .</xsl:text> <xsl:text> .</xsl:text>
</xsl:if> </xsl:if>
+8 -3
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2html.xsl - transform Bison XML Report into XHTML. xml2html.xsl - transform Bison XML Report into XHTML.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2007-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -532,7 +532,12 @@
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<span class="point">.</span> <span class="point">.</span>
</xsl:if> </xsl:if>
<xsl:apply-templates select="."/> <xsl:if test="$itemset = 'true' and name(.) != 'empty'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="position() = last() and position() = $point"> <xsl:if test="position() = last() and position() = $point">
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<span class="point">.</span> <span class="point">.</span>
@@ -558,7 +563,7 @@
</xsl:template> </xsl:template>
<xsl:template match="empty"> <xsl:template match="empty">
<xsl:text> %empty</xsl:text> <xsl:text> &#949;</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="lookaheads"> <xsl:template match="lookaheads">
+13 -14
View File
@@ -1,11 +1,11 @@
-*- C -*- -*- C -*-
# Yacc compatible skeleton for Bison # Yacc compatible skeleton for Bison
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software # Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation,
# Foundation, Inc. # Inc.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[1984, 1989-1990, 2000-2015, 2018]) [1984, 1989-1990, 2000-2013])
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1108,11 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes, ]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken) YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
{ {
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0; YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = YY_NULLPTR; const char *yyformat = YY_NULL;
/* Arguments of yyformat. */ /* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
@@ -1187,7 +1187,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
} }
yyarg[yycount++] = yytname[yyx]; yyarg[yycount++] = yytname[yyx];
{ {
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1 if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM)) && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2; return 2;
@@ -1207,7 +1207,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error")); YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1272,7 +1271,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([
b4_function_define([[yyparse]], [[int]], b4_parse_param)[ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
{ {
return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param], return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
[[, ]b4_args(b4_parse_param)])[); [[, ]b4_args(b4_parse_param)])[);
} }
@@ -1314,10 +1313,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
{ {
yypstate *yyps;]b4_pure_if([], [[ yypstate *yyps;]b4_pure_if([], [[
if (yypstate_allocated) if (yypstate_allocated)
return YY_NULLPTR;]])[ return YY_NULL;]])[
yyps = (yypstate *) malloc (sizeof *yyps); yyps = (yypstate *) malloc (sizeof *yyps);
if (!yyps) if (!yyps)
return YY_NULLPTR; return YY_NULL;
yyps->yynew = 1;]b4_pure_if([], [[ yyps->yynew = 1;]b4_pure_if([], [[
yypstate_allocated = 1;]])[ yypstate_allocated = 1;]])[
return yyps; return yyps;
@@ -1642,9 +1641,8 @@ yyreduce:
yyval = yyvsp[1-yylen]; yyval = yyvsp[1-yylen];
]b4_locations_if( ]b4_locations_if(
[[ /* Default location. */ [[ /* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
yyerror_range[1] = yyloc;]])[
YY_REDUCE_PRINT (yyn);]b4_lac_if([[ YY_REDUCE_PRINT (yyn);]b4_lac_if([[
{ {
int yychar_backup = yychar; int yychar_backup = yychar;
@@ -1784,7 +1782,8 @@ yyerrorlab:
if (/*CONSTCOND*/ 0) if (/*CONSTCOND*/ 0)
goto yyerrorlab; goto yyerrorlab;
/* Do not reclaim the symbols of the rule whose action triggered ]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
]])[ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
yylen = 0; yylen = 0;
+1 -1
View File
@@ -1,7 +1,7 @@
# DJGPP Maintainer's Makefile -*-Makefile-*- # DJGPP Maintainer's Makefile -*-Makefile-*-
# Requires GNU sed # Requires GNU sed
## Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. ## Copyright (C) 2005-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP. This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
Rem format, or else stock DOS/Windows shells will refuse to run it. Rem format, or else stock DOS/Windows shells will refuse to run it.
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
Rem This program is free software: you can redistribute it and/or modify Rem This program is free software: you can redistribute it and/or modify
Rem it under the terms of the GNU General Public License as published by Rem it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Sed script for additional DJGPP specific editing # Sed script for additional DJGPP specific editing
# of the configure script generated by autoconf 2.62. # of the configure script generated by autoconf 2.62.
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -3,7 +3,7 @@
# This is the config.site file for configuring GNU packages # This is the config.site file for configuring GNU packages
# which are to be built with DJGPP tools. # which are to be built with DJGPP tools.
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
# sed script for DJGPP specific editing of config.hin # sed script for DJGPP specific editing of config.hin
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
Rem renaming some of the files whose names are invalid on DOS or conflict Rem renaming some of the files whose names are invalid on DOS or conflict
Rem with other file names after truncation to DOS 8+3 namespace. Rem with other file names after truncation to DOS 8+3 namespace.
Rem Rem
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
Rem Rem
Rem This program is free software: you can redistribute it and/or modify Rem This program is free software: you can redistribute it and/or modify
Rem it under the terms of the GNU General Public License as published by Rem it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc. ## Copyright (C) 2008-2013 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes. /* Subprocesses with pipes.
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes. /* Subprocesses with pipes.
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Sed script for additional DJGPP specific editing # Sed script for additional DJGPP specific editing
# of the testsuite script generated by autoconf 2.61. # of the testsuite script generated by autoconf 2.61.
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2007-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
-1
View File
@@ -27,4 +27,3 @@
/stamp-vti /stamp-vti
/version.texi /version.texi
/yacc.1 /yacc.1
/gendocs_template_min
+960 -1405
View File
File diff suppressed because it is too large Load Diff
+73 -123
View File
@@ -1,8 +1,6 @@
\input texinfo @c -*-texinfo-*- \input texinfo @c -*-texinfo-*-
@comment %**start of header @comment %**start of header
@setfilename bison.info @setfilename bison.info
@documentencoding UTF-8
@documentlanguage en
@include version.texi @include version.texi
@settitle Bison @value{VERSION} @settitle Bison @value{VERSION}
@setchapternewpage odd @setchapternewpage odd
@@ -35,7 +33,7 @@
This manual (@value{UPDATED}) is for GNU Bison (version This manual (@value{UPDATED}) is for GNU Bison (version
@value{VERSION}), the GNU parser generator. @value{VERSION}), the GNU parser generator.
Copyright @copyright{} 1988-1993, 1995, 1998-2015, 2018 Free Software Copyright @copyright{} 1988-1993, 1995, 1998-2013 Free Software
Foundation, Inc. Foundation, Inc.
@quotation @quotation
@@ -143,7 +141,7 @@ Writing GLR Parsers
Examples Examples
* RPN Calc:: Reverse Polish Notation Calculator; * RPN Calc:: Reverse polish notation calculator;
a first example with no operator precedence. a first example with no operator precedence.
* Infix Calc:: Infix (algebraic) notation calculator. * Infix Calc:: Infix (algebraic) notation calculator.
Operator precedence is introduced. Operator precedence is introduced.
@@ -1493,7 +1491,7 @@ simple program, all the rest of the program can go here.
@cindex examples, simple @cindex examples, simple
Now we show and explain several sample programs written using Bison: a Now we show and explain several sample programs written using Bison: a
Reverse Polish Notation calculator, an algebraic (infix) notation reverse polish notation calculator, an algebraic (infix) notation
calculator --- later extended to track ``locations'' --- calculator --- later extended to track ``locations'' ---
and a multi-function calculator. All and a multi-function calculator. All
produce usable, though limited, interactive desk-top calculators. produce usable, though limited, interactive desk-top calculators.
@@ -1503,7 +1501,7 @@ languages are written the same way. You can copy these examples into a
source file to try them. source file to try them.
@menu @menu
* RPN Calc:: Reverse Polish Notation Calculator; * RPN Calc:: Reverse polish notation calculator;
a first example with no operator precedence. a first example with no operator precedence.
* Infix Calc:: Infix (algebraic) notation calculator. * Infix Calc:: Infix (algebraic) notation calculator.
Operator precedence is introduced. Operator precedence is introduced.
@@ -1516,12 +1514,13 @@ source file to try them.
@node RPN Calc @node RPN Calc
@section Reverse Polish Notation Calculator @section Reverse Polish Notation Calculator
@cindex Reverse Polish Notation @cindex reverse polish notation
@cindex polish notation calculator
@cindex @code{rpcalc} @cindex @code{rpcalc}
@cindex calculator, simple @cindex calculator, simple
The first example is that of a simple double-precision @dfn{Reverse Polish The first example is that of a simple double-precision @dfn{reverse polish
Notation} calculator (a calculator using postfix operators). This example notation} calculator (a calculator using postfix operators). This example
provides a good starting point, since operator precedence is not an issue. provides a good starting point, since operator precedence is not an issue.
The second example will illustrate how operator precedence is handled. The second example will illustrate how operator precedence is handled.
@@ -1541,12 +1540,12 @@ The source code for this calculator is named @file{rpcalc.y}. The
@node Rpcalc Declarations @node Rpcalc Declarations
@subsection Declarations for @code{rpcalc} @subsection Declarations for @code{rpcalc}
Here are the C and Bison declarations for the Reverse Polish Notation Here are the C and Bison declarations for the reverse polish notation
calculator. As in C, comments are placed between @samp{/*@dots{}*/}. calculator. As in C, comments are placed between @samp{/*@dots{}*/}.
@comment file: rpcalc.y @comment file: rpcalc.y
@example @example
/* Reverse Polish Notation calculator. */ /* Reverse polish notation calculator. */
@group @group
%@{ %@{
@@ -1597,7 +1596,7 @@ declared is @code{NUM}, the token type for numeric constants.
@node Rpcalc Rules @node Rpcalc Rules
@subsection Grammar Rules for @code{rpcalc} @subsection Grammar Rules for @code{rpcalc}
Here are the grammar rules for the Reverse Polish Notation calculator. Here are the grammar rules for the reverse polish notation calculator.
@comment file: rpcalc.y @comment file: rpcalc.y
@example @example
@@ -3850,7 +3849,7 @@ example:
@noindent @noindent
specifies the union tag @code{value}, so the corresponding C type is specifies the union tag @code{value}, so the corresponding C type is
@code{union value}. If you do not specify a tag, it defaults to @code{union value}. If you do not specify a tag, it defaults to
@code{YYSTYPE} (@pxref{%define Summary,,api.value.union.name}). @code{YYSTYPE}.
As another extension to POSIX, you may specify multiple @code{%union} As another extension to POSIX, you may specify multiple @code{%union}
declarations; their contents are concatenated. However, only the first declarations; their contents are concatenated. However, only the first
@@ -5144,9 +5143,7 @@ value by default. However, when the parser displays a @code{STRING1} or a
@code{string1}, it formats it as a string in double quotes. It performs @code{string1}, it formats it as a string in double quotes. It performs
only the second @code{%printer} in this case, so it prints only once. only the second @code{%printer} in this case, so it prints only once.
Finally, the parser print @samp{<>} for any symbol, such as @code{TAGLESS}, Finally, the parser print @samp{<>} for any symbol, such as @code{TAGLESS},
that has no semantic type tag. @xref{Mfcalc Traces, ,Enabling Debug Traces that has no semantic type tag. See also
for @code{mfcalc}}, for a complete example.
@node Expect Decl @node Expect Decl
@@ -6013,12 +6010,12 @@ Use this @var{type} as semantic value.
@item Default Value: @item Default Value:
@itemize @minus @itemize @minus
@item @item
@code{union-directive} if @code{%union} is used, otherwise @dots{} @code{%union} if @code{%union} is used, otherwise @dots{}
@item @item
@code{int} if type tags are used (i.e., @samp{%token <@var{type}>@dots{}} or @code{int} if type tags are used (i.e., @samp{%token <@var{type}>@dots{}} or
@samp{%type <@var{type}>@dots{}} is used), otherwise @dots{} @samp{%token <@var{type}>@dots{}} is used), otherwise @dots{}
@item @item
undefined. @code{""}
@end itemize @end itemize
@item History: @item History:
@@ -6029,30 +6026,6 @@ introduced in Bison 3.0. Was introduced for Java only in 2.3b as
@c api.value.type @c api.value.type
@c ================================================== api.value.union.name
@deffn Directive {%define api.value.union.name} @var{name}
@itemize @bullet
@item Language(s):
C
@item Purpose:
The tag of the generated @code{union} (@emph{not} the name of the
@code{typedef}). This variable is set to @code{@var{id}} when @samp{%union
@var{id}} is used. There is no clear reason to give this union a name.
@item Accepted Values:
Any valid identifier.
@item Default Value:
@code{YYSTYPE}.
@item History:
Introduced in Bison 3.0.3.
@end itemize
@end deffn
@c api.value.type
@c ================================================== location_type @c ================================================== location_type
@deffn Directive {%define location_type} @deffn Directive {%define location_type}
Obsoleted by @code{api.location.type} since Bison 2.7. Obsoleted by @code{api.location.type} since Bison 2.7.
@@ -7549,7 +7522,7 @@ in an associativity related conflict, which can be specified as follows.
The unary-minus is another typical example where associativity is The unary-minus is another typical example where associativity is
usually over-specified, see @ref{Infix Calc, , Infix Notation usually over-specified, see @ref{Infix Calc, , Infix Notation
Calculator - @code{calc}}. The @code{%left} directive is traditionally Calculator: @code{calc}}. The @code{%left} directive is traditionally
used to declare the precedence of @code{NEG}, which is more than needed used to declare the precedence of @code{NEG}, which is more than needed
since it also defines its associativity. While this is harmless in the since it also defines its associativity. While this is harmless in the
traditional example, who knows how @code{NEG} might be used in future traditional example, who knows how @code{NEG} might be used in future
@@ -8932,7 +8905,7 @@ clear the flag.
Developing a parser can be a challenge, especially if you don't understand Developing a parser can be a challenge, especially if you don't understand
the algorithm (@pxref{Algorithm, ,The Bison Parser Algorithm}). This the algorithm (@pxref{Algorithm, ,The Bison Parser Algorithm}). This
chapter explains how to understand and debug a parser. chapter explains how understand and debug a parser.
The first sections focus on the static part of the parser: its structure. The first sections focus on the static part of the parser: its structure.
They explain how to generate and read the detailed description of the They explain how to generate and read the detailed description of the
@@ -10092,16 +10065,18 @@ A category can be turned off by prefixing its name with @samp{no-}. For
instance, @option{-Wno-yacc} will hide the warnings about instance, @option{-Wno-yacc} will hide the warnings about
POSIX Yacc incompatibilities. POSIX Yacc incompatibilities.
@item -Werror @item -Werror[=@var{category}]
Turn enabled warnings for every @var{category} into errors, unless they are @itemx -Wno-error[=@var{category}]
explicitly disabled by @option{-Wno-error=@var{category}}. Enable warnings falling in @var{category}, and treat them as errors. If no
@var{category} is given, it defaults to making all enabled warnings into errors.
@item -Werror=@var{category}
Enable warnings falling in @var{category}, and treat them as errors.
@var{category} is the same as for @option{--warnings}, with the exception that @var{category} is the same as for @option{--warnings}, with the exception that
it may not be prefixed with @samp{no-} (see above). it may not be prefixed with @samp{no-} (see above).
Prefixed with @samp{no}, it deactivates the error treatment for this
@var{category}. However, the warning itself won't be disabled, or enabled, by
this option.
Note that the precedence of the @samp{=} and @samp{,} operators is such that Note that the precedence of the @samp{=} and @samp{,} operators is such that
the following commands are @emph{not} equivalent, as the first will not treat the following commands are @emph{not} equivalent, as the first will not treat
S/R conflicts as errors. S/R conflicts as errors.
@@ -10111,14 +10086,6 @@ $ bison -Werror=yacc,conflicts-sr input.y
$ bison -Werror=yacc,error=conflicts-sr input.y $ bison -Werror=yacc,error=conflicts-sr input.y
@end example @end example
@item -Wno-error
Do not turn enabled warnings for every @var{category} into errors, unless
they are explicitly enabled by @option{-Werror=@var{category}}.
@item -Wno-error=@var{category}
Deactivate the error treatment for this @var{category}. However, the warning
itself won't be disabled, or enabled, by this option.
@item -f [@var{feature}] @item -f [@var{feature}]
@itemx --feature[=@var{feature}] @itemx --feature[=@var{feature}]
Activate miscellaneous @var{feature}. @var{feature} can be one of: Activate miscellaneous @var{feature}. @var{feature} can be one of:
@@ -10381,23 +10348,9 @@ declare @code{yyerror} as follows:
int yyerror (char const *); int yyerror (char const *);
@end example @end example
@noindent Bison ignores the @code{int} value returned by this @code{yyerror}.
The @code{int} value returned by this @code{yyerror} is ignored. If you use the Yacc library's @code{main} function, your
@code{yyparse} function should have the following type signature:
The implementation of Yacc library's @code{main} function is:
@example
int main (void)
@{
setlocale (LC_ALL, "");
return yyparse ();
@}
@end example
@noindent
so if you use it, the internationalization support is enabled (e.g., error
messages are translated), and your @code{yyparse} function should have the
following type signature:
@example @example
int yyparse (void); int yyparse (void);
@@ -10699,17 +10652,12 @@ The first, inclusive, position of the range, and the first beyond.
Forwarded to the @code{end} position. Forwarded to the @code{end} position.
@end deftypemethod @end deftypemethod
@deftypemethod {location} {location} operator+ (int @var{width})
@deftypemethodx {location} {location} operator+= (int @var{width})
@deftypemethodx {location} {location} operator- (int @var{width})
@deftypemethodx {location} {location} operator-= (int @var{width})
Various forms of syntactic sugar for @code{columns}.
@end deftypemethod
@deftypemethod {location} {location} operator+ (const location& @var{end}) @deftypemethod {location} {location} operator+ (const location& @var{end})
@deftypemethodx {location} {location} operator+= (const location& @var{end}) @deftypemethodx {location} {location} operator+ (int @var{width})
Join two locations: starts at the position of the first one, and ends at the @deftypemethodx {location} {location} operator+= (int @var{width})
position of the second. @deftypemethodx {location} {location} operator- (int @var{width})
@deftypemethodx {location} {location} operator-= (int @var{width})
Various forms of syntactic sugar.
@end deftypemethod @end deftypemethod
@deftypemethod {location} {void} step () @deftypemethod {location} {void} step ()
@@ -10747,8 +10695,8 @@ it must be copyable;
in order to compute the (default) value of @code{@@$} in a reduction, the in order to compute the (default) value of @code{@@$} in a reduction, the
parser basically runs parser basically runs
@example @example
@@$.begin = @@1.begin; @@$.begin = @@$1.begin;
@@$.end = @@@var{N}.end; // The location of last right-hand side symbol. @@$.end = @@$@var{N}.end; // The location of last right-hand side symbol.
@end example @end example
@noindent @noindent
so there must be copyable @code{begin} and @code{end} members; so there must be copyable @code{begin} and @code{end} members;
@@ -10900,12 +10848,12 @@ Regular union-based code in Lex scanner typically look like:
@example @example
[0-9]+ @{ [0-9]+ @{
yylval->ival = text_to_int (yytext); yylval.ival = text_to_int (yytext);
return yy::parser::token::INTEGER; return yy::parser::INTEGER;
@} @}
[a-z]+ @{ [a-z]+ @{
yylval->sval = new std::string (yytext); yylval.sval = new std::string (yytext);
return yy::parser::token::IDENTIFIER; return yy::parser::IDENTIFIER;
@} @}
@end example @end example
@@ -10914,12 +10862,12 @@ initialized. So the code would look like:
@example @example
[0-9]+ @{ [0-9]+ @{
yylval->build<int> () = text_to_int (yytext); yylval.build<int>() = text_to_int (yytext);
return yy::parser::token::INTEGER; return yy::parser::INTEGER;
@} @}
[a-z]+ @{ [a-z]+ @{
yylval->build<std::string> () = yytext; yylval.build<std::string> = yytext;
return yy::parser::token::IDENTIFIER; return yy::parser::IDENTIFIER;
@} @}
@end example @end example
@@ -10928,12 +10876,12 @@ or
@example @example
[0-9]+ @{ [0-9]+ @{
yylval->build (text_to_int (yytext)); yylval.build(text_to_int (yytext));
return yy::parser::token::INTEGER; return yy::parser::INTEGER;
@} @}
[a-z]+ @{ [a-z]+ @{
yylval->build (yytext); yylval.build(yytext);
return yy::parser::token::IDENTIFIER; return yy::parser::IDENTIFIER;
@} @}
@end example @end example
@@ -10961,8 +10909,8 @@ it is still possible to give an integer as semantic value for a string.
So for each token type, Bison generates named constructors as follows. So for each token type, Bison generates named constructors as follows.
@deftypemethod {symbol_type} {} {make_@var{token}} (const @var{value_type}& @var{value}, const location_type& @var{location}) @deftypemethod {symbol_type} {} make_@var{token} (const @var{value_type}& @var{value}, const location_type& @var{location})
@deftypemethodx {symbol_type} {} {make_@var{token}} (const location_type& @var{location}) @deftypemethodx {symbol_type} {} make_@var{token} (const location_type& @var{location})
Build a complete terminal symbol for the token type @var{token} (not Build a complete terminal symbol for the token type @var{token} (not
including the @code{api.token.prefix}) whose possible semantic value is including the @code{api.token.prefix}) whose possible semantic value is
@var{value} of adequate @var{value_type}. If location tracking is enabled, @var{value} of adequate @var{value_type}. If location tracking is enabled,
@@ -10982,18 +10930,20 @@ For instance, given the following declarations:
Bison generates the following functions: Bison generates the following functions:
@example @example
symbol_type make_IDENTIFIER (const std::string&, const location_type&); symbol_type make_IDENTIFIER(const std::string& v,
symbol_type make_INTEGER (const int&, const location_type&); const location_type& l);
symbol_type make_COLON (const location_type&); symbol_type make_INTEGER(const int& v,
const location_type& loc);
symbol_type make_COLON(const location_type& loc);
@end example @end example
@noindent @noindent
which should be used in a Lex-scanner as follows. which should be used in a Lex-scanner as follows.
@example @example
[0-9]+ return yy::parser::make_INTEGER (text_to_int (yytext), loc); [0-9]+ return yy::parser::make_INTEGER(text_to_int (yytext), loc);
[a-z]+ return yy::parser::make_IDENTIFIER (yytext, loc); [a-z]+ return yy::parser::make_IDENTIFIER(yytext, loc);
":" return yy::parser::make_COLON (loc); ":" return yy::parser::make_COLON(loc);
@end example @end example
Tokens that do not have an identifier are not accessible: you cannot simply Tokens that do not have an identifier are not accessible: you cannot simply
@@ -11174,13 +11124,13 @@ calcxx_driver::parse (const std::string &f)
void void
calcxx_driver::error (const yy::location& l, const std::string& m) calcxx_driver::error (const yy::location& l, const std::string& m)
@{ @{
std::cerr << l << ": " << m << '\n'; std::cerr << l << ": " << m << std::endl;
@} @}
void void
calcxx_driver::error (const std::string& m) calcxx_driver::error (const std::string& m)
@{ @{
std::cerr << m << '\n'; std::cerr << m << std::endl;
@} @}
@end example @end example
@@ -11334,7 +11284,7 @@ regular destructors. All the values are printed using their
@noindent @noindent
The grammar itself is straightforward (@pxref{Location Tracking Calc, , The grammar itself is straightforward (@pxref{Location Tracking Calc, ,
Location Tracking Calculator - @code{ltcalc}}). Location Tracking Calculator: @code{ltcalc}}).
@comment file: calc++-parser.yy @comment file: calc++-parser.yy
@example @example
@@ -11458,13 +11408,13 @@ The rules are simple. The driver is used to report errors.
@comment file: calc++-scanner.ll @comment file: calc++-scanner.ll
@example @example
"-" return yy::calcxx_parser::make_MINUS (loc); "-" return yy::calcxx_parser::make_MINUS(loc);
"+" return yy::calcxx_parser::make_PLUS (loc); "+" return yy::calcxx_parser::make_PLUS(loc);
"*" return yy::calcxx_parser::make_STAR (loc); "*" return yy::calcxx_parser::make_STAR(loc);
"/" return yy::calcxx_parser::make_SLASH (loc); "/" return yy::calcxx_parser::make_SLASH(loc);
"(" return yy::calcxx_parser::make_LPAREN (loc); "(" return yy::calcxx_parser::make_LPAREN(loc);
")" return yy::calcxx_parser::make_RPAREN (loc); ")" return yy::calcxx_parser::make_RPAREN(loc);
":=" return yy::calcxx_parser::make_ASSIGN (loc); ":=" return yy::calcxx_parser::make_ASSIGN(loc);
@group @group
@{int@} @{ @{int@} @{
@@ -11472,12 +11422,12 @@ The rules are simple. The driver is used to report errors.
long n = strtol (yytext, NULL, 10); long n = strtol (yytext, NULL, 10);
if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
driver.error (loc, "integer is out of range"); driver.error (loc, "integer is out of range");
return yy::calcxx_parser::make_NUMBER (n, loc); return yy::calcxx_parser::make_NUMBER(n, loc);
@} @}
@end group @end group
@{id@} return yy::calcxx_parser::make_IDENTIFIER (yytext, loc); @{id@} return yy::calcxx_parser::make_IDENTIFIER(yytext, loc);
. driver.error (loc, "invalid character"); . driver.error (loc, "invalid character");
<<EOF>> return yy::calcxx_parser::make_END (loc); <<EOF>> return yy::calcxx_parser::make_END(loc);
%% %%
@end example @end example
@@ -11533,7 +11483,7 @@ main (int argc, char *argv[])
else if (argv[i] == std::string ("-s")) else if (argv[i] == std::string ("-s"))
driver.trace_scanning = true; driver.trace_scanning = true;
else if (!driver.parse (argv[i])) else if (!driver.parse (argv[i]))
std::cout << driver.result << '\n'; std::cout << driver.result << std::endl;
else else
res = 1; res = 1;
return res; return res;
@@ -13345,7 +13295,7 @@ A reentrant subprogram is a subprogram which can be in invoked any
number of times in parallel, without interference between the various number of times in parallel, without interference between the various
invocations. @xref{Pure Decl, ,A Pure (Reentrant) Parser}. invocations. @xref{Pure Decl, ,A Pure (Reentrant) Parser}.
@item Reverse Polish Notation @item Reverse polish notation
A language in which all operators are postfix operators. A language in which all operators are postfix operators.
@item Right recursion @item Right recursion
+3 -12
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2001-2003, 2005-2015, 2018 Free Software Foundation, ## Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
## Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
@@ -86,13 +85,11 @@ doc/refcard.pdf: doc/refcard.tex
# repeated builds of bison.help. # repeated builds of bison.help.
EXTRA_DIST += $(top_srcdir)/doc/bison.help EXTRA_DIST += $(top_srcdir)/doc/bison.help
if ! CROSS_COMPILING
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT) $(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp $(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp $(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@ $(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
endif ! CROSS_COMPILING
## ----------- ## ## ----------- ##
@@ -109,11 +106,7 @@ remove_time_stamp = \
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/' sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
# Depend on configure to get version number changes. # Depend on configure to get version number changes.
if ! CROSS_COMPILING $(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
MAN_DEPS = doc/bison.help doc/bison.x $(top_srcdir)/configure
endif
$(top_srcdir)/doc/bison.1: $(MAN_DEPS)
$(AM_V_GEN)$(HELP2MAN) \ $(AM_V_GEN)$(HELP2MAN) \
--include=$(top_srcdir)/doc/bison.x \ --include=$(top_srcdir)/doc/bison.x \
--output=$@.t src/bison$(EXEEXT) --output=$@.t src/bison$(EXEEXT)
@@ -125,15 +118,13 @@ $(top_srcdir)/doc/bison.1: $(MAN_DEPS)
fi fi
$(AM_V_at)rm -f $@*.t $(AM_V_at)rm -f $@*.t
if ENABLE_YACC
nodist_man_MANS = doc/yacc.1 nodist_man_MANS = doc/yacc.1
endif
## ----------------------------- ## ## ----------------------------- ##
## Graphviz examples generation. ## ## Graphviz examples generation. ##
## ----------------------------- ## ## ----------------------------- ##
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png) CLEANDIRS += doc/figs
FIGS_GV = \ FIGS_GV = \
doc/figs/example.gv \ doc/figs/example.gv \
doc/figs/example-reduce.gv doc/figs/example-shift.gv doc/figs/example-reduce.gv doc/figs/example-shift.gv
+1 -2
View File
@@ -19,8 +19,7 @@
\def\finalout{\overfullrule=0pt} \def\finalout{\overfullrule=0pt}
%\finalout %\finalout
% Copyright (c) 1998, 2001, 2009-2015, 2018 Free Software Foundation, % Copyright (c) 1998, 2001, 2009-2013 Free Software Foundation, Inc.
% Inc.
% %
% This file is part of Bison. % This file is part of Bison.
% %
+1 -1
View File
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
-- --
Copyright (C) 2006, 2009-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w #! /usr/bin/perl -w
# Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
# #
# This file is part of Bison, the GNU Compiler Compiler. # This file is part of Bison, the GNU Compiler Compiler.
# #
@@ -738,7 +738,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
void void
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg) yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
{ {
std::cerr << loc << ": " << msg << '\n'; std::cerr << loc << ": " << msg << std::endl;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc. ## Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+36 -45
View File
@@ -1,5 +1,4 @@
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation, # Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
# Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -20,7 +19,7 @@
# Don't depend on $(BISON) otherwise we would rebuild these files # Don't depend on $(BISON) otherwise we would rebuild these files
# in srcdir, including during distcheck, which is forbidden. # in srcdir, including during distcheck, which is forbidden.
%D%/calc++-parser.stamp: $(BISON_IN) examples/calc++/calc++-parser.stamp: $(BISON_IN)
SUFFIXES += .yy .stamp SUFFIXES += .yy .stamp
.yy.stamp: .yy.stamp:
$(AM_V_YACC)rm -f $@ $(AM_V_YACC)rm -f $@
@@ -28,14 +27,14 @@ SUFFIXES += .yy .stamp
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $< $(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
$(AM_V_at)mv -f $@.tmp $@ $(AM_V_at)mv -f $@.tmp $@
$(calcxx_sources_generated): %D%/calc++-parser.stamp $(calc_sources_generated): examples/calc++/calc++-parser.stamp
@test -f $@ || rm -f %D%/calc++-parser.stamp @test -f $@ || rm -f examples/calc++/calc++-parser.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
CLEANFILES += \ CLEANFILES += \
$(calcxx_sources_generated) \ $(calc_sources_generated) \
%D%/calc++-parser.output \ examples/calc++/calc++-parser.output \
%D%/calc++-parser.stamp \ examples/calc++/calc++-parser.stamp \
%D%/calc++-scanner.cc examples/calc++/calc++-scanner.cc
## -------------------- ## ## -------------------- ##
@@ -43,43 +42,35 @@ CLEANFILES += \
## -------------------- ## ## -------------------- ##
# Avoid using BUILT_SOURCES which is too global. # Avoid using BUILT_SOURCES which is too global.
$(%C%_calc___OBJECTS): $(calcxx_sources_generated) $(examples_calc___calc___OBJECTS): $(calc_sources_generated)
calcxx_sources_extracted = \ calc_sources_extracted = \
%D%/calc++-driver.cc \ examples/calc++/calc++-driver.cc \
%D%/calc++-driver.hh \ examples/calc++/calc++-driver.hh \
%D%/calc++-scanner.ll \ examples/calc++/calc++-scanner.ll \
%D%/calc++.cc examples/calc++/calc++.cc
calcxx_extracted = \ calc_extracted = \
$(calcxx_sources_extracted) \ $(calc_sources_extracted) \
%D%/calc++-parser.yy examples/calc++/calc++-parser.yy
extracted += $(calcxx_extracted) extracted += $(calc_extracted)
calcxx_sources_generated = \ calc_sources_generated = \
%D%/calc++-parser.cc \ examples/calc++/calc++-parser.cc \
%D%/calc++-parser.hh \ examples/calc++/calc++-parser.hh \
%D%/location.hh \ examples/calc++/location.hh \
%D%/position.hh \ examples/calc++/position.hh \
%D%/stack.hh examples/calc++/stack.hh
calcxx_sources = \ calc_sources = \
$(calcxx_sources_extracted) \ $(calc_sources_extracted) \
$(calcxx_sources_generated) $(calc_sources_generated)
if FLEX_CXX_WORKS if BISON_CXX_WORKS
check_PROGRAMS += %D%/calc++ check_PROGRAMS += examples/calc++/calc++
nodist_%C%_calc___SOURCES = \ nodist_examples_calc___calc___SOURCES = \
$(calcxx_sources) $(calc_sources)
%C%_calc___CPPFLAGS = -I$(top_builddir)/%D% examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
%C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS) examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
dist_TESTS += %D%/calc++.test dist_TESTS += examples/calc++/calc++.test
else else
EXTRA_DIST += %D%/calc++.test EXTRA_DIST += examples/calc++/calc++.test
endif endif
## ------------ ##
## Installing. ##
## ------------ ##
calcxxdir = $(docdir)/examples/calc++
calcxx_DATA = $(calcxx_extracted)
+8 -15
View File
@@ -3,8 +3,8 @@
# This file is part of GNU Bison # This file is part of GNU Bison
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018 Free # Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2013 Free Software
# Software Foundation, Inc. # Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Usage: extexi [OPTION...] input-file.texi ... -- [FILES to extract] # Usage: extexi input-file.texi ... -- [FILES to extract]
# Look for @example environments preceded with lines such as: # Look for @example environments preceded with lines such as:
# #
@@ -35,9 +35,6 @@
use strict; use strict;
# Whether we generate synclines.
my $synclines = 0;
# normalize($block) # normalize($block)
# ----------------- # -----------------
# Remove Texinfo mark up. # Remove Texinfo mark up.
@@ -105,7 +102,7 @@ sub process ($)
{ {
# Bison supports synclines, but not Flex. # Bison supports synclines, but not Flex.
$input .= sprintf ("#line %s \"$in\"\n", $. + 1) $input .= sprintf ("#line %s \"$in\"\n", $. + 1)
if $synclines && $file =~ /\.[chy]*$/; if $file =~ /\.[chy]*$/;
next; next;
} }
elsif (/^\@end (small)?example$/) elsif (/^\@end (small)?example$/)
@@ -139,18 +136,14 @@ my @input;
my $seen_dash = 0; my $seen_dash = 0;
for my $arg (@ARGV) for my $arg (@ARGV)
{ {
if ($seen_dash) if ($arg eq '--')
{
use File::Basename;
$file_wanted{basename($arg)} = $arg;
}
elsif ($arg eq '--')
{ {
$seen_dash = 1; $seen_dash = 1;
} }
elsif ($arg eq '--synclines') elsif ($seen_dash)
{ {
$synclines = 1; use File::Basename;
$file_wanted{basename($arg)} = $arg;
} }
else else
{ {
+13 -16
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2005, 2008-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -13,8 +13,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
dist_noinst_SCRIPTS = %D%/extexi %D%/test dist_noinst_SCRIPTS = examples/extexi examples/test
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test TEST_LOG_COMPILER = $(top_srcdir)/examples/test
AM_CXXFLAGS = \ AM_CXXFLAGS = \
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS) $(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
@@ -24,23 +24,20 @@ AM_CXXFLAGS = \
## ------------ ## ## ------------ ##
doc = $(top_srcdir)/doc/bison.texi doc = $(top_srcdir)/doc/bison.texi
extexi = $(top_srcdir)/%D%/extexi extexi = $(top_srcdir)/examples/extexi
if ENABLE_GCC_WARNINGS extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) --
extexiFLAGS = --synclines
endif
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(extexiFLAGS) $(doc) --
extracted = extracted =
CLEANFILES += $(extracted) %D%/extracted.stamp CLEANFILES += $(extracted) examples/extracted.stamp
%D%/extracted.stamp: $(doc) $(extexi) examples/extracted.stamp: $(doc) $(extexi)
$(AM_V_GEN)rm -f $@ $@.tmp $(AM_V_GEN)rm -f $@ $@.tmp
$(AM_V_at)touch $@.tmp $(AM_V_at)touch $@.tmp
$(AM_V_at)$(extract) $(extracted) $(AM_V_at)$(extract) $(extracted)
$(AM_V_at)mv $@.tmp $@ $(AM_V_at)mv $@.tmp $@
$(extracted): %D%/extracted.stamp $(extracted): examples/extracted.stamp
@test -f $@ || rm -f %D%/extracted.stamp @test -f $@ || rm -f examples/extracted.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
include %D%/calc++/local.mk include examples/calc++/local.mk
include %D%/mfcalc/local.mk include examples/mfcalc/local.mk
include %D%/rpcalc/local.mk include examples/rpcalc/local.mk
+13 -17
View File
@@ -1,5 +1,4 @@
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation, # Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
# Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,22 +18,19 @@
## -------------------- ## ## -------------------- ##
BUILT_SOURCES += $(mfcalc_sources) BUILT_SOURCES += $(mfcalc_sources)
CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output
mfcalc_extracted = %D%/calc.h %D%/mfcalc.y mfcalc_extracted = \
mfcalc_sources = $(mfcalc_extracted) examples/mfcalc/calc.h \
examples/mfcalc/mfcalc.y
mfcalc_sources = \
$(mfcalc_extracted)
extracted += $(mfcalc_extracted) extracted += $(mfcalc_extracted)
check_PROGRAMS += %D%/mfcalc check_PROGRAMS += examples/mfcalc/mfcalc
%C%_mfcalc_LDADD = -lm examples_mfcalc_mfcalc_LDADD = -lm
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources) nodist_examples_mfcalc_mfcalc_SOURCES = \
$(mfcalc_sources)
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D% examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
dist_TESTS += %D%/mfcalc.test dist_TESTS += examples/mfcalc/mfcalc.test
## ------------ ##
## Installing. ##
## ------------ ##
mfcalcdir = $(docdir)/examples/mfcalc
mfcalc_DATA = $(mfcalc_extracted)
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
-1
View File
@@ -1,5 +1,4 @@
/calc.h /calc.h
/rpcalc
/rpcalc.c /rpcalc.c
/rpcalc.h /rpcalc.h
/rpcalc.output /rpcalc.output
+12 -17
View File
@@ -1,5 +1,4 @@
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation, # Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
# Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,22 +18,18 @@
## -------------------- ## ## -------------------- ##
BUILT_SOURCES += $(rpcalc_sources) BUILT_SOURCES += $(rpcalc_sources)
CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output
rpcalc_extracted = %D%/rpcalc.y rpcalc_extracted = \
rpcalc_sources = $(rpcalc_extracted) examples/rpcalc/rpcalc.y
rpcalc_sources = \
$(rpcalc_extracted)
extracted += $(rpcalc_extracted) extracted += $(rpcalc_extracted)
check_PROGRAMS += %D%/rpcalc check_PROGRAMS += examples/rpcalc/rpcalc
%C%_rpcalc_LDADD = -lm examples_rpcalc_rpcalc_LDADD = -lm
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources) nodist_examples_rpcalc_rpcalc_SOURCES = \
$(rpcalc_sources)
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D% examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
dist_TESTS += %D%/rpcalc.test dist_TESTS += examples/rpcalc/rpcalc.test
## ------------ ##
## Installing. ##
## ------------ ##
rpcalcdir = $(docdir)/examples/rpcalc
rpcalc_DATA = $(rpcalc_extracted)
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2005-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+14 -19
View File
@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2008-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
*/ */
%debug %debug
%language "c++" %skeleton "lalr1.cc"
%defines %defines
%define api.token.constructor %define api.token.constructor
%define api.value.type variant %define api.value.type variant
@@ -25,9 +25,9 @@
%code requires // *.hh %code requires // *.hh
{ {
#include <list>
#include <string> #include <string>
#include <vector> typedef std::list<std::string> strings_type;
typedef std::vector<std::string> strings_type;
} }
%code // *.cc %code // *.cc
@@ -43,27 +43,22 @@ typedef std::vector<std::string> strings_type;
static parser::symbol_type yylex (); static parser::symbol_type yylex ();
} }
// Printing a vector of strings. // Printing a list of strings.
// Koening look up will look into std, since that's an std::vector. // Koening look up will look into std, since that's an std::list.
namespace std namespace std
{ {
std::ostream& std::ostream&
operator<< (std::ostream& o, const strings_type& ss) operator<< (std::ostream& o, const strings_type& s)
{ {
o << '(' << &ss << ") {"; std::copy (s.begin (), s.end (),
const char *sep = ""; std::ostream_iterator<strings_type::value_type> (o, "\n"));
for (strings_type::const_iterator i = ss.begin(), end = ss.end(); return o;
i != end; ++i)
{
o << sep << *i;
sep = ", ";
}
return o << '}';
} }
} }
// Conversion to string. // Conversion to string.
template <typename T> template <typename T>
inline
std::string std::string
string_cast (const T& t) string_cast (const T& t)
{ {
@@ -79,12 +74,12 @@ typedef std::vector<std::string> strings_type;
%token END_OF_FILE 0; %token END_OF_FILE 0;
%type <::std::string> item; %type <::std::string> item;
%type <::std::vector<std::string>> list; %type <::std::list<std::string>> list;
%% %%
result: result:
list { std::cout << $1 << '\n'; } list { std::cout << $1 << std::endl; }
; ;
list: list:
@@ -134,7 +129,7 @@ namespace yy
void void
parser::error (const parser::location_type& loc, const std::string& msg) parser::error (const parser::location_type& loc, const std::string& msg)
{ {
std::cerr << loc << ": " << msg << '\n'; std::cerr << loc << ": " << msg << std::endl;
} }
} }
+1 -1
Submodule gnulib updated: 0d10473be6...03e96cc338
+24 -28
View File
@@ -4,7 +4,8 @@
/*~ /*~
/.deps /.deps
/.dirstamp /.dirstamp
/_Noreturn.h /Makefile
/Makefile.in
/alignof.h /alignof.h
/alloca.h /alloca.h
/alloca.in.h /alloca.in.h
@@ -14,9 +15,7 @@
/asnprintf.c /asnprintf.c
/basename-lgpl.c /basename-lgpl.c
/basename.c /basename.c
/binary-io.c
/binary-io.h /binary-io.h
/bitrotate.c
/bitrotate.h /bitrotate.h
/c++defs.h /c++defs.h
/c-ctype.c /c-ctype.c
@@ -29,6 +28,8 @@
/charset.alias /charset.alias
/cloexec.c /cloexec.c
/cloexec.h /cloexec.h
/close-hook.c
/close-hook.h
/close-stream.c /close-stream.c
/close-stream.h /close-stream.h
/close.c /close.c
@@ -55,6 +56,7 @@
/exitfail.h /exitfail.h
/fatal-signal.c /fatal-signal.c
/fatal-signal.h /fatal-signal.h
/fclose.c
/fcntl.c /fcntl.c
/fcntl.h /fcntl.h
/fcntl.in.h /fcntl.in.h
@@ -79,27 +81,19 @@
/fseterr.h /fseterr.h
/fstat.c /fstat.c
/getdtablesize.c /getdtablesize.c
/getopt-cdefs.in.h
/getopt-core.h
/getopt-ext.h
/getopt-pfx-core.h
/getopt-pfx-ext.h
/getopt.c /getopt.c
/getopt.h /getopt.h
/getopt.in.h /getopt.in.h
/getopt1.c /getopt1.c
/getopt_int.h /getopt_int.h
/getprogname.c
/getprogname.h
/gettext.h /gettext.h
/gnulib.mk /gnulib.mk
/hard-locale.c
/hard-locale.h
/hash.c /hash.c
/hash.h /hash.h
/intprops.h /intprops.h
/inttypes.h /inttypes.h
/inttypes.in.h /inttypes.in.h
/ioctl.c
/isnan.c /isnan.c
/isnand-nolibm.h /isnand-nolibm.h
/isnand.c /isnand.c
@@ -109,15 +103,9 @@
/isnanl.c /isnanl.c
/itold.c /itold.c
/ldexpl.c /ldexpl.c
/limits.h
/limits.in.h
/localcharset.c /localcharset.c
/localcharset.h /localcharset.h
/lstat.c
/malloc.c /malloc.c
/malloca.c
/malloca.h
/math.c
/math.h /math.h
/math.in.h /math.in.h
/mbrtowc.c /mbrtowc.c
@@ -126,11 +114,12 @@
/mbswidth.h /mbswidth.h
/memchr.c /memchr.c
/memchr.valgrind /memchr.valgrind
/minmax.h
/msvc-inval.c /msvc-inval.c
/msvc-inval.h /msvc-inval.h
/msvc-nothrow.c /msvc-nothrow.c
/msvc-nothrow.h /msvc-nothrow.h
/nonblocking.c
/nonblocking.h
/obstack.c /obstack.c
/obstack.h /obstack.h
/obstack_printf.c /obstack_printf.c
@@ -151,6 +140,7 @@
/printf.c /printf.c
/progname.c /progname.c
/progname.h /progname.h
/quote.c
/quote.h /quote.h
/quotearg.c /quotearg.c
/quotearg.h /quotearg.h
@@ -164,7 +154,6 @@
/ref-del.sin /ref-del.sin
/sched.h /sched.h
/sched.in.h /sched.in.h
/sig-handler.c
/sig-handler.h /sig-handler.h
/sigaction.c /sigaction.c
/signal.h /signal.h
@@ -193,8 +182,6 @@
/spawnp.c /spawnp.c
/sprintf.c /sprintf.c
/stamp-h1 /stamp-h1
/stat-w32.c
/stat-w32.h
/stat.c /stat.c
/stdbool.h /stdbool.h
/stdbool.in.h /stdbool.in.h
@@ -205,6 +192,7 @@
/stdio--.h /stdio--.h
/stdio-impl.h /stdio-impl.h
/stdio-safer.h /stdio-safer.h
/stdio-write.c
/stdio.h /stdio.h
/stdio.in.h /stdio.in.h
/stdlib.h /stdlib.h
@@ -223,19 +211,24 @@
/stripslash.c /stripslash.c
/strndup.c /strndup.c
/strnlen.c /strnlen.c
/strtol.c
/strtoul.c
/strverscmp.c /strverscmp.c
/sys /sys
/sys_ioctl.h
/sys_ioctl.in.h /sys_ioctl.in.h
/sys_socket.h
/sys_socket.in.h /sys_socket.in.h
/sys_stat.h
/sys_stat.in.h /sys_stat.in.h
/sys_types.in.h /sys_types.in.h
/sys_wait.h
/sys_wait.in.h /sys_wait.in.h
/sysexits.in.h /sysexits.in.h
/time.h /time.h
/time.in.h /time.in.h
/unistd--.h /unistd--.h
/unistd-safer.h /unistd-safer.h
/unistd.c
/unistd.h /unistd.h
/unistd.in.h /unistd.in.h
/unitypes.h /unitypes.h
@@ -243,7 +236,6 @@
/uniwidth /uniwidth
/uniwidth.h /uniwidth.h
/uniwidth.in.h /uniwidth.in.h
/unlink.c
/unlocked-io.h /unlocked-io.h
/unsetenv.c /unsetenv.c
/vasnprintf.c /vasnprintf.c
@@ -252,6 +244,7 @@
/vfprintf.c /vfprintf.c
/vsnprintf.c /vsnprintf.c
/vsprintf.c /vsprintf.c
/w32sock.h
/w32spawn.h /w32spawn.h
/wait-process.c /wait-process.c
/wait-process.h /wait-process.h
@@ -259,7 +252,6 @@
/warn-on-use.h /warn-on-use.h
/wchar.h /wchar.h
/wchar.in.h /wchar.in.h
/wctype-h.c
/wctype.h /wctype.h
/wctype.in.h /wctype.in.h
/wcwidth.c /wcwidth.c
@@ -270,9 +262,13 @@
/xmalloc.c /xmalloc.c
/xmemdup0.c /xmemdup0.c
/xmemdup0.h /xmemdup0.h
/xsize.c
/xsize.h /xsize.h
/xstrndup.c /xstrndup.c
/xstrndup.h /xstrndup.h
/stat-time.c /binary-io.c
/stat-time.h /xsize.c
/bitrotate.c
/math.c
/sig-handler.c
/unistd.c
/wctype-h.c
+2 -2
View File
@@ -1,7 +1,7 @@
/* Array bitsets. /* Array bitsets.
Copyright (C) 2002-2003, 2006, 2009-2015, 2018 Free Software Copyright (C) 2002-2003, 2006, 2009-2013 Free Software Foundation,
Foundation, Inc. Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Functions to support abitsets. /* Functions to support abitsets.
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+2 -2
View File
@@ -1,7 +1,7 @@
/* Base bitset stuff. /* Base bitset stuff.
Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation,
Foundation, Inc. Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* General bitsets. /* General bitsets.
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Generic bitsets. /* Generic bitsets.
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Bitset statistics. /* Bitset statistics.
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Functions to support bitset statistics. /* Functions to support bitset statistics.
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2001-2002, 2004, 2006, 2009-2015, 2018 Free Software Copyright (C) 2001-2002, 2004, 2006, 2009-2013 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
+1 -2
View File
@@ -1,7 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Akim Demaille (akim@freefriends.org). Contributed by Akim Demaille (akim@freefriends.org).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2001-2002, 2004-2006, 2009-2015, 2018 Free Software Copyright (C) 2001-2002, 2004-2006, 2009-2013 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
+1 -2
View File
@@ -1,7 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Functions to support expandable bitsets. /* Functions to support expandable bitsets.
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Functions to support ebitsets. /* Functions to support ebitsets.
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* get-errno.c - get and set errno. /* get-errno.c - get and set errno.
Copyright (C) 2002, 2006, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002, 2006, 2009-2013 Free Software Foundation, Inc.
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* get-errno.h - get and set errno. /* get-errno.h - get and set errno.
Copyright (C) 2002, 2009-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+2 -2
View File
@@ -1,7 +1,7 @@
/* Functions to support link list bitsets. /* Functions to support link list bitsets.
Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation,
Foundation, Inc. Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Functions to support lbitsets. /* Functions to support lbitsets.
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -2
View File
@@ -1,7 +1,6 @@
/* Fake libiberty.h for Bison. /* Fake libiberty.h for Bison.
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation, Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc.
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+2 -4
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc. # Copyright (C) 2001-2013 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -51,8 +51,6 @@ lib_libbison_a_SOURCES += \
lib/get-errno.c lib/get-errno.c
# The Yacc compatibility library. # The Yacc compatibility library.
if ENABLE_YACC lib_LIBRARIES = $(YACC_LIBRARY)
lib_LIBRARIES = lib/liby.a
EXTRA_LIBRARIES = lib/liby.a EXTRA_LIBRARIES = lib/liby.a
lib_liby_a_SOURCES = lib/main.c lib/yyerror.c lib_liby_a_SOURCES = lib/main.c lib/yyerror.c
endif
+1 -1
View File
@@ -1,6 +1,6 @@
/* Yacc library main function. /* Yacc library main function.
Copyright (C) 2002, 2009-2015, 2018 Free Software Foundation, Inc. Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -1,6 +1,6 @@
/* Timing variables for measuring compiler performance. /* Timing variables for measuring compiler performance.
Copyright (C) 2000, 2002, 2004, 2006, 2009-2015, 2018 Free Software Copyright (C) 2000, 2002, 2004, 2006, 2009-2013 Free Software
Foundation, Inc. Foundation, Inc.
Contributed by Alex Samuel <samuel@codesourcery.com> Contributed by Alex Samuel <samuel@codesourcery.com>

Some files were not shown because too many files have changed in this diff Show More