Electronic spectra of fluorides, oxyfluorides, and oxides of rare-earth metals