now ignoring contents of #pragma asm sections in header files, which were previously erroneously treated as C tokens

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@143 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
ajwitte
2009-10-27 21:08:34 +00:00
parent a875949914
commit 81d94eeca9
2 changed files with 19 additions and 1 deletions
+3
View File
@@ -50,6 +50,9 @@ class CMockHeaderParser
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
# remove assembler pragma sections
source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
# remove preprocessor statements
source.gsub!(/^\s*#.*/, '')
+16 -1
View File
@@ -83,6 +83,21 @@ class CMockHeaderParserTest < Test::Unit::TestCase
assert_equal(expected, @parser.import_source(source))
end
should "remove assembler pragma sections" do
source =
" #pragma\tasm\n" +
" .foo\n" +
" lda %m\n" +
" nop\n" +
"# pragma endasm \n" +
"foo"
expected = ["foo"]
assert_equal(expected, @parser.import_source(source))
end
should "smush lines together that contain continuation characters" do
@@ -527,4 +542,4 @@ class CMockHeaderParserTest < Test::Unit::TestCase
assert_equal(expected, @parser.parse(source)[:functions])
end
end
end