anchor.diff:          impl 1u input initialState None
   
       let private produceToken dfa groups = state {
  -        let rec impl() = state {
  -            let! tok = get <!> (tokenizeDFA dfa)
  -            let! gs = getOptic TokenizerState.GroupStack_
  +        let rec impl (state: TokenizerState) =
  +            let tok = tokenizeDFA dfa state
  +            let gs = state.GroupStack
               match tok.Symbol, gs with
               // A new group just started, and it was found by its symbol in the group table.
               // If we are already in a group, we check whether it can be nested inside this new one.
  
positive.code:             // in the group stack, consume the token, and continue.
              | GroupStart (tokGroupIdx, _), _ when gs |> List.tryHead |> Option.map (snd >> Group.nesting >> Set.contains tokGroupIdx) |> Option.defaultValue true ->
                  let tokGroup = SafeArray.retrieve groups tokGroupIdx
                  do! tok.Data |> String.length |> consumeBuffer
                  do! setOptic TokenizerState.GroupStack_ ((tok, tokGroup) :: gs)
                  return! impl()
              // We are neither inside any group, nor a new one is going to start.
              // The easiest case. We consume the token, and return it.
              | _, [] ->
                  do! tok.Data |> String.length |> consumeBuffer
                  return tok
              // We are inside a group, and this new token is going to end it.
              // Depending on the group's definition, the end symbol might be kept.
              | sym, (popped, poppedGroup) :: xs when poppedGroup.EndSymbol = sym ->
                  let! popped = state {
                      match poppedGroup.EndingMode with
                      | EndingMode.Closed ->
                          do! tok.Data |> String.length |> consumeBuffer
                          return Token.AppendData tok.Data popped
                      | EndingMode.Open -> return popped
                  }
                  match xs with
                  // We have now left the group. We empty the group stack and and fix the symbol of our token.
                  | [] ->
                      do! setOptic TokenizerState.GroupStack_ []
                      return {popped with Symbol = poppedGroup.ContainerSymbol}
                  // There is still another outer group. We append the outgoing group's data to the next top group.
                  | (tok2, g2) :: xs ->
                      do! setOptic TokenizerState.GroupStack_ ((Token.AppendData popped.Data tok2, g2) :: xs)
                      return! impl()
              // If input ends inside the group, we stop here. The upper-level parser will report the error.
              | EndOfFile, _ -> return tok
              // We are still inside a group. 
              | _, (tok2, g2) :: xs ->
                  // The input can advance either by just one character, or the entire token.
  
negative.code:                     match g2.AdvanceMode with
                      | AdvanceMode.Token -> tok.Data
                      | AdvanceMode.Character -> string tok.Data.[0]
                  let state =  dataToAdvance |> String.length |> consumeBuffer <| state |> snd
                  impl {state with GroupStack = (Token.AppendData dataToAdvance tok2, g2) :: xs}
          let! tok = impl
          let! isInsideGroup = getOptic TokenizerState.GroupStack_ <!> (List.isEmpty >> not)
          return {NewToken = tok; IsInsideGroup = isInsideGroup}
      }
  