graphs: style changes

* src/graphviz.c (start_graph): Use courier font.
(conclude_red): Use commas to separate attributes. Show the acceptation
as a special reduction, with a blue color and an "Acc" label. Show the
lookahead tokens between square brackets.
(output_red): No longer label default reductions.
* src/print_graph.c (print_core): Refactor spacing, and print an
additional space between a rule's rhs and its lookahead tokens. Also,
capitalize "State".
(print_actions): Style, move a declaration.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
Theophile Ranquet
2012-10-18 15:38:30 +00:00
committed by Akim Demaille
parent 85935600ad
commit 8048226f50
2 changed files with 48 additions and 34 deletions

View File

@@ -55,7 +55,8 @@ print_core (struct obstack *oout, state *s)
snritems = nitemset;
}
obstack_printf (oout, "state %d\\n", s->number);
obstack_printf (oout, _("State %d"), s->number);
obstack_sgrow (oout, "\\n");
for (i = 0; i < snritems; i++)
{
item_number *sp;
@@ -69,12 +70,12 @@ print_core (struct obstack *oout, state *s)
r = item_number_as_rule_number (*sp);
obstack_printf (oout, "%d: %s -> ", r, escape (rules[r].lhs->tag));
obstack_printf (oout, "%d: %s ->", r, escape (rules[r].lhs->tag));
for (sp = rules[r].rhs; sp < sp1; sp++)
obstack_printf (oout, "%s ", escape (symbols[*sp]->tag));
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
obstack_1grow (oout, '.');
obstack_sgrow (oout, " .");
for (/* Nothing */; *sp >= 0; ++sp)
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
@@ -93,7 +94,7 @@ print_core (struct obstack *oout, state *s)
bitset_iterator biter;
int k;
char const *sep = "";
obstack_1grow (oout, '[');
obstack_sgrow (oout, " [");
BITSET_FOR_EACH (biter, reds->lookahead_tokens[redno], k, 0)
{
obstack_sgrow (oout, sep);
@@ -116,9 +117,8 @@ print_core (struct obstack *oout, state *s)
static void
print_actions (state const *s, FILE *fgraph)
{
int i;
transitions const *trans = s->transitions;
int i;
/* Display reductions. */
output_red (s, s->reductions, fgraph);