summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2018-06-17 18:04:08 +0200
committerAkim Demaille <akim.demaille@gmail.com>2018-06-18 07:15:48 +0200
commit7f42eb0a5e90d0c9f2b16e6f6af907891833a413 (patch)
tree6ea629de9ad1f6924536799d5aea3f5d98ac823a /src/print.c
parentd03ad8b6861ca968da6a7a9b5332b7fbc1c99040 (diff)
downloadbison-7f42eb0a5e90d0c9f2b16e6f6af907891833a413.tar.gz
style: reduce scopes
* src/print.c (print_grammar): Shorten scopes.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/print.c b/src/print.c
index affaa426..c41db7aa 100644
--- a/src/print.c
+++ b/src/print.c
@@ -406,7 +406,6 @@ print_grammar (FILE *out)
{
symbol_number i;
char buffer[90];
- int column = 0;
grammar_rules_print (out);
@@ -416,11 +415,11 @@ print_grammar (FILE *out)
if (token_translations[i] != undeftoken->content->number)
{
const char *tag = symbols[token_translations[i]]->tag;
+ int column = strlen (tag);
rule_number r;
item_number *rhsp;
buffer[0] = 0;
- column = strlen (tag);
fputs (tag, out);
END_TEST (65);
sprintf (buffer, " (%d)", i);
@@ -441,9 +440,10 @@ print_grammar (FILE *out)
fprintf (out, "%s\n\n", _("Nonterminals, with rules where they appear"));
for (i = ntokens; i < nsyms; i++)
{
+ const char *tag = symbols[i]->tag;
+ int column = strlen (tag);
int left_count = 0, right_count = 0;
rule_number r;
- const char *tag = symbols[i]->tag;
for (r = 0; r < nrules; r++)
{
@@ -460,7 +460,6 @@ print_grammar (FILE *out)
buffer[0] = 0;
fputs (tag, out);
- column = strlen (tag);
sprintf (buffer, " (%d)", i);
END_TEST (0);
@@ -504,8 +503,6 @@ print_grammar (FILE *out)
void
print_results (void)
{
- state_number i;
-
/* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
that conflicts with Posix. */
FILE *out = xfopen (spec_verbose_file, "w");
@@ -524,8 +521,11 @@ print_results (void)
new_closure (nritems);
/* Storage for print_reductions. */
no_reduce_set = bitset_create (ntokens, BITSET_FIXED);
- for (i = 0; i < nstates; i++)
- print_state (out, states[i]);
+ {
+ state_number i;
+ for (i = 0; i < nstates; i++)
+ print_state (out, states[i]);
+ }
bitset_free (no_reduce_set);
if (report_flag & report_itemsets)
free_closure ();