mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 07:43:03 +00:00
* src/output.c (action_row): De-obfuscate
using the good o' techniques: arrays not pointers, variable locality, BITISSET, RESETBIT etc.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2001-12-05 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/output.c (action_row): De-obfuscate
|
||||||
|
using the good o' techniques: arrays not pointers, variable
|
||||||
|
locality, BITISSET, RESETBIT etc.
|
||||||
|
|
||||||
|
|
||||||
2001-12-05 Akim Demaille <akim@epita.fr>
|
2001-12-05 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
Pessimize the code to simplify it: from now on, all the states
|
Pessimize the code to simplify it: from now on, all the states
|
||||||
|
|||||||
38
src/output.c
38
src/output.c
@@ -529,15 +529,11 @@ action_row (int state)
|
|||||||
int k;
|
int k;
|
||||||
int m = 0;
|
int m = 0;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int count;
|
|
||||||
int default_rule;
|
int default_rule;
|
||||||
int nreds;
|
int nreds;
|
||||||
int max;
|
|
||||||
int rule;
|
int rule;
|
||||||
int shift_state;
|
int shift_state;
|
||||||
int symbol;
|
int symbol;
|
||||||
unsigned mask;
|
|
||||||
unsigned *wordp;
|
|
||||||
reductions *redp;
|
reductions *redp;
|
||||||
shifts *shiftp;
|
shifts *shiftp;
|
||||||
errs *errp;
|
errs *errp;
|
||||||
@@ -562,28 +558,13 @@ action_row (int state)
|
|||||||
n = state_table[state + 1].lookaheads;
|
n = state_table[state + 1].lookaheads;
|
||||||
|
|
||||||
for (i = n - 1; i >= m; i--)
|
for (i = n - 1; i >= m; i--)
|
||||||
{
|
/* and find each token which the rule finds acceptable
|
||||||
rule = -LAruleno[i];
|
to come next */
|
||||||
wordp = LA (i);
|
for (j = 0; j < ntokens; j++)
|
||||||
mask = 1;
|
/* and record this rule as the rule to use if that
|
||||||
|
token follows. */
|
||||||
/* and find each token which the rule finds acceptable
|
if (BITISSET (LA (i), j))
|
||||||
to come next */
|
actrow[j] = -LAruleno[i];
|
||||||
for (j = 0; j < ntokens; j++)
|
|
||||||
{
|
|
||||||
/* and record this rule as the rule to use if that
|
|
||||||
token follows. */
|
|
||||||
if (mask & *wordp)
|
|
||||||
actrow[j] = rule;
|
|
||||||
|
|
||||||
mask <<= 1;
|
|
||||||
if (mask == 0)
|
|
||||||
{
|
|
||||||
mask = 1;
|
|
||||||
wordp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,7 +572,6 @@ action_row (int state)
|
|||||||
them, record the shift as the thing to do. So shift is preferred
|
them, record the shift as the thing to do. So shift is preferred
|
||||||
to reduce. */
|
to reduce. */
|
||||||
shiftp = state_table[state].shift_table;
|
shiftp = state_table[state].shift_table;
|
||||||
|
|
||||||
for (i = 0; i < shiftp->nshifts; i++)
|
for (i = 0; i < shiftp->nshifts; i++)
|
||||||
{
|
{
|
||||||
shift_state = shiftp->shifts[i];
|
shift_state = shiftp->shifts[i];
|
||||||
@@ -635,10 +615,10 @@ action_row (int state)
|
|||||||
default_rule = redp->rules[0];
|
default_rule = redp->rules[0];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
max = 0;
|
int max = 0;
|
||||||
for (i = m; i < n; i++)
|
for (i = m; i < n; i++)
|
||||||
{
|
{
|
||||||
count = 0;
|
int count = 0;
|
||||||
rule = -LAruleno[i];
|
rule = -LAruleno[i];
|
||||||
|
|
||||||
for (j = 0; j < ntokens; j++)
|
for (j = 0; j < ntokens; j++)
|
||||||
|
|||||||
Reference in New Issue
Block a user