mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +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:
@@ -218,7 +218,7 @@ state_reductions_set (state *s, int num, rule **reds)
|
||||
|
||||
|
||||
int
|
||||
state_reduction_find (state *s, rule *r)
|
||||
state_reduction_find (state *s, rule const *r)
|
||||
{
|
||||
reductions *reds = s->reductions;
|
||||
for (int i = 0; i < reds->num; ++i)
|
||||
@@ -247,7 +247,7 @@ state_errs_set (state *s, int num, symbol **tokens)
|
||||
`--------------------------------------------------*/
|
||||
|
||||
void
|
||||
state_rule_lookahead_tokens_print (state *s, rule *r, FILE *out)
|
||||
state_rule_lookahead_tokens_print (state *s, rule const *r, FILE *out)
|
||||
{
|
||||
/* Find the reduction we are handling. */
|
||||
reductions *reds = s->reductions;
|
||||
@@ -270,7 +270,7 @@ state_rule_lookahead_tokens_print (state *s, rule *r, FILE *out)
|
||||
}
|
||||
|
||||
void
|
||||
state_rule_lookahead_tokens_print_xml (state *s, rule *r,
|
||||
state_rule_lookahead_tokens_print_xml (state *s, rule const *r,
|
||||
FILE *out, int level)
|
||||
{
|
||||
/* Find the reduction we are handling. */
|
||||
|
||||
Reference in New Issue
Block a user