Strip out nested pairs of braces in order to protect against function definitions in the header files (inline or otherwise).

This commit is contained in:
Mark VanderVoord
2016-03-17 07:52:19 -04:00
parent a20b14a575
commit 4ced2e4710
2 changed files with 60 additions and 3 deletions
+4 -3
View File
@@ -93,12 +93,13 @@ class CMockHeaderParser
"#{functype} #{$2.strip}(#{$3});"
end
# remove nested pairs of braces because no function declarations will be inside of them (leave outer pair for function definition detection)
while source.gsub!(/\{[^\{\}]*\{[^\{\}]*\}[^\{\}]*\}/m, '{ }')
end
# remove function definitions by stripping off the arguments right now
source.gsub!(/\([^\)]*\)\s*\{[^\}]*\}/m, ";")
# remove pairs of braces because no function declarations will be inside of them
#source.gsub!(/\{[^\}]*\}/m, '')
#drop extra white space to make the rest go faster
source.gsub!(/^\s+/, '') # remove extra white space from beginning of line
source.gsub!(/\s+$/, '') # remove extra white space from end of line