127 |
{ |
{ |
128 |
int i; |
int i; |
129 |
|
|
130 |
shifts_t *shiftp = state->shifts; |
transitions_t *transitions = state->shifts; |
131 |
reductions_t *redp = state->reductions; |
reductions_t *redp = state->reductions; |
132 |
|
|
133 |
static char buff[10]; |
static char buff[10]; |
134 |
edge_t edge; |
edge_t edge; |
135 |
|
|
136 |
if (!shiftp->nshifts && !redp) |
if (!transitions->num && !redp) |
137 |
return; |
return; |
138 |
|
|
139 |
for (i = 0; i < shiftp->nshifts; i++) |
for (i = 0; i < transitions->num; i++) |
140 |
if (!SHIFT_IS_DISABLED (shiftp, i)) |
if (!TRANSITION_IS_DISABLED (transitions, i)) |
141 |
{ |
{ |
142 |
state_number_t state1 = shiftp->shifts[i]; |
state_number_t state1 = transitions->states[i]; |
143 |
symbol_number_t symbol = states[state1]->accessing_symbol; |
symbol_number_t symbol = states[state1]->accessing_symbol; |
144 |
|
|
145 |
new_edge (&edge); |
new_edge (&edge); |
152 |
sprintf (buff, "%d", state1); |
sprintf (buff, "%d", state1); |
153 |
edge.targetname = buff; |
edge.targetname = buff; |
154 |
/* Shifts are blue, gotos are green, and error is red. */ |
/* Shifts are blue, gotos are green, and error is red. */ |
155 |
if (SHIFT_IS_ERROR (shiftp, i)) |
if (TRANSITION_IS_ERROR (transitions, i)) |
156 |
edge.color = red; |
edge.color = red; |
157 |
else |
else |
158 |
edge.color = SHIFT_IS_SHIFT(shiftp, i) ? blue : green; |
edge.color = TRANSITION_IS_SHIFT(transitions, i) ? blue : green; |
159 |
edge.label = symbol_tag_get (symbols[symbol]); |
edge.label = symbol_tag_get (symbols[symbol]); |
160 |
output_edge (&edge, fgraph); |
output_edge (&edge, fgraph); |
161 |
close_edge (fgraph); |
close_edge (fgraph); |