diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2021-01-16 15:05:30 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2021-01-23 10:43:04 +0100 |
commit | 83bc8895367bf27f8ae78fea9ade8a8d94786698 (patch) | |
tree | dfa1d535514d759b24e609adc2f9d3e22a720c83 /src | |
parent | 2f554e62604ff9e5944f5d56842132c74697b70c (diff) | |
download | bison-83bc8895367bf27f8ae78fea9ade8a8d94786698.tar.gz |
cex: fix traces: fix display of disabled items
The display of disabled state items is incorrect. The item is
stuttered, and lacks on end-of-line.
From
State 7:
1 exp: exp • "⊕" exp
-> 1 exp: exp "⊕" • exp
<- 1 exp: • exp "⊕" exp
2 exp: exp • "+" exp 2 exp: exp • "+" exp DISABLED
2 exp: exp "+" exp •
<- 2 exp: exp "+" • exp
3 exp: exp • "+" exp 3 exp: exp • "+" exp DISABLED
3 exp: exp "+" exp •
<- 3 exp: exp "+" • exp
to
State 7:
1 exp: exp • "⊕" exp
-> 1 exp: exp "⊕" • exp
<- 1 exp: • exp "⊕" exp
2 exp: exp • "+" exp DISABLED
2 exp: exp "+" exp •
<- 2 exp: exp "+" • exp
3 exp: exp • "+" exp DISABLED
3 exp: exp "+" exp •
<- 3 exp: exp "+" • exp
* src/state-item.c (state_items_report): Don't issue disabled items
twice, and issue two '\n' at their end.
* tests/conflicts.at: Check it.
Diffstat (limited to 'src')
-rw-r--r-- | src/state-item.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/state-item.c b/src/state-item.c index 5ca9795a..05cb8075 100644 --- a/src/state-item.c +++ b/src/state-item.c @@ -494,34 +494,33 @@ state_items_report (FILE *out) fprintf (out, "State %d:\n", i); for (state_item_number j = state_item_map[i]; j < state_item_map[i + 1]; ++j) { - state_item *si = &state_items[j]; + const state_item *si = &state_items[j]; item_print (si->item, NULL, out); if (SI_DISABLED (j)) + fputs (" DISABLED\n", out); + else { - item_print (si->item, NULL, out); - fputs (" DISABLED\n", out); - continue; - } - putc ('\n', out); - if (si->trans >= 0) - { - fputs (" -> ", out); - state_item_print (&state_items[si->trans], out, ""); - } + putc ('\n', out); + if (si->trans >= 0) + { + fputs (" -> ", out); + state_item_print (&state_items[si->trans], out, ""); + } - bitset sets[2] = { si->prods, si->revs }; - const char *txt[2] = { " => ", " <- " }; - for (int seti = 0; seti < 2; ++seti) - { - bitset b = sets[seti]; - if (b) + bitset sets[2] = { si->prods, si->revs }; + const char *txt[2] = { " => ", " <- " }; + for (int seti = 0; seti < 2; ++seti) { - bitset_iterator biter; - state_item_number sin; - BITSET_FOR_EACH (biter, b, sin, 0) + bitset b = sets[seti]; + if (b) { - fputs (txt[seti], out); - state_item_print (&state_items[sin], out, ""); + bitset_iterator biter; + state_item_number sin; + BITSET_FOR_EACH (biter, b, sin, 0) + { + fputs (txt[seti], out); + state_item_print (&state_items[sin], out, ""); + } } } } |