Dielectric function and critical-point transitions in boron-doped graphite