/* And for the famous F variable, which name is so descriptive that a
comment is hardly needed. <grin>. */
-static unsigned *F = NULL;
-#define F(Rule) (F + (Rule) * tokensetsize)
+static bitset *F = NULL;
static short **includes;
static shorts **lookback;
traverse (int i)
{
int j;
- size_t k;
int height;
- size_t size = F (i + 1) - F(i);
VERTICES[++top] = i;
INDEX[i] = height = top;
if (INDEX[i] > INDEX[R[i][j]])
INDEX[i] = INDEX[R[i][j]];
- for (k = 0; k < size; ++k)
- F (i)[k] |= F (R[i][j])[k];
+ bitset_or (F[i], F[i], F[R[i][j]]);
}
if (INDEX[i] == height)
if (i == j)
break;
- for (k = 0; k < size; ++k)
- F (j)[k] = F (i)[k];
+ bitset_copy (F[j], F[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++)
{
int 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 (i = 0; i < nLA; i++)
for (sp = lookback[i]; sp; sp = sp->next)
- {
- int j;
- for (j = 0; j < ntokens; ++j)
- if (BITISSET (F (sp->value), j))
- bitset_set (LA[i], j);
- }
+ bitset_or (LA[i], LA[i], F[sp->value]);
/* Free LOOKBACK. */
for (i = 0; i < nLA; i++)
LIST_FREE (shorts, lookback[i]);
XFREE (lookback);
+ for (i = 0; i < (unsigned) ngotos; ++i)
+ bitset_free (F[i]);
XFREE (F);
}