cex: improve readability of the subsections

Now that the derivation is no longer printed on one line, aligning the
example and the derivation is no longer useful.  It can actually be
harmful, as it makes the overall structure less clear.

* src/derivation.h, src/derivation.c (derivation_print_leaves): Remove
the `prefix` argument.
* src/counterexample.c (print_counterexample): Put the example next to
its label.
* tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at,
* tests/report.at: Adjust.
This commit is contained in:
Akim Demaille
2020-07-20 07:03:39 +02:00
parent 815a76f558
commit b81229e1f9
7 changed files with 76 additions and 77 deletions

View File

@@ -116,9 +116,9 @@ static void
print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
{
const bool flat = getenv ("YYFLAT");
fprintf (out, " %s%-20s ",
fprintf (out, flat ? " %s%-20s " : " %s%s: ",
prefix, cex->unifying ? _("Example") : _("First example"));
derivation_print_leaves (cex->d1, out, prefix);
derivation_print_leaves (cex->d1, out);
fprintf (out, flat ? " %s%-20s " : " %s%s",
prefix, cex->shift_reduce ? _("Shift derivation") : _("First derivation"));
derivation_print (cex->d1, out, prefix);
@@ -128,9 +128,9 @@ print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
// to see the differences.
if (!cex->unifying || is_styled (stderr))
{
fprintf (out, " %s%-20s ",
fprintf (out, flat ? " %s%-20s " : " %s%s: ",
prefix, cex->unifying ? _("Example") : _("Second example"));
derivation_print_leaves (cex->d2, out, prefix);
derivation_print_leaves (cex->d2, out);
}
fprintf (out, flat ? " %s%-20s " : " %s%s",
prefix, cex->shift_reduce ? _("Reduce derivation") : _("Second derivation"));