aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/parser/ruby.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/parser/ruby.rb')
-rw-r--r--lib/rdoc/parser/ruby.rb24
1 files changed, 12 insertions, 12 deletions
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