Sha256: 06eff9b76742ac2d1f859c8bcbfa796c985cc69f165c86f7ef4be1639ca479fb

Contents?: true

Size: 1.04 KB

Versions: 30

Compression:

Stored size: 1.04 KB

Contents

require "rdoc/parser/c"

# New RDoc somehow misses class comemnts.
# copyied this function from "2.2.2" 
if ['2.4.2', '2.4.3'].include? RDoc::VERSION

  class RDoc::Parser::C
    def find_class_comment(class_name, class_meth)
      comment = nil
      if @content =~ %r{((?>/\*.*?\*/\s+))
                     (static\s+)?void\s+Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)\)}xmi then
        comment = $1
      elsif @content =~ %r{Document-(?:class|module):\s#{class_name}\s*?(?:<\s+[:,\w]+)?\n((?>.*?\*/))}m
        comment = $1
      else
        if @content =~ /rb_define_(class|module)/m then
          class_name = class_name.split("::").last
          comments = []
          @content.split(/(\/\*.*?\*\/)\s*?\n/m).each_with_index do |chunk, index|
            comments[index] = chunk
            if chunk =~ /rb_define_(class|module).*?"(#{class_name})"/m then
              comment = comments[index-1]
              break
            end
          end
        end
      end
      class_meth.comment = mangle_comment(comment) if comment
    end
  end
end

Version data entries

30 entries across 30 versions & 4 rubygems

Version Path
toy-sdoc-0.2.12.1 lib/sdoc/c_parser_fix.rb
toy-sdoc-0.2.13 lib/sdoc/c_parser_fix.rb
toy-sdoc-0.2.14.1 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.1.10 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.0 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.1 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.10.1 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.10 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.11.1 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.11 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.12.1 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.12 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.13 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.14.1 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.14 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.2 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.3 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.4 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.5 lib/sdoc/c_parser_fix.rb
voloko-sdoc-0.2.6 lib/sdoc/c_parser_fix.rb