multistart: introduce and use rule_is_initial

* src/gram.h (rule_is_initial): New.
* src/graphviz.c, src/print-xml.c, src/print.c, src/lalr.c: Use it.
Some of these occurrences were incorrect (checking whether this is
rule 0), and not behaving properly in the case of multistart.
This commit is contained in:
Akim Demaille
2020-11-08 17:50:46 +01:00
parent 4b0cd01fb7
commit a38d0b9145
6 changed files with 20 additions and 26 deletions

View File

@@ -473,7 +473,7 @@ state_lookaheads_count (state *s, bool default_reduction_only_for_accept)
s->consistent =
!(reds->num > 1
|| (reds->num == 1 && trans->num && TRANSITION_IS_SHIFT (trans, 0))
|| (reds->num == 1 && reds->rules[0]->number != 0
|| (reds->num == 1 && !rule_is_initial (reds->rules[0])
&& default_reduction_only_for_accept));
return s->consistent ? 0 : reds->num;