mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
* src/lalr.c (F): Now a bitset*.
Adjust all dependencies.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2002-03-04 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/lalr.c (F): Now a bitset*.
|
||||||
|
Adjust all dependencies.
|
||||||
|
|
||||||
|
|
||||||
2002-03-04 Akim Demaille <akim@epita.fr>
|
2002-03-04 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/conflicts.c (shiftset, lookaheadset): Now bitset.
|
* src/conflicts.c (shiftset, lookaheadset): Now bitset.
|
||||||
|
|||||||
29
src/lalr.c
29
src/lalr.c
@@ -51,8 +51,7 @@ short *to_state = NULL;
|
|||||||
|
|
||||||
/* And for the famous F variable, which name is so descriptive that a
|
/* And for the famous F variable, which name is so descriptive that a
|
||||||
comment is hardly needed. <grin>. */
|
comment is hardly needed. <grin>. */
|
||||||
static unsigned *F = NULL;
|
static bitset *F = NULL;
|
||||||
#define F(Rule) (F + (Rule) * tokensetsize)
|
|
||||||
|
|
||||||
static short **includes;
|
static short **includes;
|
||||||
static shorts **lookback;
|
static shorts **lookback;
|
||||||
@@ -75,9 +74,7 @@ static void
|
|||||||
traverse (int i)
|
traverse (int i)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
size_t k;
|
|
||||||
int height;
|
int height;
|
||||||
size_t size = F (i + 1) - F(i);
|
|
||||||
|
|
||||||
VERTICES[++top] = i;
|
VERTICES[++top] = i;
|
||||||
INDEX[i] = height = top;
|
INDEX[i] = height = top;
|
||||||
@@ -91,8 +88,7 @@ traverse (int i)
|
|||||||
if (INDEX[i] > INDEX[R[i][j]])
|
if (INDEX[i] > INDEX[R[i][j]])
|
||||||
INDEX[i] = INDEX[R[i][j]];
|
INDEX[i] = INDEX[R[i][j]];
|
||||||
|
|
||||||
for (k = 0; k < size; ++k)
|
bitset_or (F[i], F[i], F[R[i][j]]);
|
||||||
F (i)[k] |= F (R[i][j])[k];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (INDEX[i] == height)
|
if (INDEX[i] == height)
|
||||||
@@ -104,8 +100,7 @@ traverse (int i)
|
|||||||
if (i == j)
|
if (i == j)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (k = 0; k < size; ++k)
|
bitset_copy (F[j], F[i]);
|
||||||
F (j)[k] = F (i)[k];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +257,12 @@ initialize_F (void)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
F = XCALLOC (unsigned, ngotos * tokensetsize);
|
F = XCALLOC (bitset, ngotos);
|
||||||
|
for (i = 0; i < ngotos; ++i)
|
||||||
|
{
|
||||||
|
F[i] = bitset_create (ntokens, BITSET_FIXED);
|
||||||
|
bitset_zero (F[i]);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ngotos; i++)
|
for (i = 0; i < ngotos; i++)
|
||||||
{
|
{
|
||||||
@@ -271,7 +271,7 @@ initialize_F (void)
|
|||||||
|
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < sp->nshifts && SHIFT_IS_SHIFT (sp, j); j++)
|
for (j = 0; j < sp->nshifts && SHIFT_IS_SHIFT (sp, j); j++)
|
||||||
SETBIT (F (i), SHIFT_SYMBOL (sp, j));
|
bitset_set (F[i], SHIFT_SYMBOL (sp, j));
|
||||||
|
|
||||||
for (; j < sp->nshifts; j++)
|
for (; j < sp->nshifts; j++)
|
||||||
{
|
{
|
||||||
@@ -500,18 +500,15 @@ compute_lookaheads (void)
|
|||||||
|
|
||||||
for (i = 0; i < nLA; i++)
|
for (i = 0; i < nLA; i++)
|
||||||
for (sp = lookback[i]; sp; sp = sp->next)
|
for (sp = lookback[i]; sp; sp = sp->next)
|
||||||
{
|
bitset_or (LA[i], LA[i], F[sp->value]);
|
||||||
int j;
|
|
||||||
for (j = 0; j < ntokens; ++j)
|
|
||||||
if (BITISSET (F (sp->value), j))
|
|
||||||
bitset_set (LA[i], j);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free LOOKBACK. */
|
/* Free LOOKBACK. */
|
||||||
for (i = 0; i < nLA; i++)
|
for (i = 0; i < nLA; i++)
|
||||||
LIST_FREE (shorts, lookback[i]);
|
LIST_FREE (shorts, lookback[i]);
|
||||||
|
|
||||||
XFREE (lookback);
|
XFREE (lookback);
|
||||||
|
for (i = 0; i < (unsigned) ngotos; ++i)
|
||||||
|
bitset_free (F[i]);
|
||||||
XFREE (F);
|
XFREE (F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user