code: function detectGaps(tree, file) {
    var lastNode = tree.children[tree.children.length - 1]
    var offset = 0
    var isGap = false
    var gaps = []
  
    /* Find all gaps. */
    visit(tree, one)
  
    /* Get the end of the document.
     * This detects if the last node was the last node.
     * If not, there’s an extra gap between the last node
     * and the end of the document. */
    if (
      lastNode &&
      lastNode.position &&
      lastNode.position.end &&
      offset === lastNode.position.end.offset &&
      trim(file.toString().slice(offset)) !== ''
    ) {
      update()
  
      update(
        tree && tree.position && tree.position.end && tree.position.end.offset - 1
      )
    }
  
    return gaps
  
    function one(node) {
      var pos = node.position
  
      update(pos && pos.start && pos.start.offset)
  
      if (!node.children) {
        update(pos && pos.end && pos.end.offset)
      }
    }
  
    /* Detect a new position. */
    function update(latest) {
      if (latest === null || latest === undefined) {
        isGap = true
        return
      }
  
      if (offset >= latest) {
        return
      }
  
      if (isGap) {
        gaps.push({start: offset, end: latest})
        isGap = false
      }
  
      offset = latest
    }
  }
docs: /* Detect gaps in `ast`.