Commit Graph

784 Commits

Author SHA1 Message Date
Akim Demaille
3f4ffea6f2 glr.cc: don't leak glr.c/glr.cc scaffolding to the user
Until we have a decent reimplementation of glr.cc, we have to use
tricks to shoehorn C++ symbols to the C engine of glr.c.  Some of them
are done via #define.  Unfortunately in Bison 3.6 some of these we
done in the header file, which broke valid user code.

Reported by Egor Pugin.
https://lists.gnu.org/r/bug-bison/2020-06/msg00003.html

* data/skeletons/glr.cc: Stop playing tricks with b4_pre_epilogue.
(b4_glr_cc_setup, b4_glr_cc_cleanup): New.
Much cleaner way to instal glr.cc's scaffolding around glr.c.
* data/skeletons/glr.c: Adjust to use them.
2020-06-15 20:18:47 +02:00
Akim Demaille
508ac09939 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-06-03 07:52:30 +02:00
Akim Demaille
0535d2a608 version 3.6.3
* NEWS: Record release date.
2020-06-03 07:31:43 +02:00
Akim Demaille
52ce2a008b build: check -Wmissing-prototypes
pstate_clear is lacking a prototype.
Reported by Ryan
https://lists.gnu.org/r/bug-bison/2020-05/msg00101.html

Besides, none of the C examples were compiled with the warning flags.

* configure.ac (warn_c): Add -Wmissing-prototypes.
* data/skeletons/yacc.c (pstate_clear): Make it static.
* examples/local.mk (TEST_CFLAGS): New.
* examples/c/bistromathic/local.mk, examples/c/calc/local.mk,
* examples/c/lexcalc/local.mk, examples/c/mfcalc/local.mk,
* examples/c/pushcalc/local.mk, examples/c/reccalc/local.mk,
* examples/c/rpcalc/local.mk:
Use it.

GCC's warn_unused_result is not silenced by a cast to void, so we have
to "use" scanf's result.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

Flex generated code produces too many warnings, including things such
as, with ICC:

    examples/c/lexcalc/scan.c(1088): error #1682: implicit conversion
              of a 64-bit integral type to a smaller integral type (potential portability problem)
    2259                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
    2260                ^
    2261
    2262

I am tired of trying to fix Flex's output.  The project does not seem
maintained.  We ought to avoid it.  So, for the time being, don't try
to enable warnings with Flex.

* examples/c/bistromathic/parse.y, examples/c/reccalc/scan.l: Fix
warnings.
* doc/bison.texi: Discard scanf's return value to defeat
-Werror=unused-result.
2020-06-01 08:29:53 +02:00
Akim Demaille
4d9fa28ba8 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-05-17 08:55:47 +02:00
Akim Demaille
a100a3c4c1 version 3.6.2
* NEWS: Record release date.
2020-05-17 08:30:46 +02:00
Akim Demaille
465babb635 fix: do not emit nested comments
With input such as

    %token<fl> yVL_CLOCK "/*verilator sc_clock*/"

we generate

    yVL_CLOCK = 610,      /* "/*verilator sc_clock*/"  */

which is invalid since the comment will actually be closed on the
first "*/".  Let's turn "*/" into "*\/" to avoid this.  But GCC will
also warn about "/*" inside a comment, so let's "escape" it too.

Reported by Huang Rui.
https://github.com/akimd/bison/issues/38

* data/skeletons/c-like.m4 (_b4_comment): Escape comment delimiters in
comments.
* tests/input.at (Torturing the Scanner): Check thes cases.
* tests/m4.at: New.
2020-05-17 08:28:12 +02:00
Akim Demaille
dbaed0bbf2 tests: don't use == to compare const char *...
Reported by Dagobert Michelsen.
https://lists.gnu.org/r/bug-bison/2020-05/msg00091.html

* tests/c++.at: here.
2020-05-14 07:26:34 +02:00
Akim Demaille
da29809969 news: update 2020-05-10 17:32:28 +02:00
Akim Demaille
87e4895189 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-05-10 14:47:51 +02:00
Akim Demaille
01e3f45f83 version 3.6.1
* NEWS: Record release date.
2020-05-10 14:28:24 +02:00
Akim Demaille
bf98d94f4f c++: provide yy::parser::symbol_type::name
* data/skeletons/c++.m4 (yy::parser::basic_symbol::name): New.
* data/skeletons/lalr1.cc (yy_print_): Use it.
* doc/bison.texi: Document.
* tests/c++.at: Check.
2020-05-10 10:01:35 +02:00
Akim Demaille
6bb37dbe27 c++: make parser::symbol_name public
Reported by Martin Blais <blais@furius.ca>.
https://lists.gnu.org/r/help-bison/2020-05/msg00005.html

* data/skeletons/lalr1.cc (symbol_name): Make it public.
Add a private hidden hook to enable testing of private parts.
* tests/local.at (AT_DATA_GRAMMAR_PROLOGUE): Help Emacs find the right
language mode.
* tests/c++.at (C++ Variant-based Symbols Unit Tests): Check that we
can read symbol_name.
2020-05-10 09:42:37 +02:00
Akim Demaille
c3585f41ef examples: beware of ~/.inputrc
* examples/c/bistromathic/bistromathic.test: here.
2020-05-10 09:40:07 +02:00
Akim Demaille
0c77d69721 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-05-08 10:15:38 +02:00
Akim Demaille
307fcdee00 version 3.6
* NEWS: Record release date.
2020-05-08 09:57:14 +02:00
Akim Demaille
a5fb4a88ef news: prepare for 3.6 2020-05-08 07:34:30 +02:00
Akim Demaille
76dab18af3 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-05-06 08:48:05 +02:00
Akim Demaille
c982974f33 version 3.5.94
* NEWS: Record release date.
2020-05-06 08:28:36 +02:00
Akim Demaille
b86dcaf40b doc: beware of timestamp issues on Haiku
On Haiku, help2man is fired on a freshly extracted tarball.
Reported by Bruno Haible.
https://lists.gnu.org/r/bug-bison/2020-05/msg00055.html

* doc/local.mk (bison.1): Be robust to a missing help2man.
2020-05-04 19:06:59 +02:00
Akim Demaille
1429569362 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-05-03 19:52:38 +02:00
Akim Demaille
506c368ab2 version 3.5.93
* NEWS: Record release date.
2020-05-03 19:32:15 +02:00
Akim Demaille
4f9dc3bdc1 news: update for 3.5.93 2020-05-03 19:32:03 +02:00
Akim Demaille
73ac8ff409 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-05-03 13:07:08 +02:00
Akim Demaille
0e0fb0efc9 version 3.5.92
* NEWS: Record release date.
2020-05-03 12:48:16 +02:00
Akim Demaille
bb1d776be0 news: update for 3.5.92 2020-05-03 12:47:21 +02:00
Akim Demaille
13a1537dba java: demonstrate push parsers
* data/skeletons/lalr1.java (Location): Make it a static class.
(Lexer.yylex, Lexer.getLVal, Lexer.getStartPos, Lexer.getEndPos):
These are not needed in push parsers.
* examples/java/calc/Calc.y: Demonstrate push parsers in the Java.
* doc/bison.texi: Push parsers have been supported for a long time,
remove incorrect statements stating the opposite.
2020-05-03 11:28:36 +02:00
Akim Demaille
0c0e778bd1 news: make it more consistent
* NEWS: Use the same pattern for titles.
2020-05-01 10:36:05 +02:00
Akim Demaille
a61bc3f9f8 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-04-29 09:07:50 +02:00
Akim Demaille
f0942df01a version 3.5.91
* NEWS: Record release date.
2020-04-29 08:47:35 +02:00
Akim Demaille
99efa35369 doc: document YYEOF, YYUNDEF and YYerror
* doc/bison.texi (Special Tokens): New.
* examples/c/bistromathic/parse.y: Formatting changes.
2020-04-29 08:23:55 +02:00
Akim Demaille
cd4e799da4 error: rename the error token from YYERRCODE to YYerror
See https://lists.gnu.org/r/bison-patches/2020-04/msg00162.html.

* data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.cc,
* data/skeletons/lalr1.java, doc/bison.texi,
* examples/c/bistromathic/parse.y, src/scan-gram.l, src/symtab.c
(YYERRCODE): Rename as...
(YYerror): this.
Adjust dependencies.
2020-04-28 07:54:07 +02:00
Akim Demaille
7346163840 dogfooding: use YYERRCODE in our scanner
* src/scan-gram.l: Use it.
* tests/input.at: Adjust.
2020-04-27 08:21:50 +02:00
Akim Demaille
b74fc07d21 style: c: fix a few minor issues about indentation of cpp directives
* README-hacking.md: More about cpp.
* data/skeletons/c.m4, data/skeletons/yacc.c: Style changes.
2020-04-25 12:16:57 +02:00
Akim Demaille
5c9f50b545 examples: bistromathic: shorten token description
* examples/c/bistromathic/parse.y: "number" is enough.
* doc/bison.texi: Likewise.
2020-04-24 19:03:12 +02:00
Akim Demaille
2831bd376f news: fix typo
Reported by Frank Heckenbach.
2020-04-19 08:20:57 +02:00
Akim Demaille
0a64b76430 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-04-18 10:59:05 +02:00
Akim Demaille
0b948b7696 version 3.5.90
* NEWS: Record release date.
2020-04-18 10:41:20 +02:00
Akim Demaille
d6ae95fb50 c++: give public access to the symbol kind
symbol_type::token () was removed: it returned the token kind of a
symbol.  To do that, one needs to convert from the symbol kind to the
token kind, which requires a table.

This broke some users' unit tests for scanners, see
https://lists.gnu.org/r/bug-bison/2020-01/msg00001.html
https://lists.gnu.org/r/bug-bison/2020-03/msg00020.html
https://lists.gnu.org/r/help-bison/2020-04/msg00005.html

Instead of making this possible again, let's check the symbol's kind
instead.  So give proper access to a symbol's kind.

That feature existed, undocumented, as 'type_get()'.  Let's rename
this as 'kind()'.

* data/skeletons/c++.m4, data/skeletons/glr.cc,
* data/skeletons/lalr1.cc (type_get): Rename as...
(kind): This.
(type_get): Install a backward compatibility alias.
* doc/bison.texi (Complete Symbols): Document symbol_type and
symbol_type::kind.
2020-04-18 08:03:59 +02:00
Akim Demaille
5d983253f7 doc: updates for 3.6
* doc/bison.texi: More s/token type/token kind/.
* NEWS: Update.
2020-04-16 08:44:36 +02:00
Akim Demaille
758172a8b9 doc: spell check
* doc/bison.texi, NEWS, README-hacking.md: here.
And elsewhere.
2020-04-13 18:50:05 +02:00
Akim Demaille
dc1035bada doc: promote YYEOF
* NEWS (Deep overhaul of the symbol and token kinds): New.
* doc/bison.texi: Promote YYEOF over "0" in scanners.
(Token Decl): No longer show YYEOF here, it now works by default.
(Token I18n): More details about YYEOF here.
(Calc++): Just use YYEOF.
2020-04-13 16:54:14 +02:00
Akim Demaille
5839f4d289 c: rename yyexpected_tokens as yypcontext_expected_tokens
The user should think of yypcontext fields as accessible only via
yypcontext_* functions.  So let's rename yyexpected_tokens to reflect
that.

Let's _not_ rename yyreport_syntax_error, as the user may define this
function, and is not allowed to access directly the fields of
yypcontext_t: she *must* use the "accessors".  This is comparable to
the case of C++/Java where the user defines
parser::report_syntax_error, not parser::context::report_syntax_error.

* data/skeletons/glr.c, data/skeletons/yacc.c (yyexpected_tokens):
Rename as...
(yypcontext_expected_tokens): this.
Adjust dependencies.
2020-04-12 19:23:40 +02:00
Akim Demaille
04d62346f3 doc: refer to the token kind rather than the token type
* doc/bison.texi: Replace occurrences of "token type" with "token
kind".
Stop referring to the "macro definitions" of the token kinds, just
name them "definitions".
2020-04-05 19:14:39 +02:00
Akim Demaille
2c05fc750a c, c++: rename yysymbol_type_t as yysymbol_kind_t
See https://lists.gnu.org/r/bison-patches/2020-04/msg00031.html

* data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/yacc.c
(yysymbol_type_t): Rename as...
(yysymbol_kind_t): this.
Adjust dependencies.
* data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/lalr1.cc
(symbol_type_type): Rename as...
(symbol_kind_type): this.
Adjust dependencies.
2020-04-05 14:56:18 +02:00
Akim Demaille
7aee4586ca Merge branch 'maint'
* maint:
  maint: post-release administrivia
  version 3.5.4
  examples: reccalc: really compile cleanly in C99
  news: announce that Bison 3.6 drops YYERROR_VERBOSE
  news: update for 3.5.4
  style: fix spellos
  typo: succesful -> successful
  package: improve the readme
  java: check and fix support for api.token.raw
  java: style: prefer 'int[] foo' to 'int foo[]'
  build: fix syntax-check issues
  tests: recheck: work properly when the test suite was interrupted
  doc: c++: promote api.token.raw
  build: fix compatibility with old compilers
  examples: reccalc: compile cleanly in C99
2020-04-05 09:38:15 +02:00
Akim Demaille
6c44f2dce3 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-04-05 09:27:36 +02:00
Akim Demaille
5604903f7a version 3.5.4
* NEWS: Record release date.
2020-04-05 09:08:30 +02:00
Akim Demaille
225a67321b news: update the yyreport_syntax_error example
* examples/c/bistromathic/parse.y, tests/local.at
(yyreport_syntax_error): Fix use of YYSYMBOL_YYEMPTY.
* NEWS: Update.
2020-04-05 08:56:23 +02:00
Akim Demaille
4e26809ab9 style: rename yysyntax_error_arguments as yy_syntax_error_arguments
It's a private implementation detail.

* NEWS, data/skeletons/glr.c, data/skeletons/lalr1.cc,
* data/skeletons/yacc.c, doc/bison.texi: here.
2020-04-05 08:56:21 +02:00