diff options
Diffstat (limited to 'lib/rdoc/parser')
-rw-r--r-- | lib/rdoc/parser/c.rb | 10 | ||||
-rw-r--r-- | lib/rdoc/parser/changelog.rb | 4 | ||||
-rw-r--r-- | lib/rdoc/parser/ruby.rb | 24 |
3 files changed, 19 insertions, 19 deletions
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index f7d0a9afa0..dd3ba5efdb 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -594,9 +594,10 @@ class RDoc::Parser::C < RDoc::Parser \s*#{attr_name}\s*, #{rw},.*?\)\s*;%xm then $1 - elsif @content =~ %r%Document-attr:\s#{attr_name}\s*?\n - ((?>.*?\*/))%xm then - $1 + elsif @content =~ %r%(/\*.*?(?:\s*\*\s*)?) + Document-attr:\s#{attr_name}\s*?\n + ((?>(.|\n)*?\*/))%x then + "#{$1}\n#{$2}" else '' end @@ -610,7 +611,7 @@ class RDoc::Parser::C < RDoc::Parser def find_body class_name, meth_name, meth_obj, file_content, quiet = false case file_content when %r%((?>/\*.*?\*/\s*)?) - ((?:(?:static|SWIGINTERN)\s+)? + ((?:(?:\w+)\s+)? (?:intern\s+)?VALUE\s+#{meth_name} \s*(\([^)]*\))([^;]|$))%xm then comment = RDoc::Comment.new $1, @top_level @@ -1185,7 +1186,6 @@ class RDoc::Parser::C < RDoc::Parser if hash then args << "p#{position} = {}" - position += 1 end args << '&block' if block diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 75fcaaad85..a3567c1f81 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -146,10 +146,10 @@ class RDoc::Parser::ChangeLog < RDoc::Parser entry_name = nil unless entry_name =~ /#{time.year}/ rescue NoMethodError # HACK Ruby 2.1.2 and earlier raises NoMethodError if time part is absent - time, = entry_name.split ' ', 2 + entry_name.split ' ', 2 rescue ArgumentError if /out of range/ =~ $!.message - time = Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil + Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil else entry_name = nil end diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 1c4b637640..ce1083edc7 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -187,15 +187,16 @@ class RDoc::Parser::Ruby < RDoc::Parser end ## - # Extracts the visibility information for the visibility token +tk+. + # Extracts the visibility information for the visibility token +tk+ + # and +single+ class type identifier. # # Returns the visibility type (a string), the visibility (a symbol) and # +singleton+ if the methods following should be converted to singleton # methods. - def get_visibility_information tk # :nodoc: + def get_visibility_information tk, single # :nodoc: vis_type = tk.name - singleton = false + singleton = single == SINGLE vis = case vis_type @@ -226,6 +227,7 @@ class RDoc::Parser::Ruby < RDoc::Parser comment = '' comment.force_encoding @encoding if @encoding first_line = true + first_comment_tk_class = nil tk = get_tk @@ -238,6 +240,9 @@ class RDoc::Parser::Ruby < RDoc::Parser skip_tkspace tk = get_tk else + break if first_comment_tk_class and not first_comment_tk_class === tk + first_comment_tk_class = tk.class + first_line = false comment << tk.text << "\n" tk = get_tk @@ -841,7 +846,6 @@ class RDoc::Parser::Ruby < RDoc::Parser # true, no found constants will be added to RDoc. def parse_constant container, tk, comment, ignore_constants = false - prev_container = container offset = tk.seek line_no = tk.line_no @@ -864,8 +868,6 @@ class RDoc::Parser::Ruby < RDoc::Parser end unless TkASSIGN === eq_tk then - suppress_parents container, prev_container - unget_tk eq_tk return false end @@ -889,7 +891,7 @@ class RDoc::Parser::Ruby < RDoc::Parser read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS @stats.add_constant con - con = container.add_constant con + container.add_constant con true end @@ -1305,7 +1307,7 @@ class RDoc::Parser::Ruby < RDoc::Parser return unless name meth = RDoc::AnyMethod.new get_tkread, name - meth.singleton = singleton + meth.singleton = single == SINGLE ? true : singleton record_location meth meth.offset = offset @@ -1875,9 +1877,7 @@ class RDoc::Parser::Ruby < RDoc::Parser # Determines the visibility in +container+ from +tk+ def parse_visibility(container, single, tk) - singleton = (single == SINGLE) - - vis_type, vis, singleton = get_visibility_information tk + vis_type, vis, singleton = get_visibility_information tk, single skip_tkspace_comment false @@ -2078,7 +2078,7 @@ class RDoc::Parser::Ruby < RDoc::Parser def skip_for_variable skip_tkspace false - tk = get_tk + get_tk skip_tkspace false tk = get_tk unget_tk(tk) unless TkIN === tk |