Both the attribute and type format generator and the op format generator
independently implemented the parsing and verification of the `ref` and
`qualified` directives with little to no differences.
This PR moves the implementation of these into the common `FormatParser`
class to deduplicate the implementations.