anchor.diff:         InstructionGenerations:TFLREInstructionGenerations;
          StackInstructions:TPFLREInstructions;
          StateCache:TFLREDFAStateHashMap;
  -       DefaultStates:array[0..6*3{skMax}] of PFLREDFAState;
  +       DefaultStates:array[0..3{dskFastReversed}] of PFLREDFAState;
  +       StartStates:array[0..4*3{sskMax}] of PFLREDFAState;
          TemporaryState:TFLREDFAState;
          NewState:TFLREDFAState;
          CountStatesCached:longint;
  
positive.code:   BeforeFlags:=BeforeFlags or sfEmptyNonWordBoundary;
   end else begin
    BeforeFlags:=BeforeFlags or sfEmptyWordBoundary;
   end;{}
  
   writeln(chr(CurrentChar),' ',(BeforeFlags and sfEmptyWordBoundary)<>0,' ',(AfterFlags and sfEmptyWordBoundary)<>0);
  
   // Process empty-string step
   if ((BeforeFlags and not OldBeforeFlags) and NeedFlags)<>0 then begin
    inc(Generation);
    TemporaryState.CountInstructions:=0;
    TemporaryState.Flags:=0;
    for Counter:=0 to State.CountInstructions-1 do begin
     FullAddInstructionThread(@TemporaryState,State.Instructions[Counter],BeforeFlags);
    end;
    BaseState:=@TemporaryState;
   end else{} begin
    BaseState:=State;
   end;
  
   // Process state instructions
   inc(Generation);
   IsMatch:=false;
   Flags:=AfterFlags;
   NewState.CountInstructions:=0;
   NewState.Flags:=0;
   for Counter:=0 To State^.CountInstructions-1 do begin
    Instruction:=State^.Instructions[Counter];
  // writeln(Instruction^.IDandOpcode shr 8:4,' ',Instruction^.IDandOpcode and $ff);
    case Instruction^.IDandOpcode and $ff of
     opZEROWIDTH,opLOOKBEHINDNEGATIVE,opLOOKBEHINDPOSITIVE,opLOOKAHEADNEGATIVE,opLOOKAHEADPOSITIVE,opBACKREFERENCE,opBACKREFERENCEIGNORECASE:begin
      continue;                        
     end;
     opSINGLECHAR:begin
      if CurrentChar=longword(Instruction^.Value) then begin
       FullAddInstructionThread(@NewState,Instruction^.Next,Flags);
      end;
     end;
     opCHAR:begin
      if (CurrentChar<>$ffffffff) and (ansichar(byte(CurrentChar)) in PFLRECharClass(pointer(ptruint(Instruction^.Value)))^) then begin
       FullAddInstructionThread(@NewState,Instruction^.Next,Flags);
      end;
     end;
     opANY:begin
      FullAddInstructionThread(@NewState,Instruction^.Next,Flags);
     end;
     opMATCH:begin
      IsMatch:=true;
      if not ((MatchMode in [mmLongestMatch,mmFullMatch,mmMultiMatch]) or Reversed) then begin
       // We can stop processing the instruction list queue here since we found a match (for the PCRE leftmost first valid match behaviour)
       break;
      end;
     end;
     else begin
      // Oops?! Invalid byte code instruction for the DFA processing context! So abort and fallback to NFA...
      result:=nil;
      exit;
     end;
    end;
   end;                 
  
   // Add missed flags
   if IsMatch then begin              
    Flags:=Flags or sfDFAMatchWins;
   end;
   if IsWordChar then begin
    Flags:=Flags or sfDFALastWord;
   end;
  
   // Search needed flags for this next state
   NeedFlags:=0;
   for Counter:=0 To NewState.CountInstructions-1 do begin
    Instruction:=NewState.Instructions[Counter];
    case Instruction^.IDandOpcode and $ff of
     opZEROWIDTH:begin
      NeedFlags:=NeedFlags or longword(Instruction^.Value);
     end;
    end;
   end;
  
   // Drop flags if no empty-string instructions are there, to save unneeded cached states
   if NeedFlags=0 then begin
    Flags:=Flags and sfDFAMatchWins;
   end;
  
   // Store flags in the new state
   NewState.Flags:=Flags or ((NeedFlags or (State.Flags and sfDFAStart)) shl sfDFANeedShift);
  
   // Dead state? If yes, ...
   if NewState.CountInstructions=0 then begin
    // ... drop it and take the dead state as the next state
    result:=DefaultStates[skDead];
   end else begin
    // .. otherwise try caching it
    result:=CacheState(@NewState);
   end;
  
   // Connect the last state to the new state with the current char
   State.NextStates[Instance.ByteMap[byte(ansichar(CurrentChar))]]:=result;
  
  end;
  
  function TFLREDFA.SearchMatchFull(const StartPosition,UntilExcludingPosition:longint;out MatchEnd:longint;const UnanchoredStart:boolean):longint;
  
negative.code:  end;
  end;
  
  procedure TFLREDFA.ProcessWorkQueueOnZeroWidthString(const OldWorkQueue,NewWorkQueue:TFLREDFAWorkQueue;Flags:longword);
  var Index:longint;
      Instruction:PFLREInstruction;
  begin
   NewWorkQueue.Clear;
   for Index:=0 to OldWorkQueue.CountInstructions-1 do begin
    Instruction:=OldWorkQueue.Instructions[Index];
    if OldWorkQueue.IsMark(Instruction) then begin
     AddToWorkQueue(NewWorkQueue,Mark,Flags);
    end else begin
     AddToWorkQueue(NewWorkQueue,Instruction,Flags);
    end;
   end;
  end;
  
  procedure TFLREDFA.ProcessWorkQueueOnByte(const OldWorkQueue,NewWorkQueue:TFLREDFAWorkQueue;CurrentChar,Flags:longword;var IsMatch:boolean);
  var Index,ID:longint;
      Instruction:PFLREInstruction;
  begin
   NewWorkQueue.Clear;
   for Index:=0 to OldWorkQueue.CountInstructions-1 do begin
    Instruction:=OldWorkQueue.Instructions[Index];
    if OldWorkQueue.IsMark(Instruction) then begin
     if IsMatch then begin
      exit;
     end;
     NewWorkQueue.Mark;
    end else begin
     case Instruction^.IDandOpcode and $ff of
      opJMP,opSAVE,opMULTIMATCH,opLOOKBEHINDNEGATIVE,opLOOKBEHINDPOSITIVE,opLOOKAHEADNEGATIVE,opLOOKAHEADPOSITIVE,opBACKREFERENCE,opBACKREFERENCEIGNORECASE,opSPLIT,opSPLITMATCH,opZEROWIDTH:begin
       // Already processed
      end;
      opSINGLECHAR:begin
       if CurrentChar=longword(Instruction^.Value) then begin
        AddToWorkQueue(NewWorkQueue,Instruction^.Next,Flags);
       end;
      end;
      opCHAR:begin
       if (CurrentChar<>$ffffffff) and (ansichar(byte(CurrentChar)) in PFLRECharClass(pointer(ptruint(Instruction^.Value)))^) then begin
        AddToWorkQueue(NewWorkQueue,Instruction^.Next,Flags);
       end;
      end;
      opANY:begin
       if CurrentChar<>$ffffffff then begin
        AddToWorkQueue(NewWorkQueue,Instruction^.Next,Flags);
       end;
      end;
      opMATCH:begin
       if not (Instance.EndingAnchor and (CurrentChar<>$ffffffff)) then begin
        IsMatch:=true;
        if MatchMode=mmFirstMatch then begin
         exit;
        end;
       end;
      end;
     end;
    end;
   end;
  end;
  
  function TFLREDFA.RunStateOnByte(State:PFLREDFAState;const Position:longint;const CurrentChar:longword;const Reversed:boolean):PFLREDFAState;
  var Counter:longint;
      Instruction:PFLREInstruction;
      NeedFlags,BeforeFlags,OldBeforeFlags,AfterFlags,Flags,UnicodeChar:longword;
      BaseState:PFLREDFAState;
      IsMatch,IsWordChar:boolean;
      Queues:array[0..2] of TFLREDFAWorkQueue;
  begin
  
   if State=DefaultStates[dskDead] then begin
    result:=nil;
    exit;
   end;
  
   Queues[0]:=WorkQueues[0];
   Queues[1]:=WorkQueues[1];
  
   StateToWorkQueue(State,Queues[0]);
  
   // Fetch flags
   NeedFlags:=State.Flags shr sfDFANeedShift;
  