implement parsing enums
Clean up the enum parsing code.