2020-04-05  Akim Demaille  <akim.demaille@gmail.com>

	version 3.5.4
	* NEWS: Record release date.

2020-04-05  Akim Demaille  <akim.demaille@gmail.com>

	examples: reccalc: really compile cleanly in C99
	The previous fix does not suffice, and actually managed to make things
	worse by defining yyscan_t twice in parse.y...

	Reported by kencu.
	https://trac.macports.org/ticket/59927#comment:29

	* examples/c/reccalc/parse.y (yyscan_t): Define it with the same
	guards as used by Flex.

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	news: announce that Bison 3.6 drops YYERROR_VERBOSE
	* NEWS: here.

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	news: update for 3.5.4

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	style: fix spellos
	* src/complain.c, src/print.c, src/print-xml.c, src/symtab.h: here.

2020-04-04  Adrian Vogelsgesang  <avogelsgesang@tableau.com>

	typo: succesful -> successful
	* tests/calc.at: Here.

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	package: improve the readme
	* README: Describe what Bison is.

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	java: check and fix support for api.token.raw
	* tests/local.at (AT_LANG_MATCH, AT_YYERROR_DECLARE(java))
	(AT_YYERROR_DECLARE_EXTERN(java), AT_PARSER_CLASS): New.
	(AT_MAIN_DEFINE(java)): Use AT_PARSER_CLASS.
	* tests/scanner.at: Add a test for Java.
	* data/skeletons/lalr1.java (yytranslate_): Cast the result.

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	java: style: prefer 'int[] foo' to 'int foo[]'
	* data/skeletons/java.m4 (b4_typed_parser_table_define): Here.

2020-04-04  Akim Demaille  <akim.demaille@gmail.com>

	build: fix syntax-check issues
	* src/system.h, tests/local.mk: Fix indentation.

2020-04-02  Akim Demaille  <akim.demaille@gmail.com>

	tests: recheck: work properly when the test suite was interrupted
	* tests/local.mk (recheck): Look at the per-test logs, not the overall
	log, which, when interrupted, contains only information about... the
	tests that passed.

2020-04-02  Akim Demaille  <akim.demaille@gmail.com>

	doc: c++: promote api.token.raw
	* doc/bison.texi (Calc++ Parser): Here.

2020-04-02  Akim Demaille  <akim.demaille@gmail.com>

	build: fix compatibility with old compilers
	GCC 4.2 dies with

	    src/InadequacyList.c: In function 'InadequacyList__new_conflict':
	    src/InadequacyList.c:37: error: #pragma GCC diagnostic not allowed inside functions
	    src/InadequacyList.c:37: error: #pragma GCC diagnostic not allowed inside functions
	    src/InadequacyList.c:40: error: #pragma GCC diagnostic not allowed inside functions

	Reported by Evan Lavelle.
	See https://lists.gnu.org/r/bug-bison/2020-03/msg00021.html
	and https://trac.macports.org/ticket/59927.

	* src/system.h (GCC_VERSION): New.
	Use it to control IGNORE_TYPE_LIMITS_BEGIN and
	IGNORE_TYPE_LIMITS_END.

2020-04-02  Akim Demaille  <akim.demaille@gmail.com>

	examples: reccalc: compile cleanly in C99
	See https://trac.macports.org/ticket/59927.

	* examples/c/reccalc/parse.y: C99 does not allow multiple typedefs.

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	version 3.5.3
	* NEWS: Record release date.

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	news: update for 3.5.3

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	yacc.c: make sure we properly propagated the user's number for error
	* data/skeletons/yacc.c (YYERRCODE): Be truthful.
	* tests/input.at (Redefining the error token): Check that.

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	diagnostics: don't crash because of repeated definitions of error
	According to https://www.unix.com/man-page/POSIX/1posix/yacc/, the
	user is allowed to specify her user number for the error token:

	    The token error shall be reserved for error handling. The name
	    error can be used in grammar rules. It indicates places where the
	    parser can recover from a syntax error. The default value of error
	    shall be 256. Its value can be changed using a %token
	    declaration. The lexical analyzer should not return the value of
	    error.

	I think this feature is useless, the user should not have to deal with
	that.  The intend is probably to give the user a means to use 256 if
	she wants to, but provided "error" cleared the path first by being
	assigned another number.  In the case of Bison, 256 is assigned to
	"error" at the end if the user did not use it for a token of hers.  So
	this feature is useless.

	Yet it is valid, and if the user assigns twice a token number to
	"error", then the second time we want to complain about it and want to
	show the original definition.  At this point, we try to display the
	built-in definition of "error", whose location is NULL, and we crash.

	Rather, the location of the first user definition of "error" should
	become its defining location.

	Reported byg Ahcheong Lee.
	https://lists.gnu.org/r/bug-bison/2020-03/msg00007.html

	* src/symtab.c (symbol_class_set): If this is a declaration and the
	symbol was not declared yet, keep this as defining location.
	* tests/input.at (Redefining the error token): New.

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	style: initialize some struct members
	* src/symtab.c (sym_content_new): Initialize all the location members.
	Not needed by the code, but disturbing values when using a debugger.

2020-03-08  Akim Demaille  <akim.demaille@gmail.com>

	diagnostics: beware of zero-width characters
	Currenly we rely on (visual) width of the characters to decide where
	to open and close the styling of the quoted lines.  This breaks when
	we deal with zero-width characters: we cannot just rely on (visual)
	columns, we need to know whether we are before, inside, or after the
	highlighted portion.

	* src/location.c (location_caret): col_end: no longer add 1, "regular"
	characters have a width of 1, only 0-width characters have 0-width.
	opened: replace with 'state', a three-valued enum.
	Don't reopen the style if we already did.
	* tests/diagnostics.at (Zero-width characters): New.

2020-03-07  Akim Demaille  <akim.demaille@gmail.com>

	diagnostics: be sure to close the styling when lines are too short
	     bar.y:4.12-17: <error>error:</error> redefining user token number of foo
	    -    4 | %token foo <error>123
	    +    4 | %token foo <error>123</error>
	           |            <error>^~~~~~</error>

	* src/location.c (location_caret): Be sure to close.
	* tests/diagnostics.at (Line is too short, and then you die): New.

2020-03-07  Akim Demaille  <akim.demaille@gmail.com>

	muscles: fix incorrect decoding of $
	Bug introduced in 458171e6df5a0110a35ee45ad8b2e9f6fb426f1d.
	https://lists.gnu.org/archive/html/bison-patches/2013-11/msg00009.html

	Reported by Ahcheong Lee.
	https://lists.gnu.org/r/bug-bison/2020-03/msg00010.html

	* src/muscle-tab.c (COMMON_DECODE): "$" is coded as "$][", not "$[][".
	* tests/input.at ("%define" enum variables): Check that case.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	code: be robust to reference with invalid tags
	Because we want to support $<a->b>$, we must accept -> in type tags,
	and reject $<->$, as it is unfinished.
	Reported by Ahcheong Lee.

	* src/scan-code.l (yylex): Make sure "tag" does not end with -, since
	-> does not close the tag.
	* tests/input.at (Stray $ or @): Check this.

2020-03-06  Akimn Demaille  <akim.demaille@gmail.com>

	build: fix typo
	* build-aux/cross-options.pl: here.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	doc: update recommandation for libtextstyle
	* README: here.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	style: comment changes
	* src/symtab.h, src/lr0.c: here.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	examples: use consistently the GFDL header for readmes
	* examples/c++/README.md, examples/c++/calc++/README.md,
	* examples/c/calc/README.md, examples/c/lexcalc/README.md,
	* examples/c/reccalc/README.md:
	Prefer the GFDL banner to the GPL one.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	style: remove useless declarations
	* src/reader.h: Don't duplicate what parse-gram.h already exposes.
	* src/lr0.h: Remove useless include.

2020-03-06  Adrian Vogelsgesang  <avogelsgesang@tableau.com>

	typo: succesful -> successful
	* data/skeletons/lalr1.cc: here
	* etc/bench.pl.in: here
	* src/location.c: and here.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	README: point to tests/bison, and document --trace
	Reported by Victor Morales Cayuela.

	* README, README-hacking.md: here.

2020-03-06  Akim Demaille  <akim.demaille@gmail.com>

	gnulib: update

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	version 3.5.2
	* NEWS: Record release date.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	news: 3.5.2
	* NEWS: Update.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	gnulib: update

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	doc: update Doxygen template
	* Doxyfile.in: Run doxygen -u on it.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	java: avoid trailing white spaces
	* data/skeletons/java.m4 (b4_maybe_throws): Issue a space before when needed.
	* data/skeletons/lalr1.java: Avoid trailing spaces.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	m4: fix b4_token_format
	We used to emit:

	    /** Token number,to be returned by the scanner.  */
	    static final int NUM = 258;
	    /** Token number,to be returned by the scanner.  */
	    static final int NEG = 259;

	with no space after the comma.  Fix that.

	* data/skeletons/bison.m4 (b4_token_format): Quote where appropriate.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	doc: clearly state that %yacc only makes sense with yacc.c
	* doc/bison.texi: here.

2020-02-13  Akim Demaille  <akim.demaille@gmail.com>

	doc: spell check
	* doc/bison.texi: here.

2020-01-21  Akim Demaille  <akim.demaille@gmail.com>

	examples: be more robust to spaces in paths
	Reported by Nikki Valen.
	https://lists.gnu.org/r/bug-bison/2020-01/msg00032.html

	* examples/test ($prog): Remove, replaced by...
	(prog): This new function, which pays attention to quoting shell
	variables.

2020-01-21  Adrian Vogelsgesang  <avogelsgesang@tableau.com>

	larlr1.cc: Reject unsupported values for parse.lac
	Just as the yacc.c skeleton, the lalr1.cc skeleton should reject
	invalid values for parse.lac.

	* data/skeletons/lalr1.cc: check validity of parse.lac
	* tests/input.at: new test cases

2020-01-19  Akim Demaille  <akim.demaille@gmail.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

2020-01-19  Akim Demaille  <akim.demaille@gmail.com>

	version 3.5.1
	* NEWS: Record release date.

2020-01-19  Akim Demaille  <akim.demaille@gmail.com>

	news: update

2020-01-19  Akim Demaille  <akim.demaille@gmail.com>

	CI: use ICC again
	See https://github.com/nemequ/icc-travis/issues/15.
	Thanks to Jeff Hammond and Evan Nemerson for their help.

	* configure.ac (warn_common): Disable dubious warnings.
	* .travis.yml: Use ICC again.

2020-01-19  Akim Demaille  <akim.demaille@gmail.com>

	warnings: pacify ICC in lalr1.cc
	See 139d0655947c87f90af08718618feaaca0e558d7.

	* data/skeletons/yacc.c: If I might be a char, write a[+I] instead of
	a[I], so that ICC does not complain.

2020-01-19  Jim Meyering  <meyering@fb.com>

	test: report.at: avoid tiny new failure
	Be robust to newer versions of Autoconf where the package URL defaults
	to https instead of http.

	* configure.ac (AC_INIT): Use https.
	* tests/report.at: Adjust expected output s/http/https/
	to match updated URL.

2020-01-19  Akim Demaille  <akim.demaille@gmail.com>

	git: update ignores

2020-01-11  Akim Demaille  <akim.demaille@gmail.com>

	gnulib: update

2020-01-10  Akim Demaille  <akim.demaille@gmail.com>

	lalr1.cc: avoid static_cast
	Reported by donmac703.
	Fixes https://github.com/akimd/bison/issues/20.

	* data/skeletons/lalr1.cc: here.

2020-01-10  Akim Demaille  <akim.demaille@gmail.com>

	glr.c: add missing cast
	Reported by psjo.
	Fixes https://github.com/akimd/bison/issues/19.

	* data/skeletons/glr.c (yyprocessOneStack): Here.

2020-01-10  Akim Demaille  <akim.demaille@gmail.com>

	regen

2020-01-10  Akim Demaille  <akim.demaille@gmail.com>

	package: bump copyrights to 2020
	Run 'make update-copyright'.

2020-01-10  Akim Demaille  <akim.demaille@gmail.com>

	gitignore: update

2019-12-31  Akim Demaille  <akim.demaille@gmail.com>

	tests: also check -Wchar-subscripts
	GCC's -Wchar-subscripts may report issues on platforms where char is
	unsigned.  Unfortunately the current CI does not reproduce the
	problem.  But that would allow contributors to report issues if the
	warning appears somewhere.

	See 139d0655947c87f90af08718618feaaca0e558d7.
	Problem reported by Andy Fiddaman in:
	https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html

	* configure.ac (warn_common): Add -Wchar-subscripts.

2019-12-30  Akim Demaille  <akim.demaille@gmail.com>

	CI: do not specify the language
	When we give travis the langugage, it overrides our envvars.  Instead
	of the MATRIX_EVAL trick, just stop specifying the language.

2019-12-30  Akim Demaille  <akim.demaille@gmail.com>

	CI: remove ICC support, we can no longer use it
	https://github.com/nemequ/icc-travis/issues/15

2019-12-29  Akim Demaille  <akim.demaille@gmail.com>

	doc: clean up the description of YYDEBUG
	* doc/bison.texi: Make it clearer that %define parse.trace is the
	preferred options.
	Fix a typo about api.prefix.

2019-12-29  Akim Demaille  <akim.demaille@gmail.com>

	glr.cc: avoid compiler warnings
	    381. types.at:366: testing glr.cc api.value.type={double} ...
	    test.cc:207:57: error: "__clang_major__" is not defined, evaluates to 0 [-Werror=undef]
	      207 | #if defined __APPLE__ && YY_CPLUSPLUS < 201103L && 4 <= __clang_major__
	          |                                                         ^~~~~~~~~~~~~~~

	* data/skeletons/glr.cc: Check __clang_major__ before using it.

2019-12-18  Paul Eggert  <eggert@cs.ucla.edu>

	warnings: pacify ‘gcc -Wchar-subscripts’ in yacc.c
	Problem reported by Andy Fiddaman in:
	https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html
	* data/skeletons/yacc.c (yy_reduce_print, yy_lac, yysyntax_error)
	(yyreturn): If I might be a char, write a[+I] instead of a[I],
	so that ‘gcc -Wchar-subscripts’ does not complain.

2019-12-14  Akim Demaille  <akim.demaille@gmail.com>

	doc: formatting changes
	* doc/bison.texi: No output changes.

2019-12-14  Akim Demaille  <akim.demaille@gmail.com>

	tests: don't fail if seq is no available
	As is the case on Solaris.
	Reported by Dennis Clarke.
	https://lists.gnu.org/archive/html/bug-bison/2019-12/msg00011.html

	* examples/c/reccalc/reccalc.test: Skip if there is no seq.

2019-12-11  Akim Demaille  <akim.demaille@gmail.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

2019-12-11  Akim Demaille  <akim.demaille@gmail.com>

	version 3.5
	* NEWS: Record release date.

2019-12-10  Akim Demaille  <akim.demaille@gmail.com>

	news: prepare for 3.5

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	glr.cc: disable warnings from Clang on macOS
	    $ cat test.cc
	    #include <stddef.h>
	    #include <stdint.h>

	    ptrdiff_t half_max_capacity = PTRDIFF_MAX;
	    $ clang++-mp-9.0 -pedantic -std=c++98 /tmp/test.cc -c
	    /tmp/test.cc:4:31: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
	    ptrdiff_t half_max_capacity = PTRDIFF_MAX;
	                                  ^
	    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:149:23:
	            note: expanded from macro 'PTRDIFF_MAX'
	    #define PTRDIFF_MAX       INT64_MAX
	                              ^
	    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:75:26:
	            note: expanded from macro 'INT64_MAX'
	    #define INT64_MAX        9223372036854775807LL
	                             ^
	    1 warning generated.

	* data/skeletons/glr.cc: here.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	api.token.raw: fix it in C++
	Another breakage revealed by vcsn.

	* data/skeletons/c++.m4 (yytranslate_): Do not hard code "yy" and
	"parser", both can be changed by the user.
	Actually, since we are in the parser itself, there's really no need to
	qualify the type.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	c++: fix comments for %code blocks
	In a project of mine, vcsn, this commit fixes the following comments.

	    --- /tmp/parse.hh	2019-12-08 15:51:24.792934703 +0100
	    +++ lib/vcsn/rat/parse.hh	2019-12-08 16:00:59.137107503 +0100
	    @@ -43,7 +43,7 @@

	     #ifndef YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
	     # define YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
	    -// //                    "%code requires" blocks.
	    +// "%code requires" blocks.
	     #line 20 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy"

	       #include <iostream>
	    @@ -1851,7 +1851,7 @@

	    -// //                    "%code provides" blocks.
	    +// "%code provides" blocks.
	     #line 60 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy"

	       #define YY_DECL_(Class) \

	* data/skeletons/bison.m4 (b4_percent_code_get): Pass an expanded
	string to b4_comment.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	parser: pretend we are Bison 3.5
	* src/parse-gram.y: Accept we're Bison 3.5.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	c++: fix spello
	* data/skeletons/lalr1.cc: here.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	todo: update
	* TODO: Schedule some features for 3.6.
	Remove obsolete stuff.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	version 3.4.92
	* NEWS: Record release date.

2019-12-08  Akim Demaille  <akim.demaille@gmail.com>

	news: fixes
	Reported by Paul Eggert.
	https://lists.gnu.org/archive/html/bison-patches/2019-12/msg00014.html

	* NEWS: here.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	doc: minor changes
	* README-hacking.md: here.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	gnulib: update

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	doc: clearly deprecate YYPRINT
	* doc/bison.texi (Prologue): Stop using YYPRINT as an example.
	(The YYPRINT Macro): Clearly show this macro is deprecated.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	doc: formatting changes
	* doc/bison.texi: here.
	No change in content.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	news: update

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	d: obey parse.error
	* data/skeletons/lalr1.d (yysyntax_error): Let the dispatch be
	bison-time, not runtime.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	c++: also prefer YY_ASSERT to YYASSERT
	Like the other skeletons.

	* data/skeletons/variant.hh: here.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	glr.c: obey the parse.assert %define variable
	* data/skeletons/glr.c (YYASSERT): Rename as...
	(YY_ASSERT): this, for consistency with yacc.c, and also to emphasize
	the fact that this is not for the end user (YY_ prefix).
	* tests/glr-regression.at: Define parse.assert.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	c++: beware of short ranges for state numbers
	Now that we use small integral types, possibly unsigned (e.g.,
	unsigned char), to store state numbers, using -1 to denote an empty
	state (i.e., a state that stores no semantical value) is very
	dangerous: it will be confused with state 255, which might be
	non-empty.

	Rather than allocating a larger range of state numbers to keep the
	empty-state apart, let's use the number of a state known to store no
	value.  The initial state, numbered 0, seems to fit perfectly the job.

	Reported by Frank Heckenbach.
	https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html

	* data/skeletons/lalr1.cc (empty_state): Be 0.

2019-12-07  Akim Demaille  <akim.demaille@gmail.com>

	api.token.raw: check it against api.token.constructor
	* tests/scanner.at: here.

2019-12-06  Akim Demaille  <akim.demaille@gmail.com>

	regen

2019-12-06  Akim Demaille  <akim.demaille@gmail.com>

	warnings: enable -Wuseless-cast, and eliminate warnings
	Prompted by Frank Heckenbach.
	https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html.

	* configure.ac (warn_cxx): Add -Wuseless-cast.
	* data/skeletons/c.m4 (b4_attribute_define): Define
	YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END.
	* data/skeletons/glr.c (YY_FPRINTF): New, replaces YYFPRINTF, wrapped
	with YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END.
	(YY_DPRINTF): Likewise.
	* tests/actions.at: Remove useless cast.
	* tests/headers.at: Adjust.

2019-12-02  Akim Demaille  <akim.demaille@gmail.com>

	diagnostics: style changes
	* src/complain.h, src/complain.c: Comment changes.
	* src/scan-skel.l: Reduce scopes.
	* data/skeletons/bison.m4: Factor diagnostic functions.

2019-12-02  Akim Demaille  <akim.demaille@gmail.com>

	glr.c: style changes
	* data/skeletons/glr.c (yysplitStack): Reduce scopes.
	* tests/atlocal.in: Formatting changes.

2019-12-01  Akim Demaille  <akim.demaille@gmail.com>

	c++: get rid of symbol_type::token ()
	It is not used.  And its implementation was wrong when api.token.raw
	was defined, as it was still mapping to the external token numbers,
	instead of the internal ones.  Besides it was provided only when
	api.token.constructor is defined, yet always declared.

	* data/skeletons/c++.m4 (by_type::token): Remove, useless.

2019-12-01  Akim Demaille  <akim.demaille@gmail.com>

	c++: remove useless cast about user_token_number_max_
	Reported by Frank Heckenbach.
	https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html

	The cast is needed when yytranslate_'s argument type is token_type,
	i.e., when api.token.constructor is defined.

	    373. types.at:138: testing lalr1.cc api.value.type=variant api.token.constructor ...
	    ======== Testing with C++ standard flags: ''
	    ../../tests/types.at:138: bison --color=no -fno-caret  -o test.cc test.y
	    ../../tests/types.at:138: $CXX $CXXFLAGS $CPPFLAGS  $LDFLAGS -o test test.cc $LIBS
	    stderr:
	    test.cc:966:16: error: result of comparison of constant 257 with
	                    expression of type 'yy::parser::token_type'
	                   (aka 'yy::parser::token::yytokentype') is always true
	                   [-Werror,-Wtautological-constant-out-of-range-compare]
	        else if (t <= user_token_number_max_)
	                 ~ ^  ~~~~~~~~~~~~~~~~~~~~~~
	    1 error generated.

	It is because it is expected that when api.token.constructor is
	defined, only symbol constructors will be used, that yytranslate_ then
	takes a token_type.  But it is wrong: we still allow literal
	characters in this case, as demonstrated by test 373 for instance.

	    %define api.value.type variant
	    %define api.token.constructor
	    %token <std::pair<int, int>> '1' '2';
	    [...]
	    static yy::parser::symbol_type yylex ()
	    {
	      static char const input[] = "12";
	      int res = input[toknum++];
	      typedef yy::parser::symbol_type symbol;
	      if (res)
	        return symbol (res, std::make_pair (res - '0', res - '0' + 1));
	      else
	        return symbol (res);
	    }

	So let yytranslate_ always take an int, which makes the cast truly
	useless.

	* data/skeletons/c++.m4, data/skeletons/lalr1.cc (yytranslate_): here.

2019-12-01  Akim Demaille  <akim.demaille@gmail.com>

	c++: clean a few issues wrt special tokens
	The C++ implementation of LAC did not skip the $undefined token,
	probably because it was not exposed.  Expose it, and use clearer
	names.

	* data/skeletons/c++.m4: Don't define undef_token_ in yytranslate_,
	but...
	* data/skeletons/lalr1.cc (yy_undef_token_): here.
	Use a more precise type to define yy_undef_token_ and yy_error_token_.
	Unfortunately we move from a compile-time value defined via an enum to
	a static const member.  Eventually we should make it constexpr.
	Make LAC implementation more alike yacc.c's one.

2019-12-01  Akim Demaille  <akim.demaille@gmail.com>

	d, java: improve yytranslate and neighbors
	* data/skeletons/lalr1.d, data/skeletons/lalr1.java: Don't expose
	yyuser_token_number_max_ and yyundef_token_.  Do as in C++: scope them
	into yytranslate_, and only when api.token.raw is not defined.
	(yyterror_): Rename as...
	(yy_error_token_): this.
	* data/skeletons/lalr1.d (token_number_type): New.
	Use it.
	Can't be done in the Java backend, as Java does not have type aliases.

2019-12-01  Akim Demaille  <akim.demaille@gmail.com>

	d, java: get rid of a useless table
	* data/skeletons/lalr1.d, data/skeletons/lalr1.java (yytoken_number_):
	Remove, useless.
	Was used in ancient C skeletons to support YYPRINT, long obsoleted by
	%printer.

2019-11-30  Akim Demaille  <akim.demaille@gmail.com>

	c++, d, java: remove yyerrcode
	It is not used at all.  We will remove it also from yacc.c, but
	later (see TODO).

	* data/skeletons/lalr1.cc, data/skeletons/lalr1.d,
	* data/skeletons/lalr1.java (yyerrcode_):
	Remove.

2019-11-30  Akim Demaille  <akim.demaille@gmail.com>

	c++: improve typing
	* data/skeletons/lalr1.cc (yysyntax_error_): symbol_type::type_get
	returns a symbol_number_type (which is indeed an int).

2019-11-30  Akim Demaille  <akim.demaille@gmail.com>

	c++: remove useless cast about yyeof_
	Reported by Frank Heckenbach.
	https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html

	* data/skeletons/c++.m4 (b4_yytranslate_define): Don't use yyeof_ as
	if it had two different types.
	It is used once against the input argument, which is the value
	returned by yylex, which is an "external token number", typically an
	int.  It is also used as output type, an "internal symbol number".
	It turns out that in both cases we mean "0", but let's keep yyeof_
	only for the case "internal symbol number", i.e., _after_ conversion
	by yytranslate.
	This frees us from one cast.

2019-11-30  Akim Demaille  <akim.demaille@gmail.com>

	glr: style change
	* data/skeletons/glr.c (YYDPRINTF): Expand into an empty statement,
	instead of nothing.
	Simplify callers.

2019-11-30  Akim Demaille  <akim.demaille@gmail.com>

	glr: remove useless casts
	Reported by GCC's -Wuseless-cast.

	* data/skeletons/glr.c: Don't cast to yybool, it's useless.

2019-11-29  Akim Demaille  <akim.demaille@gmail.com>

	yacc.c, glr.c: fix crash when reporting errors in consistent states
	The current code for yysyntax_error for %define parse.error verbose is
	fishy (given that YYEMPTY is -2, invalid argument for yytname[]):

	    static int
	    yysyntax_error ([...])
	    {
	      YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
	    [...]
	      if (yytoken != YYEMPTY)

	A nearby comment reports

	    The only way there can be no lookahead present (in yychar) is if
	    this state is a consistent state with a default action.  Thus,
	    detecting the absence of a lookahead is sufficient to determine
	    that there is no unexpected or expected token to report.  In that
	    case, just report a simple "syntax error".

	So it _is_ possible to call yysyntax_error with yytoken == YYEMPTY,
	albeit quite difficult when meaning to, so virtually impossible by
	accident (after all, there was never a bug report about this).

	I failed to produce a test case, but Joel E. Denny provided me with
	one (added to the test suite below).  The yacc.c skeleton fails on
	this, and once fixed dies on a second problem.  The glr.c skeleton was
	also dying, but immediately of this second problem.

	Indeed we were not allocating space for the error message's final \0.
	This was hidden by the fact that we only had error messages with at
	least an unexpected token displayed, so with at least one "%s" in the
	format string, whose size (2) was included (incorrectly) in the final
	size of the message (where the %s have been replaced by the actual
	content).

	* data/skeletons/glr.c, data/skeletons/yacc.c (yysyntax_error):
	Do not invoke yytnamerr on YYEMPTY.
	Clarify the computation of the length of the _final_ error message,
	with the NUL terminator but without the '%s's.
	* tests/conflicts.at (Syntax error in consistent error state):
	New, contributed by Joel E. Denny.

2019-11-26  Akim Demaille  <akim.demaille@gmail.com>

	tests: avoid creating files whose name collide with standard headers
	Having a file named "exception" is risky: the compiler might use that
	file in #include.
	Reported by 马俊 <majun123@whu.edu.cn>.

	* tests/local.at (AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR): Generate
	'exceptions', not 'exception'.

2019-11-22  Akim Demaille  <akim.demaille@gmail.com>

	doc: more details about the test suite
	* README-hacking.md: here.

2019-11-20  Akim Demaille  <akim.demaille@gmail.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

2019-11-20  Akim Demaille  <akim.demaille@gmail.com>

	version 3.4.91
	* NEWS: Record release date.

2019-11-20  Akim Demaille  <akim.demaille@gmail.com>

	style: pacify syntax-check
	* cfg.mk: No need to translate *.md files.
	* data/skeletons/glr.c, data/skeletons/yacc.c: Fix space issues.

2019-11-19  Akim Demaille  <akim.demaille@gmail.com>

	gnulib: update

2019-11-18  Akim Demaille  <akim.demaille@gmail.com>

	doc: don't promote dangling aliases
	String literals as tokens serve two distinct purposes: freeing from
	having to implement the keyword matching in the scanner, and improving
	error messages.  Most of the time both can be achieved at the same
	time, but on occasions, it does not work so well.

	We promote their use for error messages.  We will also still support
	the former case, but it is _not_ the recommended approach.

	* doc/bison.texi (Tokens from Literals): Clearly state that we don't
	recommend looking up the token types in the list of token names.

2019-11-17  Akim Demaille  <akim.demaille@gmail.com>

	diagnostics: complain about undeclared string tokens
	String literals, which allow for better error messages, are (too)
	liberally accepted by Bison, which might result in silent errors.  For
	instance

	    %type <exVal> cond "condition"

	does not define “condition” as a string alias to 'cond' (nonterminal
	symbols do not have string aliases).  It is rather equivalent to

	    %nterm <exVal> cond
	    %token <exVal> "condition"

	i.e., it gives the type 'exVal' to the "condition" token, which was
	clearly not the intention.

	Introduce -Wdangling-alias to catch this.

	* src/complain.h, src/complain.c: Add support for -Wdangling-alias.
	(argmatch_warning_args): Sort.
	* src/symtab.c (symbol_check_defined): Complain about dangling
	aliases.
	* doc/bison.texi: Document it.
	* tests/input.at (Dangling aliases): New test.

2019-11-17  Akim Demaille  <akim.demaille@gmail.com>

	diagnostics: yacc reserves %type to nonterminals
	On

	    %token TOKEN1
	    %type  <ival> TOKEN1 TOKEN2 't'
	    %token TOKEN2
	    %%
	    expr:

	bison -Wyacc gives

	    input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
	        2 | %type  <ival> TOKEN1 TOKEN2 't'
	          |               ^~~~~~
	    input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
	        2 | %type  <ival> TOKEN1 TOKEN2 't'
	          |                             ^~~
	    input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
	        2 | %type  <ival> TOKEN1 TOKEN2 't'
	          |                      ^~~~~~

	The messages appear to be out of order, but they are emitted when the
	error is found.

	* src/symtab.h (symbol_class): Add pct_type_sym, used to denote
	symbols appearing in %type.
	* src/symtab.c (complain_pct_type_on_token): New.
	(symbol_class_set): Check that %type is not applied to tokens.
	(symbol_check_defined): pct_type_sym also means undefined.
	* src/parse-gram.y (symbol_decl.1): Set the class to pct_type_sym.
	* src/reader.c (grammar_current_rule_begin): pct_type_sym also means
	undefined.
	* tests/input.at (Yacc's %type): New.

2019-11-16  Akim Demaille  <akim.demaille@gmail.com>

	doc: promote %nterm over %type
	As an extension to POSIX Yacc, Bison's %type accepts tokens.
	Unfortunately with string literals as implicit tokens, this is
	misleading, and led some users to write

	    %type <exVal> cond "condition"

	believing that "condition" would be associated to the 'cond'
	nonterminal (see https://github.com/apache/httpd/pull/72).

	* doc/bison.texi: Promote %nterm rather than %type to declare the type
	of nonterminals.
