graph: minor simplification

* src/gram.c (print_lhs): Use %*s to indent.
* src/print_graph.c (print_lhs): Use obstack_printf.
Became simple enough to be inlined in...
(print_core): here.
Use a "rule*" instead of an index in "rules[]".
This commit is contained in:
Akim Demaille
2012-12-28 10:04:49 +01:00
parent 510c8497f8
commit fd7f0289bc
2 changed files with 19 additions and 42 deletions

View File

@@ -69,16 +69,9 @@ rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out)
{
fprintf (out, " %3d ", r->number);
if (previous_lhs != r->lhs)
{
fprintf (out, "%s:", r->lhs->tag);
}
fprintf (out, "%s:", r->lhs->tag);
else
{
int n;
for (n = strlen (previous_lhs->tag); n > 0; --n)
fputc (' ', out);
fputc ('|', out);
}
fprintf (out, "%*s|", (int) strlen (previous_lhs->tag), "");
}
void