generate_packets.py: factor out comment parsing code
Part of #43927. Move the part of parse_packets_def() responsible for removing comments into its own function. Merge strip_c_comment() into it, since the problem mentioned there no longer applies.
Does not interfere with #44563
Part of #43927. Move the part of parse_packets_def() responsible for removing comments into its own function. Merge strip_c_comment() into it, since the problem mentioned there no longer applies.