mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33:03 +00:00
gram: factor the printing of items and the computation of their rule
There are several places where we need to recover the rule from an item, let's factor that into item_rule. We also want to print items in a nice way: we do it when generating the *output file, but it is also useful in debug messages. * src/gram.h, src/gram.c (item_rule, item_print): New. * src/print.c (print_core): Use them. * src/state.h, src/state.c: Propagate constness.
This commit is contained in:
@@ -192,12 +192,12 @@ closure (item_number const *core, size_t n)
|
||||
|
||||
/* core is sorted on item index in ritem, which is sorted on rule number.
|
||||
Compute itemset with the same sort. */
|
||||
nitemset = 0;
|
||||
size_t c = 0;
|
||||
|
||||
/* A bit index over RULESET. */
|
||||
rule_number ruleno;
|
||||
bitset_iterator iter;
|
||||
|
||||
nitemset = 0;
|
||||
size_t c = 0;
|
||||
BITSET_FOR_EACH (iter, ruleset, ruleno, 0)
|
||||
{
|
||||
item_number itemno = rules[ruleno].rhs - ritem;
|
||||
|
||||
Reference in New Issue
Block a user