       startPosition = @positionForCharacterIndex(matchStartIndex + lengthDelta)
       endPosition = @positionForCharacterIndex(matchEndIndex + lengthDelta)
       range = new Range(startPosition, endPosition)
-      recurse = true
+      keepLooping = true
       replacementText = null
-      stop = -> recurse = false
+      stop = -> keepLooping = false
       replace = (text) -> replacementText = text
       iterator(match, range, { stop, replace })
 

        matchStartIndex++
        matchEndIndex++

      if global and recurse
        traverseRecursively(text, matchEndIndex, endIndex, lengthDelta)

    startIndex = @characterIndexForPosition(range.start)
    endIndex = @characterIndexForPosition(range.end)
    traverseRecursively(@getText(), startIndex, endIndex, 0)

  backwardsScanInRange: (regex, range, iterator) ->
    global = regex.global


    matches.reverse()

    keepLooping = true
    stop = -> keepLooping = false
    replacementText = null
    replace = (text) -> replacementText = text

