Prevent doxygen from parsing @implementation within comments

This commit is contained in:
Aparajita Fishman committed 2012-03-21 12:48:12 -07:00
1 parent ebd797d6d7
commit b99ece088d
1 file changed
+13
@@ -43,6 +43,9 @@ def makeHeaderFileFrom(fileName)
source = sourceFile.read
sourceFile.close()
# Add a @ before @implementation within comments so they are not considered as code
source.gsub!(/(\/\*.*?\*\/)/m) {|text| $1.gsub(/^(\s*)@implementation /, "\\1@@implementation ")}
# If an implementation does not have an ivar block or an empty ivar block,
# add one with a dummy ivar so that doxygen will parse the file correctly.
source.gsub!(/^\s*(@implementation \s*\w+(?:\s*:\s*\w+)?)\n(\s*[^{])/, "\\1\n{\n#{DUMMY_IVAR}\n}\n\\2")
@@ -83,6 +86,16 @@ def makeHeaderFileFrom(fileName)
end
sourceFile.close()
sourceFile = File.new(fileName, "r")
source = sourceFile.read
sourceFile.close()
# Restore @implementation within comments
sourceFile = File.new(fileName, "w")
source.gsub!(/(\/\*.*?\*\/)/m) {|text| $1.gsub(/^(\s*)@@implementation /, "\\1@implementation ")}
sourceFile.write(source)
sourceFile.close()
end
def writeAccessors(className, ivars, sourceFile, interfaceFile)