graphs: show reductions

* src/graphviz.c (output_red): New, show reductions on the graph.
(no_reduce_bitset_init): New, initialize a bitset.
(print_token): New, print a lookahead token.
(escape): New, print "foo" as \"foo\" because Dot doesn't like quotes within
a label.

* src/graphviz.h : Adjust.
* src/print_graph.c (print_actions): Call output_red here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
Theophile Ranquet
2012-10-08 06:11:41 +00:00
committed by Akim Demaille
parent 9fc99ca350
commit 83bae26d3f
3 changed files with 94 additions and 1 deletions

View File

@@ -22,6 +22,8 @@
#ifndef GRAPHVIZ_H_
# define GRAPHVIZ_H_
#include "state.h"
/// Begin a Dot graph.
/// \param fout output stream.
void start_graph (FILE *fout);
@@ -40,7 +42,13 @@ void output_node (int id, char const *label, FILE *fout);
/// \param style Dot style of the edge (e.g., "dotted" or "solid").
/// \param fout output stream.
void output_edge (int source, int destination, char const *label,
char const *style, FILE *fout);
char const *style, FILE *fout);
/// Output a reduction.
/// \param s current state
/// \param reds the set of reductions
/// \param fout output stream.
void output_red (state const *s, reductions const *reds, FILE *fout);
/// End a Dot graph.
/// \param fout output stream.