mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-07-29 07:17:49 +00:00
Refactor cleanup actions when normalizing source
This commit is contained in:
@@ -80,11 +80,16 @@ class CMockHeaderParser
|
||||
# Disguise them as normal functions with the ";"
|
||||
m.gsub!(/\s*\{\s\}/, ";")
|
||||
|
||||
# TODO: fix these cleanup actions...
|
||||
m.gsub!(/^\s+/, '') # remove extra white space from beginning of line
|
||||
m.gsub!(/\s+/, ' ') # remove remaining extra white space
|
||||
m.gsub!(";",";\n")
|
||||
m.gsub!(/^\s+/, '') # remove extra white space from beginning of line
|
||||
# Cleanup the function declarations
|
||||
# Not strictly necessary compile-wise, but it can help debugging
|
||||
m_lines = m.split(/\s*;\s*/).uniq
|
||||
m_lines.each {
|
||||
|m_line|
|
||||
m_line.gsub!(/^\s+/, '') # remove extra white space from beginning of line
|
||||
m_line.gsub!(/\s+/, ' ') # remove remaining extra white space
|
||||
}
|
||||
|
||||
m_lines.join(";\n") + ";" # Join the lines and add the last semicolon manually
|
||||
end
|
||||
|
||||
source.gsub!(/\s+$/, '') # remove extra white space from end of line
|
||||
|
||||
Reference in New Issue
Block a user