[mlir][ODS][NFC] Deduplicate `ref` and `qualified` handling (#91080)

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.
14 jobs for main
in 0 seconds and was queued for 106 minutes and 13 seconds