+static void
+conclude_red (struct obstack *out, int source, rule_number ruleno,
+ bool enabled, bool first, FILE *fout)
+{
+ /* If no lookahead tokens were valid transitions, this reduction is
+ actually hidden, so cancel everything. */
+ if (first)
+ (void) obstack_finish0 (out);
+ else
+ {
+ char const *ed = enabled ? "" : "d";
+ char const *color = enabled ? ruleno ? "3" : "1" : "5";
+
+ /* First, build the edge's head. The name of reduction nodes is "nRm",
+ with n the source state and m the rule number. This is because we
+ don't want all the reductions bearing a same rule number to point to
+ the same state, since that is not the desired format. */
+ fprintf (fout, " %1$d -> \"%1$dR%2$d%3$s\" [",
+ source, ruleno, ed);
+
+ /* (The lookahead tokens have been added to the beginning of the
+ obstack, in the caller function.) */
+ if (! obstack_empty_p (out))
+ {
+ char *label = obstack_finish0 (out);
+ fprintf (fout, "label=\"[%s]\", ", label);
+ obstack_free (out, label);
+ }
+
+ /* Then, the edge's tail. */
+ fprintf (fout, "style=solid]\n");
+
+ /* Build the associated diamond representation of the target rule. */
+ fprintf (fout, " \"%dR%d%s\" [label=\"",
+ source, ruleno, ed);
+ if (ruleno)
+ fprintf (fout, "R%d", ruleno);
+ else
+ fprintf (fout, "Acc");
+
+ fprintf (fout, "\", fillcolor=%s, shape=diamond, style=filled]\n",
+ color);
+ }
+}
+