mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +00:00
reports: don't escape the labels
Currently we use "quotearg" to escape the strings output in Dot. As a
result, if the user's locale is C for instance, all the non-ASCII are
escaped. Unfortunately graphviz does not interpret this style of
escaping.
For instance:
5 -> 2 [style=solid label="\"\303\221\303\271\341\271\203\303\251\342\204\235\303\264\""]
was displayed as a sequence of numbers. We now output:
5 -> 2 [style=solid label="\"Ñùṃéℝô\""]
independently of the user's locale.
* src/system.h (obstack_backslash): New.
* src/graphviz.h, src/graphviz.c (escape): Remove, use
obstack_backslash instead.
* src/print-graph.c: Likewise.
* tests/report.at: Adjust.
This commit is contained in:
@@ -72,19 +72,28 @@ print_core (struct obstack *oout, state *s)
|
||||
obstack_printf (oout, "%*s| ",
|
||||
(int) strlen (previous_lhs->symbol->tag), "");
|
||||
else
|
||||
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
|
||||
{
|
||||
obstack_backslash (oout, r->lhs->symbol->tag);
|
||||
obstack_printf (oout, ": ");
|
||||
}
|
||||
previous_lhs = r->lhs;
|
||||
|
||||
for (item_number const *sp = r->rhs; sp < sp1; sp++)
|
||||
obstack_printf (oout, "%s ", escape (symbols[*sp]->tag));
|
||||
{
|
||||
obstack_backslash (oout, symbols[*sp]->tag);
|
||||
obstack_1grow (oout, ' ');
|
||||
}
|
||||
|
||||
obstack_1grow (oout, '.');
|
||||
|
||||
if (0 <= *r->rhs)
|
||||
for (item_number const *sp = sp1; 0 <= *sp; ++sp)
|
||||
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||
{
|
||||
obstack_1grow (oout, ' ');
|
||||
obstack_backslash (oout, symbols[*sp]->tag);
|
||||
}
|
||||
else
|
||||
obstack_printf (oout, " %%empty");
|
||||
obstack_sgrow (oout, " %empty");
|
||||
|
||||
/* Experimental feature: display the lookahead tokens. */
|
||||
if (report_flag & report_lookahead_tokens
|
||||
@@ -104,7 +113,7 @@ print_core (struct obstack *oout, state *s)
|
||||
BITSET_FOR_EACH (biter, reds->lookahead_tokens[redno], k, 0)
|
||||
{
|
||||
obstack_sgrow (oout, sep);
|
||||
obstack_sgrow (oout, escape (symbols[k]->tag));
|
||||
obstack_backslash (oout, symbols[k]->tag);
|
||||
sep = ", ";
|
||||
}
|
||||
obstack_1grow (oout, ']');
|
||||
|
||||
Reference in New Issue
Block a user