Commit Graph

5835 Commits

Author SHA1 Message Date
Akim Demaille
b994c3bf78 doc: improve the doc of the examples
* examples/README: here.
2018-10-17 19:00:29 +02:00
Akim Demaille
03a13ce793 reader: recognize C++ even when it's not lalr1.cc or glr.cc
* src/reader.c (grammar_rule_check_and_complete): If a user uses her
own skeleton but sets the language to C++, recognize it as C++.
2018-10-17 17:53:51 +02:00
Akim Demaille
f5fc21240f maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-17 07:11:56 +02:00
Akim Demaille
ebddc0a0d2 version 3.1.90
* NEWS: Record release date.
v3.1.90
2018-10-17 06:32:48 +02:00
Akim Demaille
8359341013 examples: don't generate the position/stack files
* examples/variant-11.yy, examples/variant.yy: Require 3.2.
2018-10-16 22:41:13 +02:00
Akim Demaille
c7fe52e514 gnulib: update 2018-10-16 21:07:04 +02:00
Akim Demaille
5cdbc97c9d pacify syntax-checks
* lib/lbitset.c, tests/c++.at: here.
* cfg.mk: Add exceptions.
2018-10-16 18:54:06 +02:00
Akim Demaille
9017924783 regen 2018-10-16 13:41:45 +02:00
Akim Demaille
e3fdc37049 generate the default action only for C++
This commit adds restrictions to what was done in
01898726e2 [1].

Rici Lake [2] has shown that it's risky to disable the pre-action, at
least now.  Also, generating the default $$ = $1 action can have bad
effects in some cases [3].

The original change [1] was prompted for C++.  Let's try it there
only, for a start.  We could restrict it further to lalr1.cc with
variants, but we need to see in the wild how this change behaves.  And
it is not unreasonable to expect grammar files in C++ to behave better
wrt types.

See
[1] https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00050.html
[2] https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00061.html
[3] https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00066.html

* src/getargs.c: Style changes.
* src/reader.c (grammar_rule_check_and_complete): Complete only for
C++.
2018-10-16 13:41:09 +02:00
Akim Demaille
a99b4f45bb regen 2018-10-16 13:33:32 +02:00
Akim Demaille
ea31f21fd8 C++: let %require "3.2" disable the generation of obsolete files
The files stack.hh and position.hh are deprecated.  Rather than
devoting specify %define variables to discard them (api.position.file
and api.stack.file), and rather than having to use special rules when
api.location.file is used, let's simply decide that from %require
"3.2" onwards, these files will not be generated.

The only noticeable thing here is that, in order to be able to check
the behavior of %require "3.2", to have this version (which is still
3.1-*) to accept %require "3.2".

* src/gram.h, src/gram.c (required_version): New.
* src/parse-gram.y (version_check): Set it.
* src/output.c (prepare): Pass it m4.
* data/bison.m4 (b4_required_version_if): Receive it and use it.
* data/location.cc, data/stack.hh: Replace the api.*.file with only
required version comparison.
* tests/input.at: No longer check api.stack.file and api.position.file.
* NEWS, doc/bison.texi: Don't mention them.
Document the %require 3.2 behavior.
* tests/output.at: Use %require 3.2 instead.
2018-10-16 13:33:32 +02:00
Akim Demaille
2b0a9c69df java: bump to Java SE 7
macOS 10.14 no longer supports versions of Java earlier than 5.
And Java 6 will be deprecated by the end of this year.  So let's move
our requirement to Java 7.
Reported by Yu Yijun.
https://lists.gnu.org/archive/html/bug-bison/2018-09/msg00060.html
Suggested by Paul Eggert and Bruno Haible.
http://lists.gnu.org/archive/html/bug-gnulib/2018-10/msg00094.html

* configure.ac: Require Java 7, both compiler and runtime.
2018-10-15 20:28:08 +02:00
Akim Demaille
c69944ff8b doc: do not advertise %nterm
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html

* NEWS, doc/bison.texi: here.
2018-10-15 19:23:49 +02:00
Akim Demaille
01898726e2 generate the default semantic action
Currently, in C, the default semantic action is implemented by being
always run before running the actual user semantic action.  As a
consequence, when the user action is run, $$ is already set as $1.

In C++ with variants, we don't do that, since we cannot manipulate the
semantic value without knowing its exact type.  When variants are
enabled, the only guarantee is that $$ is default contructed and ready
to the used.

Some users still would like the default action to be run with
variants.  Frank Heckenbach's parser in
C++17 (http://lists.gnu.org/archive/html/bug-bison/2018-04/msg00011.html)
provides this feature, but relying on std::variant's dynamic typing,
which we forbid in lalr1.cc.

The simplest seems to be actually generating the default semantic
action (in all languages/skeletons).  This makes the pre-action (that
sets $$ to $1) useless.  But...  maybe some users depend on this, in
spite of the comments that clearly warn againt this.  So let's not
turn this off just yet.

* src/reader.c (grammar_rule_check_and_complete): Rename as...
(grammar_rule_check_and_complete): this.
Install the default semantic action when applicable.
* examples/variant-11.yy, examples/variant.yy, tests/calc.at:
Exercise the default semantic action, even with variants.
2018-10-14 18:53:21 +02:00
Jannick
20a6c3175f xml2xhtml.xsl: add UTF-8 encoding
To make arrows appear nicely in the browser. Currently it is shown as
some garbled something in mine (Firefox).

* data/xslt/xml2xhtml.xsl: here.
2018-10-14 18:53:21 +02:00
Akim Demaille
45ef3d92a1 reader: reorder some calls to separate checks from assignments
* src/reader.c (packgram): Move assignments to rules[ruleno] after the
checks on the rule.
2018-10-14 15:20:39 +02:00
Akim Demaille
fa386893aa C++: style: add missing space before parens
* data/c++.m4, data/lalr1.cc, data/stack.hh, data/variant.hh,
* examples/variant-11.yy: here.
2018-10-14 15:20:39 +02:00
Akim Demaille
dc73dc4fb2 gnulib: update timevar
See
https://lists.gnu.org/archive/html/bug-gnulib/2018-10/msg00005.html.
2018-10-14 15:15:29 +02:00
Akim Demaille
677a91aef2 style: modernize lib/vbitset.h 2018-10-11 08:54:14 +02:00
Akim Demaille
dab2ee0f74 style: modernize lib/vbitset.c 2018-10-11 08:54:14 +02:00
Akim Demaille
7f49dc7d1d style: modernize lib/lbitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
5f26baa748 style: modernize lib/lbitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
80752c0dc1 style: modernize lib/ebitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
f8c9c7acae style: modernize lib/ebitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
7d324cf00c style: modernize lib/bitsetv.c 2018-10-11 07:00:34 +02:00
Akim Demaille
98364385a6 style: modernize lib/bitsetv.h 2018-10-11 07:00:34 +02:00
Akim Demaille
b5197d5770 style: modernize lib/bitsetv-print.c 2018-10-11 07:00:34 +02:00
Akim Demaille
e9b69f8655 style: modernize lib/bitsetv-print.h 2018-10-11 07:00:34 +02:00
Akim Demaille
099339df0a style: modernize lib/bitset_stats.c 2018-10-11 07:00:34 +02:00
Akim Demaille
8e4ca87228 style: modernize lib/bitset_stats.h 2018-10-11 07:00:34 +02:00
Akim Demaille
72e2a94d5f style: modernize lib/bitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
059cb26ca2 style: modernize lib/bitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
c3d32f4a9a style: modernize lib/bbitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
74484f42f3 style: modernize lib/abitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
6565b9a566 style: modernize lib/abitset.h 2018-10-10 22:42:58 +02:00
Akim Demaille
b8351d06f1 C++: issue a better CPP guard and Doxygen file command
Currently we use "<dir><api.location.file>" as \file argument, and as
base for the CPP guard.  This is not nice when <dir> is absolute, in
which case it is expected that the user will use api.location.include
to get something nicer.  If defined, use that name instead.

* data/location.cc (b4_location_path): New.
Use it.
* tests/c++.at (Shared locations): Check the guard and Doxygen doc.
2018-10-09 18:58:50 +02:00
Akim Demaille
67521bc0e8 C++: remove stray empty line
* data/stack.hh: here.
2018-10-09 17:12:29 +02:00
Akim Demaille
4fb70e4dd3 doc: spell check 2018-10-09 17:02:30 +02:00
Akim Demaille
3ac6af879d doc: document api.*.file and the like
* doc/bison.texi (Exposing the Location Classes): New.
(%define Summary): Document api.location.file, api.location.include,
api.stack.file and api.position.file.
(C++ Bison Interface): stack.hh and position.hh are deprecated.
2018-10-09 17:02:26 +02:00
Akim Demaille
f3d09f3108 build: add missing gnulib libs
* src/local.mk (LDADD): Here.
2018-10-07 14:19:47 +02:00
Akim Demaille
1cb6c26b4f build: let timevar be dealt with by gnulib
* lib/local.mk (lib_libbison_a_SOURCES): Remove timevar.
2018-10-07 14:16:30 +02:00
Akim Demaille
c164fc0822 build: fix distcheck
Now that distcheck no longer fails (see previous commit), let's
address the shortcomings.

* Makefile.am (CLEANDIRS, clean-local): New.
* doc/local.mk, examples/calc++/local.mk, examples/local.mk,
* examples/mfcalc/local.mk, examples/rpcalc/local.mk,
* src/local.mk
(CLEANDIRS): Get rid of Apple's *.dSYM directories.
(CLEANFILES): Get rid of *.output files.
* examples/variant-11.yy, examples/variant.yy: Don't generate
any of the auxiliary files (location.hh and the like).
2018-10-07 10:41:40 +02:00
Akim Demaille
25347d885c README: work around a nasty behavior of gettext
`make update-po` runs:

    package_gnu="$(PACKAGE_GNU)"; \
    test -n "$$package_gnu" || { \
      if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
             LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \
                           -size -10000000c -exec grep 'GNU @PACKAGE@' \
                           /dev/null '{}' ';' 2>/dev/null; \
           else \
             LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
           fi; \
         } | grep -v 'libtool:' >/dev/null; then \
         package_gnu=yes; \
       else \
         package_gnu=no; \
       fi; \
    }; \

and based on the result, put GNU or not in the following line from
bison.pot:

    # This file is distributed under the same license as the GNU bison package.

It turns out that in my environment some log files had the 'GNU bison'
string (note the lower case), but in distcheck, these files are no
longer visible, so the generate bison.pot was different, and distcheck
failed because we try to update bison.pot, which is read only in
distcheck.

The heuristics should look accept 'GNU Bison', not just 'GNU bison'.
But let's please it to make sure we have our 'GNU'.

* README: Mention 'GNU bison'.
2018-10-07 10:41:40 +02:00
Akim Demaille
fa264a0687 NEWS: document api.*.file changes 2018-10-07 08:12:49 +02:00
Akim Demaille
5fe636c7ee c++: provide a means to control how location.hh is included
Users may want to generate the location file elsewhere, say
$top_srcdir/include/ast/location.hh.  Yet, we should not generate
`#include "$top_srcdir/include/ast/location.hh"` but probably
something like `#include <ast/location.hh>`, or `#include
"ast/location.hh", or `#include <location.hh>`.  It entirely depends
on the compiler flags (-I/-isystem) that are used.  Bison cannot guess
what is expected, so let's give the user a means to tell how the
location file should be included.

* data/location.cc (b4_location_file): New.
* data/glr.cc, data/lalr1.cc: Use it.
2018-10-06 18:13:48 +02:00
Akim Demaille
50b8d4ba5a c++: support absolute api.location.file names
In the case a user wants to create location.hh elsewhere, it can be
helpful to define api.location.file to some possibly absolute path
such as -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"'.
Currently this does not work with `-o foo/parser.cc`, as we join foo/
and $(top_srcdir) together, the latter starting with slash.

We should not try to do that in m4, manipulating file names is quite
complex when you through Windows file name in.  Let m4 delegate this
to gnulib.

* src/scan-skel.l (at_output): Accept up to two arguments.
* data/bison.m4 (b4_output): Adjust.
* tests/skeletons.at (Fatal errors but M4 continues producing output):
Adjust to keep the error.

* data/location.cc, data/stack.hh: Leave the concatenation to @output.
* tests/output.at: Exercise api.location.file with an absolute path.
2018-10-06 17:17:25 +02:00
Akim Demaille
57d69b04b2 c++: when api.location.file is defined, don't generate stack.hh
Make it easier to have fewer files.

* data/stack.hh: Don't generate stack.hh when api.location.file is
specified.
* tests/calc++.at, tests/output.at: Adjust tests.
2018-10-06 17:17:25 +02:00
Akim Demaille
3e6a075f7f c++: make position.hh completely useless
Let's put the definition of position into location.hh, there's no real
value in keeping them separate: they are small, and share the same
requirements.

To help users transition to this new model, still generate position.hh
by default, but as a simple include to location.hh.

* data/location.cc (api.position.file): Accept only 'none' as possible
value.
(position.hh): Make it a stub.
(location.hh): Adjust.
(b4_position_define): Merge into...
(b4_location_define): this.
* data/glr.cc, data/lalr1.cc, tests/input.at, tests/output.at: Adjust.
2018-10-06 17:17:25 +02:00
Akim Demaille
29b1da4e18 c++: make stack.hh completely useless
Let's completely deprecate stack.hh.  Don't provide a means to give it
a new name, allow only its removal.

See https://lists.gnu.org/archive/html/bison-patches/2018-09/msg00151.html
and https://lists.gnu.org/archive/html/bison-patches/2018-09/msg00182.html.

* data/stack.hh: Reduce stack.hh to a simple comment explaining how to
get rid of it.
* data/lalr1.cc: Adjust
* tests/input.at (%define file variables): Adjust.
* tests/output.at: Remove cases where stack.hh was removed.
2018-10-06 17:17:25 +02:00
Akim Demaille
667588ee8a c++: add support for api.position.file and api.location.file
* data/location.cc: Sort includes.
(b4_position_file, b4_location_file): New.
When there's a file for locations but not for positions, include the
definition of position in the location file.
* data/lalr1.cc (b4_shared_declarations): Include the
position/location file when it exists.
Otherwise, define the class.
* data/glr.cc: Likewise.
* tests/input.at (%define file variables): Check them.
* tests/output.at (C++ output): Check various cases with
api.position.file and api.location.file.
2018-10-06 17:17:25 +02:00