in reply to Re: Looking for ideas: Converting a binary 'flags' field into something human readable
in thread Looking for ideas: Converting a binary 'flags' field into something human readable
That seems to me to be a “at least fairly genius” suggestion: to encode the value as the bit-field which it is, but then to document the meaning of the field to the human reader. (The computer wouldn’t care.)
Promptly upvoted.
The parser-grammar could fairly easily be made to include a descriptor that, one way or another, maps to a (hard-coded) Perl subroutine within the parser ... which generates the comment-entries to describe the field. (Personally, I think I’d do it as a table, including the starting byte/bit number, the number of bits, and the interpretation. “ASCII Art” could be unmanageable.)