mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
@@ -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"));
|
||||
|
||||
@@ -428,10 +428,9 @@ derivation_print_flat (const derivation *deriv, FILE *out, const char *prefix)
|
||||
}
|
||||
|
||||
void
|
||||
derivation_print_leaves (const derivation *deriv, FILE *out, const char *prefix)
|
||||
derivation_print_leaves (const derivation *deriv, FILE *out)
|
||||
{
|
||||
int counter = 0;
|
||||
fputs (prefix, out);
|
||||
derivation_print_flat_impl ((derivation *)deriv, out, true, &counter, "");
|
||||
fputc ('\n', out);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ static inline derivation *derivation_new_leaf (symbol_number sym)
|
||||
// Number of symbols.
|
||||
size_t derivation_size (const derivation *deriv);
|
||||
void derivation_print (const derivation *deriv, FILE *out, const char *prefix);
|
||||
void derivation_print_leaves (const derivation *deriv, FILE *out, const char *prefix);
|
||||
void derivation_print_leaves (const derivation *deriv, FILE *out);
|
||||
void derivation_free (derivation *deriv);
|
||||
void derivation_retain (derivation *deriv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user