mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
* src/output.c (action_row, token_actions): Use a state_t instead
of a integer, and nlookaheads instead of the following state's lookaheadsp.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2001-12-27 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/output.c (action_row, token_actions): Use a state_t instead
|
||||||
|
of a integer, and nlookaheads instead of the following state's
|
||||||
|
lookaheadsp.
|
||||||
|
|
||||||
|
|
||||||
2001-12-27 Akim Demaille <akim@epita.fr>
|
2001-12-27 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/conflicts.c (log_resolution, flush_shift)
|
* src/conflicts.c (log_resolution, flush_shift)
|
||||||
|
|||||||
27
src/output.c
27
src/output.c
@@ -323,16 +323,14 @@ output_rule_data (void)
|
|||||||
`------------------------------------------------------------------*/
|
`------------------------------------------------------------------*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
action_row (int state)
|
action_row (state_t *state)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int m = 0;
|
|
||||||
int n = 0;
|
|
||||||
int default_rule = 0;
|
int default_rule = 0;
|
||||||
reductions *redp = state_table[state]->reductions;
|
reductions *redp = state->reductions;
|
||||||
int nreds = redp ? redp->nreds : 0;
|
int nreds = redp ? redp->nreds : 0;
|
||||||
shifts *shiftp = state_table[state]->shifts;
|
shifts *shiftp = state->shifts;
|
||||||
errs *errp = state_table[state]->errs;
|
errs *errp = state->errs;
|
||||||
/* set nonzero to inhibit having any default reduction */
|
/* set nonzero to inhibit having any default reduction */
|
||||||
int nodefault = 0;
|
int nodefault = 0;
|
||||||
|
|
||||||
@@ -344,17 +342,14 @@ action_row (int state)
|
|||||||
int j;
|
int j;
|
||||||
/* loop over all the rules available here which require
|
/* loop over all the rules available here which require
|
||||||
lookahead */
|
lookahead */
|
||||||
m = state_table[state]->lookaheadsp;
|
for (i = state->nlookaheads - 1; i >= 0; --i)
|
||||||
n = state_table[state + 1]->lookaheadsp;
|
|
||||||
|
|
||||||
for (i = n - 1; i >= m; i--)
|
|
||||||
/* and find each token which the rule finds acceptable
|
/* and find each token which the rule finds acceptable
|
||||||
to come next */
|
to come next */
|
||||||
for (j = 0; j < ntokens; j++)
|
for (j = 0; j < ntokens; j++)
|
||||||
/* and record this rule as the rule to use if that
|
/* and record this rule as the rule to use if that
|
||||||
token follows. */
|
token follows. */
|
||||||
if (BITISSET (LA (i), j))
|
if (BITISSET (LA (state->lookaheadsp + i), j))
|
||||||
actrow[j] = -LAruleno[i];
|
actrow[j] = -LAruleno[state->lookaheadsp + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now see which tokens are allowed for shifts in this state. For
|
/* Now see which tokens are allowed for shifts in this state. For
|
||||||
@@ -394,15 +389,15 @@ action_row (int state)
|
|||||||
|
|
||||||
if (nreds >= 1 && !nodefault)
|
if (nreds >= 1 && !nodefault)
|
||||||
{
|
{
|
||||||
if (state_table[state]->consistent)
|
if (state->consistent)
|
||||||
default_rule = redp->rules[0];
|
default_rule = redp->rules[0];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int max = 0;
|
int max = 0;
|
||||||
for (i = m; i < n; i++)
|
for (i = 0; i < state->nlookaheads; i++)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int rule = -LAruleno[i];
|
int rule = -LAruleno[state->lookaheadsp + i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < ntokens; j++)
|
for (j = 0; j < ntokens; j++)
|
||||||
@@ -492,7 +487,7 @@ token_actions (void)
|
|||||||
actrow = XCALLOC (short, ntokens);
|
actrow = XCALLOC (short, ntokens);
|
||||||
for (i = 0; i < nstates; ++i)
|
for (i = 0; i < nstates; ++i)
|
||||||
{
|
{
|
||||||
yydefact[i] = action_row (i);
|
yydefact[i] = action_row (state_table[i]);
|
||||||
save_row (i);
|
save_row (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user