summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-11-13 10:59:55 +0100
committerAkim Demaille <akim@lrde.epita.fr>2012-11-13 10:59:55 +0100
commit06ec0105b12cdfa2994283e345154e6720354808 (patch)
tree845bbd1beeb65fc84d85f5cb3c78e506f73464b8 /src
parent2c08dc504c9f4ed12414a130bcebff8f0d3f43df (diff)
parent05c93b7d844e59ecaa5dec3bd6d9091f5aa5d1b0 (diff)
downloadbison-06ec0105b12cdfa2994283e345154e6720354808.tar.gz
Merge remote-tracking branch 'origin/maint'
* origin/maint: tests: close files in glr-regression xml: match DOT output and xml2dot.xsl processing xml: factor xslt space template graph: fix a memory leak xml: documentation output: capitalize State
Diffstat (limited to 'src')
-rw-r--r--src/graphviz.c35
-rw-r--r--src/print.c2
-rw-r--r--src/print_graph.c7
3 files changed, 24 insertions, 20 deletions
diff --git a/src/graphviz.c b/src/graphviz.c
index 3ae0b546..16ea8b9e 100644
--- a/src/graphviz.c
+++ b/src/graphviz.c
@@ -106,7 +106,7 @@ conclude_red (struct obstack *out, int source, rule_number ruleno,
return (void) obstack_finish0 (out);
else
{
- char const *ed = enabled ? "e" : "d";
+ 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",
@@ -116,24 +116,28 @@ conclude_red (struct obstack *out, int source, rule_number ruleno,
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))
- /* (The lookahead tokens have been added to the beginning of the
- obstack, in the caller function.) */
- fprintf (fout, "label = \"[%s]\" ", obstack_finish0 (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");
+ fprintf (fout, "style=solid]\n");
/* Build the associated diamond representation of the target rule. */
- fprintf (fout, " \"%dR%d%s\" [style = filled, "
- "shape = diamond, fillcolor = %s, ",
- source, ruleno, ed, color);
-
- if (ruleno)
- fprintf (fout, "label = \"R%d\"]\n", ruleno);
+ fprintf (fout, " \"%dR%d%s\" [label=\"",
+ source, ruleno, ed);
+ if (ruleno)
+ fprintf (fout, "R%d", ruleno);
else
- fprintf (fout, "label = \"Acc\"]\n");
+ fprintf (fout, "Acc");
+ fprintf (fout, "\", fillcolor=%s, shape=diamond, style=filled]\n",
+ color);
}
}
@@ -171,7 +175,7 @@ output_red (state const *s, reductions const *reds, FILE *fout)
bool defaulted = false;
bool firstd = true;
bool firste = true;
- rule_number ruleno = reds->rules[j]->user_number;
+ rule_number ruleno = reds->rules[j]->number;
rule *default_reduction = NULL;
if (yydefact[s->number] != 0)
@@ -199,11 +203,12 @@ output_red (state const *s, reductions const *reds, FILE *fout)
}
/* Do the actual output. */
- conclude_red (&eout, source, ruleno, true, firste && !defaulted, fout);
conclude_red (&dout, source, ruleno, false, firstd, fout);
+ conclude_red (&eout, source, ruleno, true, firste && !defaulted, fout);
}
- obstack_free (&eout, 0);
obstack_free (&dout, 0);
+ obstack_free (&eout, 0);
+ bitset_free (no_reduce_set);
}
void
diff --git a/src/print.c b/src/print.c
index f21aade5..2eecae4c 100644
--- a/src/print.c
+++ b/src/print.c
@@ -370,7 +370,7 @@ static void
print_state (FILE *out, state *s)
{
fputs ("\n\n", out);
- fprintf (out, _("state %d"), s->number);
+ fprintf (out, _("State %d"), s->number);
fputc ('\n', out);
print_core (out, s);
print_actions (out, s);
diff --git a/src/print_graph.c b/src/print_graph.c
index 918a3df8..31e0e382 100644
--- a/src/print_graph.c
+++ b/src/print_graph.c
@@ -77,7 +77,7 @@ print_core (struct obstack *oout, state *s)
}
obstack_printf (oout, _("State %d"), s->number);
- obstack_sgrow (oout, "\\n");
+ obstack_sgrow (oout, "\\n\\l");
for (i = 0; i < snritems; i++)
{
item_number *sp;
@@ -143,9 +143,6 @@ print_actions (state const *s, FILE *fgraph)
transitions const *trans = s->transitions;
int i;
- /* Display reductions. */
- output_red (s, s->reductions, fgraph);
-
if (!trans->num && !s->reductions)
return;
@@ -168,6 +165,8 @@ print_actions (state const *s, FILE *fgraph)
TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag,
style, fgraph);
}
+ /* Display reductions. */
+ output_red (s, s->reductions, fgraph);
}