State *DFA::findState(Ins **kernel, ptrdiff_t kCount)
{
- Ins **cP, **iP, *i;
- State *s;
-
kernel[kCount] = NULL;
- cP = kernel;
+ Ins ** cP = kernel;
- for (iP = kernel; (i = *iP); ++iP)
+ for (Ins ** iP = kernel, * i; (i = *iP); ++iP)
{
if (i->i.tag == CHAR || i->i.tag == TERM || i->i.tag == CTXT)
{
kCount = cP - kernel;
kernel[kCount] = NULL;
+ State * s;
for (s = head; s; s = s->next)
{
if (s->kCount == kCount)
{
- for (iP = s->kernel; (i = *iP); ++iP)
+ for (Ins ** iP = s->kernel, * i; (i = *iP); ++iP)
+ {
if (!isMarked(i))
+ {
goto nextState;
-
+ }
+ }
goto unmarkAll;
}
toDo = s;
unmarkAll:
-
- for (iP = kernel; (i = *iP); ++iP)
+ for (Ins ** iP = kernel, * i; (i = *iP); ++iP)
+ {
unmark(i);
+ }
return s;
}