I declared `sm6_parser_get_type()` with a `const char *function` parameter and use a `sm6_parser_get_type` macro to insert `__FUNCTION__` into each call. Is that an acceptable approach generally? Validating operand counts would be neater if done that way.
Generally, sure; we do that kind of thing for the check_readback_data_*() helpers in the tests for example. It doesn't seem particularly appropriate here though; I think we care much more about the location/context of the offending code in the source shader than about the location of the code parsing it. The latter would generally be implied by the former anyway.