in reply to a question about re

This is not easily done with a regex, because you'd have to count the number of opening and closing brackets. You can write recursive regexes that do such things, but that's generally not very much fun.

How about using an existing parser for C instead?