Quantization of the space of flat bundles over a Riemann surface