delete head->action;
head->action = NULL;
+
+ for (s = head; s; s = s->next)
+ {
+ s->go.init (s);
+ }
}
for (s = head; s; s = s->next)
{
- // This awkward check is necessary in '-r' mode,
- // when the same DFA is used multiple times.
- // If this for-loop was moved to 'prepare', check
- // could be avoided, but in 'prepare' labels are
- // not renamed properly yet.
- if (s->go.type == Go::NOT_INITIALIZED)
- {
- s->go.init (s);
- }
s->go.used_labels ();
}
struct CpgotoTable
{
static const uint TABLE_SIZE;
- uint * table;
+ const State ** table;
CpgotoTable (const Span * span, uint nSpans);
~CpgotoTable ();
void emit (OutputFile & o, uint ind);
Span * span;
enum
{
- NOT_INITIALIZED,
EMPTY,
SWITCH_IF,
BITMAP,
const uint CpgotoTable::TABLE_SIZE = 0x100;
CpgotoTable::CpgotoTable (const Span * span, uint nSpans)
- : table (new uint [TABLE_SIZE])
+ : table (new const State * [TABLE_SIZE])
{
uint c = 0;
for (uint i = 0; i < nSpans; ++i)
{
for(; c < span[i].ub && c < TABLE_SIZE; ++c)
{
- table[c] = span[i].to->label;
+ table[c] = span[i].to;
}
}
}
Go::Go ()
: nSpans (0)
, span (NULL)
- , type (NOT_INITIALIZED)
+ , type (EMPTY)
, info ()
{}
{
if (nSpans == 0)
{
- type = EMPTY;
return;
}
{
switch (type)
{
- case NOT_INITIALIZED:
case EMPTY:
break;
case SWITCH_IF:
o << indent (++ind);
for (uint i = 0; i < TABLE_SIZE; ++i)
{
- o << "&&" << labelPrefix << table[i];
+ o << "&&" << labelPrefix << table[i]->label;
if (i == TABLE_SIZE - 1)
{
o << "\n";
}
else
{
- o << "," << space (table[i]);
+ o << "," << space (table[i]->label);
}
}
o << indent (--ind) << "};\n";
{
switch (type)
{
- case NOT_INITIALIZED:
case EMPTY:
break;
case SWITCH_IF:
{
for (uint i = 0; i < TABLE_SIZE; ++i)
{
- vUsedLabels.insert (table[i]);
+ vUsedLabels.insert (table[i]->label);
}
}
{
switch (type)
{
- case NOT_INITIALIZED:
case EMPTY:
case DOT:
break;