void finish() {
      assert insertOffset >= 0;
      DocumentImpl document = mapper.doc;
      document.insertString(insertOffset, text);
      int start = insertOffset;
      for (int i = 0; i < tokenTypes.size(); i++) {
        IElementType type = tokenTypes.get(i);
        int len = lengths.getInt(i);
        start += mySeparator.length();
        int globalIndex = index2Global.get(i);
        MappedRange[] ranges = getMappingSegments().myRanges;
        checkNull(type, ranges[globalIndex]);
        ranges[globalIndex] = new MappedRange(mapper, document.createRangeMarker(start, start + len), type);
        start += len;
      }
    }
void finish()