aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/parser/ruby.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-16 04:59:24 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-16 04:59:24 +0000
commitb7528b5edb1f9148ea00ebb6151720e5943b3f0b (patch)
tree4caf55c53adb188170240f54b924892fbc5f9814 /lib/rdoc/parser/ruby.rb
parent97ac172d58d695305c39d555155318edb99f1ea7 (diff)
downloadruby-b7528b5edb1f9148ea00ebb6151720e5943b3f0b.tar.gz
* lib/rdoc.rb: Import RDoc 3.7 release candidate
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parser/ruby.rb')
-rw-r--r--lib/rdoc/parser/ruby.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index 4d273598be..50071ab736 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -350,7 +350,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
def get_constant_with_optional_parens
skip_tkspace false
+
nest = 0
+
while TkLPAREN === (tk = peek_tk) or TkfLPAREN === tk do
get_tk
skip_tkspace
@@ -631,7 +633,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
cls.offset = offset
cls.line = line_no
- cls.comment = comment if cls.document_self
+ cls.add_comment comment, @top_level if cls.document_self
@top_level.add_to_classes_or_modules cls
@stats.add_class cls
@@ -650,7 +652,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
other.offset = offset
other.line = line_no
- other.comment = comment
+ other.add_comment comment, @top_level
end
# notify :nodoc: all if not a constant-named class/module
@@ -826,14 +828,19 @@ class RDoc::Parser::Ruby < RDoc::Parser
##
# Parses an +include+ in +context+ with +comment+
- def parse_include(context, comment)
+ def parse_include context, comment
loop do
skip_tkspace_comment
name = get_constant_with_optional_parens
- context.add_include RDoc::Include.new(name, comment) unless name.empty?
+
+ unless name.empty? then
+ incl = context.add_include RDoc::Include.new(name, comment)
+ incl.record_location @top_level
+ end
return unless TkCOMMA === peek_tk
+
get_tk
end
end
@@ -1231,7 +1238,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
mod.record_location @top_level
read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS
- mod.comment = comment if mod.document_self
+ mod.add_comment comment, @top_level if mod.document_self
parse_statements(mod)
@top_level.add_to_classes_or_modules mod
@@ -1295,9 +1302,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
while TkCOMMENT === tk do
comment << tk.text << "\n"
- tk = get_tk # this is the newline
- skip_tkspace false # leading spaces
tk = get_tk
+
+ if TkNL === tk then
+ skip_tkspace false # leading spaces
+ tk = get_tk
+ end
end
unless comment.empty? then
@@ -1313,7 +1323,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
non_comment_seen = true
end
- unget_tk tk
+ unget_tk tk # TODO peek instead of get then unget
keep_comment = true
when TkCLASS then