module YARD::Parser::C::CommentParser

Protected Instance Methods

parse_comments(comments) click to toggle source
# File lib/yard/parser/c/comment_parser.rb, line 7
def parse_comments(comments)
  @overrides = []
  spaces = nil
  comments = remove_private_comments(comments)
  comments = comments.split(%r\r?\n/).map do |line|
    line.gsub!(%r{^\s*/?\*/?}, '')
    line.gsub!(%r{\*/\s*$}, '')
    if line =~ %r^\s*$/
      next if spaces.nil?
      next ""
    end
    spaces = (line[%r^(\s+)/, 1] || "").size if spaces.nil?
    line.gsub(%r^\s{0,#{spaces}}/, '').rstrip
  end.compact

  comments = parse_overrides(comments)
  comments = parse_callseq(comments)
  comments.join("\n")
end