mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-06 00:47:37 +00:00
Merge pull request #240 from edgarholleis/master
Improve comment suppression to cope with '/*xxx*//*yyy*/'.
This commit is contained in:
@@ -66,9 +66,9 @@ class CMockHeaderParser
|
|||||||
source.gsub!(/\s*\\\s*/m, ' ')
|
source.gsub!(/\s*\\\s*/m, ' ')
|
||||||
|
|
||||||
#remove comments (block and line, in three steps to ensure correct precedence)
|
#remove comments (block and line, in three steps to ensure correct precedence)
|
||||||
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
source.gsub!(/(?<!\*)\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
||||||
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
||||||
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
||||||
|
|
||||||
# remove assembler pragma sections
|
# remove assembler pragma sections
|
||||||
source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
|
source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
|
||||||
|
|||||||
Reference in New Issue
Block a user