This script uses pygments (I can not help you install this). It relies on a monospace typeface, in this instance SourceCodePro by Adobe (An Open Source font family). The settings aren’t fully tweaked for generic use, but if you kind of know what you’re doing it won’t be a problem to get a lot more from it.
Each text unit is a unique object, so can be keyframed. The script generates materials automatically for cycles. You can adjust the material_library to your liking.
now as an addon, Makes new Panel in Text Editor called Syntax Objects, with a button Make Text Objects it will turn the currently active text in Text Editor into syntax highlighted 2d Text 0bjects in the 3dview.
Download, place in addons, addons_contrib, or addons_extern.
this code snippet will output all current materials, so if you modify the default theme and want to use it in the future you can overwrite that dictionary in the script.