@SuppressWarnings("UseOfSystemOutOrSystemErr")
  void doHeavyChecksOnMarkerDone(@NotNull PsiBuilderImpl.StartMarker doneMarker, @Nullable PsiBuilderImpl.StartMarker anchorBefore) {
    int idx = indexOf(doneMarker);

    int endIdx = size();
    if (anchorBefore != null) {
      endIdx = indexOf(anchorBefore);
      if (idx > endIdx) {
        LOG.error("'Before' marker precedes this one.");
      }
    }

    for (int i = endIdx - 1; i > idx; i--) {
      PsiBuilderImpl.ProductionMarker item = getStartMarkerAt(i);
      if (item instanceof PsiBuilderImpl.StartMarker) {
        PsiBuilderImpl.StartMarker otherMarker = (PsiBuilderImpl.StartMarker)item;
        if (!otherMarker.isDone()) {
          Throwable debugAllocThis = myOptionalData.getAllocationTrace(doneMarker);
          Throwable currentTrace = new Throwable();
          if (debugAllocThis != null) {
            ExceptionUtil.makeStackTraceRelative(debugAllocThis, currentTrace).printStackTrace(System.err);
          }
          Throwable debugAllocOther = myOptionalData.getAllocationTrace(otherMarker);
          if (debugAllocOther != null) {
            ExceptionUtil.makeStackTraceRelative(debugAllocOther, currentTrace).printStackTrace(System.err);
          }
          LOG.error("Another not done marker added after this one. Must be done before this.");
        }
      }
    }
  }
@SuppressWarnings("UseOfSystemOutOrSystemErr")
  void doHeavyChecksOnMarkerDone(@NotNull PsiBuilderImpl.StartMarker doneMarker, @Nullable PsiBuilderImpl.StartMarker anchorBefore)