  Following the first principles the elements of the analytic theory of
potential curves for diatomic molecules (diatomics) are presented. It is based
on matching the perturbation theory at small internuclear distances $R$ and
multipole expansion at large distances, modified by instanton-induced
trans-series for homonuclear case, with addition of the phenomenologically
described equilibrium configuration, if exists. It leads to a new class of
(generalized) meromorphic potentials (modified by exponential terms) with
difference in degrees of polynomials in numerator and denominator equal to 4
(6) for positively charged (neutral) diatomics.
  As examples the He$_2^+$ and LiH diatomics in Born-Oppenheimer (adiabatic)
approximation are considered. For ${}^{4}$He$_2^+$ (${}^{3}$He$_2^+$) diatomics
it is found the approximate analytic expression for the potential energy curves
(analytic PEC) $V(R)$ for the ground state $X^2 \Sigma_u^+$ and the first
excited state $A^2 \Sigma_g^+$. It provides 3-4 s.d. correctly for distances $R
\in [1, 10]$\,a.u. with some irregularities for $A^2 \Sigma_g^+$ PEC at small
distances (much smaller than equilibrium distances) probably related to level
crossings which may occur there. The analytic PEC for the ground state $X^2
\Sigma_u^+$ supports 829 (626) rovibrational states with 3-4 s.d. of accuracy
in energy, which is only by 1 state less (more) than 830 (625) reported in the
literature. In turn, the analytic PEC for the excited state $A^2 \Sigma_g^+$
supports all 9 reported weakly-bound rovibrational states. Entire rovibrational
spectra is found in a single calculation using the code based on the Lagrange
mesh method.
