Commit Graph

476 Commits

Author SHA1 Message Date
Akim Demaille 007e1b5f0a symbols: minor fixes
* data/skeletons/bison.m4 (b4_symbol_kind): Series of _ are useless,
one is enough.
* data/skeletons/c.m4 (b4_token_enum): Fix overquoting.
2020-04-10 18:33:02 +02:00
Akim Demaille e657f04b62 c: make the symbol kind definition nicer to read
From

    enum yysymbol_kind_t
    {
      YYSYMBOL_YYEMPTY = -2,
      YYSYMBOL_YYEOF = 0,
      YYSYMBOL_YYERROR = 1,
      YYSYMBOL_YYUNDEF = 2,

to

    enum yysymbol_kind_t
    {
      YYSYMBOL_YYEMPTY = -2,
      YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
      YYSYMBOL_YYERROR = 1,                    /* error  */
      YYSYMBOL_YYUNDEF = 2,                    /* $undefined  */

* data/skeletons/bison.m4 (b4_last_symbol): New.
(b4_symbol_enum, b4_symbol_enums): Reformat the output.
* data/skeletons/c.m4
2020-04-06 18:43:34 +02:00
Akim Demaille e9fddab715 regen 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 76e11b5a3e c: rename yyparse_context_t as yypcontext_t
The first name is too long.  We already have `yypstate`, so
`yypcontext` is ok.  We are also migrating to using `*_t` for our
types.

* NEWS, data/skeletons/glr.c, data/skeletons/yacc.c, doc/bison.texi,
* examples/c/bistromathic/parse.y, src/parse-gram.y, tests/local.at:
(yyparse_context_t, yyparse_context_location, yyparse_context_token):
Rename as...
(yypcontext_t, yypcontext_location, yypcontext_token): these.
2020-04-04 19:20:29 +02:00
Akim Demaille beea39b2ec regen 2020-04-01 08:31:48 +02:00
Akim Demaille 65bbaf9598 regen 2020-04-01 08:31:48 +02:00
Akim Demaille d3db22d788 regen 2020-04-01 08:31:48 +02:00
Akim Demaille 0cdbcee0ce regen 2020-04-01 08:31:48 +02:00
Akim Demaille 04904e4d28 regen 2020-04-01 08:31:48 +02:00
Akim Demaille d7f39ac507 regen 2020-04-01 08:31:48 +02:00
Akim Demaille f62f1db298 regen 2020-04-01 08:31:48 +02:00
Akim Demaille 50517d578c regen 2020-03-28 15:13:27 +01:00
Akim Demaille 17a9542c4f regen 2020-03-28 15:13:27 +01:00
Akim Demaille 4192de1f41 bison: avoid using yysyntax_error_arguments
* src/parse-gram.y (yyreport_syntax_error): Use yyparse_context_token
and yyexpected_tokens.
2020-03-28 15:13:27 +01:00
Akim Demaille 466fb66578 regen 2020-03-17 19:21:24 +01:00
Akim Demaille 30d01b21e7 c++: minor fixes
Address compiler warnings such as

    warning: declaration of 'yyla' shadows a member of 'yy::parser::context' [-Wshadow]

* data/skeletons/lalr1.cc (context): Don't use the same names for
variables and members.
Use foo_ for private members, as in parser.
Also, use the + trick in array accesses to please ICC and provide it
with an int.
2020-02-27 21:31:09 +01:00
Akim Demaille 7a28659495 regen 2020-02-15 08:28:57 +01:00
Akim Demaille 6946149701 regen 2020-02-10 20:42:23 +01:00
Akim Demaille e6b0612f91 bison: pretend to 3.6 already
* src/parse-gram.y: here.
2020-01-26 13:29:18 +01:00
Akim Demaille 81849520cd regen 2020-01-23 08:30:51 +01:00
Akim Demaille 6fb362c87a regen 2020-01-23 08:26:33 +01:00
Akim Demaille f54a5b303b regen 2020-01-23 08:26:33 +01:00
Akim Demaille 1db962716a regen 2020-01-19 21:23:11 +01:00
Akim Demaille adac9a17f0 regen 2020-01-19 14:51:14 +01:00
Akim Demaille 5c332d70d7 regen 2020-01-19 14:51:14 +01:00
Akim Demaille 8e6233353f c: use yysymbol_name in traces
Only parse.error verbose and simple will get the original yytname: the
other options will rely on a different table.  So let's move on top of
the yysymbol_name function.

* data/skeletons/c.m4 (yy_symbol_print): Use yysymbol_name.
* data/skeletons/glr.c (yytokenName): Rename as...
(yysymbol_name): this.
The change of naming scheme is unfortunate, but it's definitely glr.c
which is "wrong".
2020-01-19 14:51:14 +01:00
Akim Demaille c6e2dcabae regen 2020-01-17 06:51:24 +01:00
Akim Demaille a1aef9825a regen 2020-01-17 06:49:45 +01:00
Akim Demaille a0675d707f Merge branch 'maint' into HEAD
* maint:
  gnulib: update
  lalr1.cc: avoid static_cast
  glr.c: add missing cast
  regen
  package: bump copyrights to 2020
  gitignore: update
2020-01-11 07:38:39 +01:00
Akim Demaille 04f3bfc596 regen 2020-01-10 19:21:35 +01:00
Akim Demaille c67daa9a97 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-10 19:16:23 +01:00
Akim Demaille e419eda5e2 regen 2020-01-10 18:38:02 +01:00
Akim Demaille 8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00
Akim Demaille d55f240991 parser: pretend we are Bison 3.5
* src/parse-gram.y: Accept we're Bison 3.5.
2019-12-08 16:03:36 +01:00
Akim Demaille 6dca1eb950 regen 2019-12-06 08:27:55 +01:00
Akim Demaille ad32ec64c8 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-20 07:10:27 +01:00
Akim Demaille 28d1ca8f48 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-17 09:45:25 +01:00
Akim Demaille 60ebd8e210 regen 2019-11-16 12:54:44 +01:00
Akim Demaille a5fc4e3b44 regen 2019-10-26 10:39:01 +02:00
Akim Demaille 76597d01f3 build: reenable -Wtype-limits
See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html
to https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00073.html.

Paul Eggert's changes in gnulib do fix the issue for modern GCCs (7,
8, 9) on macOS.  Unfortunately these warnings are back on the
CI (GNU/Linux) with GCC 4.6, 4.7, (not 4.8) and 4.9.

Disable the warning locally.

* configure.ac (warn_common, warn_tests): Remove -Wtype-limits.
* src/system.h (IGNORE_TYPE_LIMITS_BEGIN, IGNORE_TYPE_LIMITS_END): New.
* src/InadequacyList.c, src/parse-gram.c, src/parse-gram.y,
* src/symtab.c: Use it.
2019-10-24 08:50:14 +02:00
Akim Demaille 97d6da0c5b parser: clarify version checking
* src/parse-gram.y: Use the same conventions for gnulib as elsewhere:
<header.h>.
(str_to_version): New.
(handle_require): Use it.
Prefer < to >.
2019-10-20 17:57:28 +02:00
Paul Eggert 693e69f289 regen 2019-10-17 11:51:20 -07:00
Akim Demaille c3db1394a1 regen 2019-10-11 08:52:04 +02:00
Akim Demaille 58302c6079 regen 2019-10-06 17:48:51 +02:00
Paul Eggert 67dcef357c regen 2019-10-02 17:11:33 -07:00
Akim Demaille 569125a6bf regen 2019-09-14 10:09:08 +02:00
Akim Demaille a9499e6ea2 regen 2019-09-08 08:58:55 +02:00
Akim Demaille 44a56b20ac %fixed-output-files: detach from %yacc
The name fixed-output-files is pretty clear: generate y.tab.c, as Yacc
does.  So let's detach this from %yacc which does more: it requires
POSIX Yacc behavior.

This directive is obsolete since December 29th 2001
8c9a50bee1.  It does not show in the
doc.  I don't want to spend more time on improving its diagnostics, it
could be removed just as well as far as I'm concerned.

* src/scan-gram.l, src/parse-gram.y (%fixed-output-files): Detach from
%yacc.
2019-07-07 15:54:20 +02:00
Akim Demaille 5d3468e0d1 regen 2019-07-07 14:03:37 +02:00