First cut at ctdbp_cdef parser

Optimizing some logic, fixing formatting