mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
cfe1b4ef3d
First squash all multiline macro's, it makes parsing easier. Otherwise the regex to remove the macro would become more comples if we have to deal with newlines etc. When we have a match, we check if the last line in the pre_match is the beginning of a macro declaration. If it is, we remove the beginning of this macro declaration (#define<space>) and remove the body of the macro from the post_match, which is basically everything until the next newline. There is a possible edge case (pretty unlikely but still): if there is no newline in the post_match, meaning it is a macro at the end of the line, we should delete it as well, hence the '[\n]?' in the post match regex.