* src/print.c (print_actions): Better locality of variables.

This commit is contained in:
Akim Demaille
2001-11-19 10:39:35 +00:00
parent 720e5c1bc3
commit d9ec2d0749
2 changed files with 20 additions and 22 deletions

View File

@@ -1,3 +1,8 @@
2001-11-19 Akim Demaille <akim@epita.fr>
* src/print.c (print_actions): Better locality of variables.
2001-11-19 Akim Demaille <akim@epita.fr> 2001-11-19 Akim Demaille <akim@epita.fr>
* src/derives.c (print_derives): Fix and enrich. * src/derives.c (print_derives): Fix and enrich.

View File

@@ -87,16 +87,10 @@ print_actions (FILE *out, int state)
{ {
int i; int i;
int k; int k;
int state1;
int symbol;
shifts *shiftp;
errs *errp;
reductions *redp;
int rule;
shiftp = state_table[state].shift_table; shifts *shiftp = state_table[state].shift_table;
redp = state_table[state].reduction_table; reductions *redp = state_table[state].reduction_table;
errp = err_table[state]; errs *errp = err_table[state];
if (!shiftp && !redp) if (!shiftp && !redp)
{ {
@@ -113,9 +107,10 @@ print_actions (FILE *out, int state)
for (i = 0; i < k; i++) for (i = 0; i < k; i++)
{ {
if (!shiftp->shifts[i]) int symbol;
int state1 = shiftp->shifts[i];
if (!state1)
continue; continue;
state1 = shiftp->shifts[i];
symbol = state_table[state1].accessing_symbol; symbol = state_table[state1].accessing_symbol;
/* The following line used to be turned off. */ /* The following line used to be turned off. */
if (ISVAR (symbol)) if (ISVAR (symbol))
@@ -140,15 +135,12 @@ print_actions (FILE *out, int state)
if (errp) if (errp)
{ {
int j, nerrs; int j;
for (j = 0; j < errp->nerrs; j++)
nerrs = errp->nerrs;
for (j = 0; j < nerrs; j++)
{ {
if (!errp->errs[j]) int symbol = errp->errs[j];
if (!symbol)
continue; continue;
symbol = errp->errs[j];
fprintf (out, _(" %-4s\terror (nonassociative)\n"), fprintf (out, _(" %-4s\terror (nonassociative)\n"),
tags[symbol]); tags[symbol]);
} }
@@ -159,8 +151,8 @@ print_actions (FILE *out, int state)
if (state_table[state].consistent && redp) if (state_table[state].consistent && redp)
{ {
rule = redp->rules[0]; int rule = redp->rules[0];
symbol = rule_table[rule].lhs; int symbol = rule_table[rule].lhs;
fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"), fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"),
rule, tags[symbol]); rule, tags[symbol]);
} }
@@ -173,9 +165,10 @@ print_actions (FILE *out, int state)
{ {
for (; i < k; i++) for (; i < k; i++)
{ {
if (!shiftp->shifts[i]) int symbol;
int state1 = shiftp->shifts[i];
if (!state1)
continue; continue;
state1 = shiftp->shifts[i];
symbol = state_table[state1].accessing_symbol; symbol = state_table[state1].accessing_symbol;
fprintf (out, _(" %-4s\tgo to state %d\n"), fprintf (out, _(" %-4s\tgo to state %d\n"),
tags[symbol], state1); tags[symbol], state1);