mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
graphs: minor style changes
* src/graphviz.c (output_red): Fix C90 issues. Reduce variable scopes. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
committed by
Akim Demaille
parent
83bae26d3f
commit
d79683fa95
@@ -107,20 +107,21 @@ print_token (struct obstack *out, bool first, char const *tok)
|
|||||||
void
|
void
|
||||||
output_red (state const *s, reductions const *reds, FILE *fout)
|
output_red (state const *s, reductions const *reds, FILE *fout)
|
||||||
{
|
{
|
||||||
int source = s->number;
|
|
||||||
int i, j;
|
|
||||||
bitset no_reduce_set;
|
bitset no_reduce_set;
|
||||||
no_reduce_bitset_init (s, &no_reduce_set);
|
int j;
|
||||||
|
int source = s->number;
|
||||||
struct obstack oout;
|
struct obstack oout;
|
||||||
|
|
||||||
|
no_reduce_bitset_init (s, &no_reduce_set);
|
||||||
obstack_init (&oout);
|
obstack_init (&oout);
|
||||||
|
|
||||||
for (j = 0; j < reds->num; ++j)
|
for (j = 0; j < reds->num; ++j)
|
||||||
{
|
{
|
||||||
bool first = true;
|
|
||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
|
bool first = true;
|
||||||
int ruleno = reds->rules[j]->user_number;
|
int ruleno = reds->rules[j]->user_number;
|
||||||
rule *default_reduction = NULL;
|
rule *default_reduction = NULL;
|
||||||
|
|
||||||
if (yydefact[s->number] != 0)
|
if (yydefact[s->number] != 0)
|
||||||
default_reduction = &rules[yydefact[s->number] - 1];
|
default_reduction = &rules[yydefact[s->number] - 1];
|
||||||
|
|
||||||
@@ -131,13 +132,16 @@ output_red (state const *s, reductions const *reds, FILE *fout)
|
|||||||
if (default_reduction && default_reduction == reds->rules[j])
|
if (default_reduction && default_reduction == reds->rules[j])
|
||||||
first = print_token (&oout, true, "$default");
|
first = print_token (&oout, true, "$default");
|
||||||
else
|
else
|
||||||
for (i = 0; i < ntokens; i++)
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < ntokens; i++)
|
||||||
if (bitset_test (reds->lookahead_tokens[j], i))
|
if (bitset_test (reds->lookahead_tokens[j], i))
|
||||||
{
|
{
|
||||||
first = print_token (&oout, first, symbols[i]->tag);
|
first = print_token (&oout, first, symbols[i]->tag);
|
||||||
if (bitset_test (no_reduce_set, i))
|
if (bitset_test (no_reduce_set, i))
|
||||||
disabled = true;
|
disabled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
obstack_sgrow (&oout, "\" style=solid]\n");
|
obstack_sgrow (&oout, "\" style=solid]\n");
|
||||||
|
|
||||||
/* Then, print the reduction's representation. This most be done later
|
/* Then, print the reduction's representation. This most be done later
|
||||||
|
|||||||
Reference in New Issue
Block a user