Comments just after module or subprogram, or arguments are returned. If
“COMMENTS_ARE_UPPER” is true, comments just before modules or
subprograms are returnd
# File lib/rdoc/parser/f95.rb, line 1152
def find_comments text
return "" unless text
lines = text.split("\n")
lines.reverse! if COMMENTS_ARE_UPPER
comment_block = Array.new
lines.each do |line|
break if line =~ /^\s*?\w/ || line =~ /^\s*?$/
if COMMENTS_ARE_UPPER
comment_block.unshift line.sub(/^\s*?!\s?/,"")
else
comment_block.push line.sub(/^\s*?!\s?/,"")
end
end
nice_lines = comment_block.join("\n").split "\n\s*?\n"
nice_lines[0] ||= ""
nice_lines.shift
end