multistart: adjust computation of initial core and adjust reports

Currently the core of the initial state is limited to the single rule
on $accept.

* src/lr0.c (generate_states): There may now be several rules on
$accept.

* src/graphviz.c (conclude_red): Recognize "final" transitions by the
fact that we reduce to "$accept".
* src/print.c (print_reduction): Likewise.
* src/print-xml.c (print_reduction): Likewise.
This commit is contained in:
Akim Demaille
2020-02-22 21:55:23 +01:00
parent 4646be7db4
commit 85ccc1bab3
5 changed files with 1173 additions and 17 deletions

View File

@@ -196,11 +196,12 @@ print_reduction (FILE *out, size_t width,
fputc (' ', out);
if (!enabled)
fputc ('[', out);
if (r->number)
const bool final = r->lhs->symbol == acceptsymbol;
if (final)
fprintf (out, _("accept"));
else
fprintf (out, _("reduce using rule %d (%s)"), r->number,
r->lhs->symbol->tag);
else
fprintf (out, _("accept"));
if (!enabled)
fputc (']', out);
fputc ('\n', out);