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

@@ -216,8 +216,7 @@ static void
print_reduction (FILE *out, int level, char const *lookahead,
rule *r, bool enabled)
{
const bool final = r->lhs->symbol == acceptsymbol;
if (final)
if (rule_is_initial (r))
xml_printf (out, level,
"<reduction symbol=\"%s\" rule=\"accept\" enabled=\"%s\"/>",
xml_escape (lookahead),