class RDoc::Parser::C

def find_attr_comment(var_name, attr_name, read = nil, write = nil)

def find_attr_comment(var_name, attr_name, read = nil, write = nil)
  attr_name = Regexp.escape attr_name
  rw = if read and write then
         /\s*#{read}\s*,\s*#{write}\s*/xm
       else
         /.*?/m
       end
  comment = if @content =~ %r%((?>/\*.*?\*/\s+))
                              rb_define_attr\((?:\s*#{var_name},)?\s*
                                              "#{attr_name}"\s*,
                                              #{rw}\)\s*;%xm then
              $1
            elsif @content =~ %r%((?>/\*.*?\*/\s+))
                                 rb_attr\(\s*#{var_name}\s*,
                                          \s*#{attr_name}\s*,
                                          #{rw},.*?\)\s*;%xm then
              $1
            elsif @content =~ %r%(/\*.*?(?:\s*\*\s*)?)
                                 Document-attr:\s#{attr_name}\s*?\n
                                 ((?>(.|\n)*?\*/))%x then
              "#{$1}\n#{$2}"
            else
              ''
            end
  new_comment comment, @top_level, :c
end