diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2019-02-02 07:18:00 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2019-02-03 10:05:53 +0100 |
commit | cacdfc2f6ed5bbc700b9404f7012aa02fa8dc931 (patch) | |
tree | 07388496653c2db95131a9d8340ed201b81fdd32 /THANKS | |
parent | 31788ed4c7714b133bddf7ce719c28b0384c6679 (diff) | |
download | bison-cacdfc2f6ed5bbc700b9404f7012aa02fa8dc931.tar.gz |
gram: fix handling of nterms in actions when some are unused
Since Bison 3.3, semantic values in rule actions (i.e., '$...') are
passed to the m4 backend as the symbol number. Unfortunately, when
there are unused symbols, the symbols are renumbered _after_ the
numbers were used in the rule actions. As a result, the evaluation of
the skeleton failed because it used non existing symbol numbers.
Which is the happy scenario: we could use numbers of other existing
symbols...
Reported by Balázs Scheidler.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00044.html
Translating the rule actions after the symbol renumbering moves too
many parts in bison. Relying on the symbol identifiers is more
troublesome than it might first seem: some don't have an
identifier (tokens with only a literal string), some might have a
complex one (tokens with a literal string with characters special for
M4). Well, these are tokens, but nterms also have issues: "dummy"
nterms (for midrule actions) are named $@32 etc. which is risky for
M4.
Instead, let's simply give M4 the mapping between the old numbers and
the new ones. To avoid confusion between old and new numbers, always
emit pre-renumbering numbers as "orig NUM".
* data/README: Give details about "orig NUM".
* data/skeletons/bison.m4 (__b4_symbol, _b4_symbol): Resolve the
"orig NUM".
* src/output.c (prepare_symbol_definitions): Pass nterm_map to m4.
* src/reduce.h, src/reduce.c (nterm_map): Extract it from
nonterminals_reduce, to make it public.
(reduce_free): Free it.
* src/scan-code.l (handle_action_dollar): When referring to a nterm,
use "orig NUM".
* tests/reduce.at (Useless Parts): New, based Balázs Scheidler's
report.
Diffstat (limited to 'THANKS')
-rw-r--r-- | THANKS | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -18,6 +18,7 @@ Antonio Silva Correia amsilvacorreia@hotmail.com Arnold Robbins arnold@skeeve.com Art Haas ahaas@neosoft.com Askar Safin safinaskar@mail.ru +Balázs Scheidler balazs.scheidler@oneidentity.com Baron Schwartz baron@sequent.org Ben Pfaff blp@cs.stanford.edu Benoit Perrot benoit.perrot@epita.fr |