anchor.diff:   Input:=ThreadLocalState.Input;
    InputLength:=ThreadLocalState.InputLength;
   
  - CurrentThreadList:=@ThreadLists[0];
  - NewThreadList:=@ThreadLists[1];
  + CurrentThreadList:=@ThreadLocalState.ThreadLists[0];
  + NewThreadList:=@ThreadLocalState.ThreadLists[1];
   
    CurrentThreadList^.Count:=0;
    NewThreadList^.Count:=0;
   
    SubMatches:=NewSubMatches(CountSubMatches,0);
   
  - inc(Generation);
  + inc(ThreadLocalState.Generation);
    if UnanchoredStart then begin
     AddThread(ThreadLocalState,CurrentThreadList,UnanchoredStartInstruction,SubMatches,StartPosition);
    end else begin
  
positive.code: end;
  
  constructor TFLREThreadLocalState.Create(AInstance:TFLRE);
  begin
   inherited Create;
   AllNext:=nil;
   FreeNext:=nil;
   Instance:=AInstance;
   Input:=nil;
   InputLength:=0;
  end;
  
  destructor TFLREThreadLocalState.Destroy;
  begin
   inherited Destroy;
  end;
  
  function TFLREThreadLocalState.GetSatisfyFlags(const Position:longint):longword;
  var PreviousPosition:longint;
      PreviousChar,CurrentChar:longword;
  begin
   result:=0;
   if rfUTF8 in Instance.Flags then begin
    PreviousPosition:=Position;
    UTF8PtrDec(Input,InputLength,PreviousPosition);
    if (PreviousPosition>=0) and (PreviousPosition<=InputLength) then begin
     PreviousChar:=UTF8PtrCodeUnitGetCharFallback(Input,InputLength,PreviousPosition);
    end else begin
     PreviousChar:=0;
    end;
    if (Position>=0) and (Position<InputLength) then begin
     CurrentChar:=UTF8PtrCodeUnitGetCharFallback(Input,InputLength,Position);
    end else begin
     CurrentChar:=0;
    end;
   end else begin
    PreviousPosition:=Position-1;
    if (PreviousPosition>=0) and (PreviousPosition<=InputLength) then begin
     PreviousChar:=byte(ansichar(Input[PreviousPosition]));
    end else begin
     PreviousChar:=0;
    end;
    if (Position>=0) and (Position<InputLength) then begin
     CurrentChar:=byte(ansichar(Input[Position]));
    end else begin
     CurrentChar:=0;
    end;
   end;
   if Position<=0 then begin
    result:=result or (sfEmptyBeginText or sfEmptyBeginLine);
   end else begin
    case PreviousChar of
     $0a,$0d,$85,$2028,$2029:begin
      result:=result or sfEmptyBeginLine;
     end;
    end;
   end;
   if Position>=(InputLength-1) then begin
    result:=result or (sfEmptyEndText or sfEmptyEndLine);
   end else begin
    case CurrentChar of
     $0a,$0d,$85,$2028,$2029:begin
      result:=result or sfEmptyEndLine;
     end;
    end;
   end;
   if InputLength>0 then begin
    if Position=0 then begin
     if Instance.IsWordChar(CurrentChar) then begin
      result:=result or sfEmptyWordBoundary;
     end;
    end else if Position>=InputLength then begin
     if Instance.IsWordChar(PreviousChar) then begin
      result:=result or sfEmptyWordBoundary;
     end;
    end else if Instance.IsWordChar(PreviousChar)<>Instance.IsWordChar(CurrentChar) then begin
     result:=result or sfEmptyWordBoundary;
    end;
   end;
   if (result and sfEmptyWordBoundary)=0 then begin
    result:=result or sfEmptyNonWordBoundary;
   end;
  end;
  
  constructor TFLRE.Create(const ARegularExpression:ansistring;const AFlags:TFLREFlags=[]);
  var FLREDFAStateCreateTempDFAState:TFLREDFAState;
  begin
   inherited Create;
  
   Generation:=0;
   CountParens:=0;
  
   AnchoredRootNode:=nil;
  
   UnanchoredRootNode:=nil;
  
   Nodes:=TList.Create;
  
   ForwardInstructions:=nil;
   CountForwardInstructions:=0;
  
   BackwardInstructions:=nil;
   CountBackwardInstructions:=0;
  
   AnchoredStartInstruction:=nil;
   UnanchoredStartInstruction:=nil;
   ReversedStartInstruction:=nil;
  
   CharClasses:=nil;
   CountCharClasses:=0;
  
   ThreadLists[0].Threads:=nil;
   ThreadLists[1].Threads:=nil;
  
   FreeSubMatches:=nil;
  
   AllSubMatches:=TList.Create;
  
   RegularExpression:=ARegularExpression;
  
   Flags:=AFlags;
  
   FixedString:='';
   FixedStringBoyerMooreNext:=nil;
  
   OnePassNFANodes:=nil;
   OnePassNFANodesCount:=0;
   OnePassNFAStart:=nil;
   OnePassNFAStateSize:=0;
   OnePassNFAWorkCaptures:=nil;
   OnePassNFAMatchCaptures:=nil;
   OnePassNFACharClassActions:=nil;
   OnePassNFAReady:=false;
  
   BitStateNFACountVisited:=0;
   BitStateNFAJobs:=nil;
   BitStateNFACountJobs:=0;
   BitStateNFAMaxJob:=0;
   BitStateNFAWorkCaptures:=nil;
   BitStateNFAMatchCaptures:=nil;
   BitStateNFAReady:=false;
  
   DFAStackInstructions:=nil;
   DFAStateCache:=TFLREDFAStateHashMap.Create;
  
negative.code:  Input:=ThreadLocalState.Input;
   InputLength:=ThreadLocalState.InputLength;
   if UnanchoredStart then begin
    State:=ThreadLocalState.DFAUnanchoredStartState;
   end else begin
    State:=ThreadLocalState.DFAAnchoredStartState;
   end;
   for Position:=StartPosition to UntilExcludingPosition-1 do begin
    LastState:=State;
    State:=State^.NextStates[ByteMap[byte(ansichar(Input[Position]))]];
    if not assigned(State) then begin
     State:=ThreadLocalState.DFAProcessNextState(LastState,Input[Position],false);
     if not assigned(State) then begin
      result:=DFAError;
      exit;
  