refactored type extraction to reduce if-else nesting depth, and allow parsing of const and pointer qualifiers on typedefed and namespaced types