Semiclassical theory of molecular spectral line shapes in gases