Module: YARD::Parser::C::CommentParser

Included in:
Comment
Defined in:
lib/yard/parser/c/comment_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_comments(comments) ⇒ Object (protected)



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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?\n/).map do |line|
    line.gsub!(%r{^\s*/?\*/?}, '')
    line.gsub!(%r{\*/\s*$}, '')
    if line =~ /^\s*$/
      next if spaces.nil?
      next ""
    end
    spaces = (line[/^(\s+)/, 1] || "").size if spaces.nil?
    line.gsub(/^\s{0,#{spaces}}/, '').rstrip
  end.compact

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