Result Recurse2(Context ctx, int next)
{
// Assert: at entry "state" is an accept state AND
// NextState(state, chr) != currentStart AND
// NextState(state, chr) is not an accept state.
//
bool inAccept;
SaveStateAndPos(ctx);
state = next;
if (state == eofNum) return Result.accept;
GetChr();
inAccept = false;
while ((next = NextState()) != currentStart)
{
if (inAccept && next > maxAccept) // need to prepare backup data
SaveStateAndPos(ctx);
state = next;
if (state == eofNum) return Result.accept;
GetChr();
inAccept = (state <= maxAccept);
}
if (inAccept) return Result.accept; else return Result.noMatch;
}