private static void reportFrameError(PsiBuilder builder, ErrorState state) {
    if (state.currentFrame == null || state.suppressErrors) return;
    Frame frame = state.currentFrame;
    int pos = builder.rawTokenIndex();
    if (frame.errorReportedAt > pos) {
      // report error for previous unsuccessful frame
      PsiBuilder.Marker marker = (PsiBuilder.Marker)builder.getLatestDoneMarker();
      int endOffset = marker != null ? marker.getEndIndex() : pos + 1;
      while (endOffset <= pos && isWhitespaceOrComment(builder, builder.rawLookup(endOffset - pos))) endOffset ++;
      boolean inner = endOffset == pos;
      builder.eof();
      reportError(builder, state, frame, inner, true, false);
    }
  }
private static void reportFrameError(PsiBuilder builder, ErrorState state)