1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rdoc/parsers/parse_c.rb (handle_class_module): handle a

module enclosed in a built-in module.  fixed: [ruby-talk:148239]

* lib/rdoc/parsers/parse_c.rb (find_body): allow macros as methods.

* lib/rdoc/parsers/parse_c.rb (find_call_seq): allow :nodoc: modifier
  in C.  [ruby-core:04572]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-07-15 15:00:11 +00:00
parent fd0f36a4a8
commit 2bfa23f034
2 changed files with 49 additions and 15 deletions

View file

@ -1,3 +1,13 @@
Fri Jul 15 23:59:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rdoc/parsers/parse_c.rb (handle_class_module): handle a
module enclosed in a built-in module. fixed: [ruby-talk:148239]
* lib/rdoc/parsers/parse_c.rb (find_body): allow macros as methods.
* lib/rdoc/parsers/parse_c.rb (find_call_seq): allow :nodoc: modifier
in C. [ruby-core:04572]
Fri Jul 15 23:20:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enumerator.c (Init_Enumerator): use an internal directly.

View file

@ -226,6 +226,13 @@ module RDoc
if in_module
enclosure = @classes[in_module]
unless enclosure
if enclosure = @known_classes[in_module]
handle_class_module(in_module, (/^rb_m/ =~ in_module ? "module" : "class"),
enclosure, nil, nil)
enclosure = @classes[in_module]
end
end
unless enclosure
warn("Enclosing class/module '#{in_module}' for " +
"#{class_mod} #{class_name} not known")
@ -524,24 +531,25 @@ module RDoc
end
if source_file
file_name = File.join(@file_dir, source_file)
file_name = File.join(@file_dir, source_file)
body = (@@known_bodies[source_file] ||= File.read(file_name))
else
body = @body
end
find_body(meth_body, meth_obj, body)
class_obj.add_method(meth_obj)
if find_body(meth_body, meth_obj, body) and meth_obj.document_self
class_obj.add_method(meth_obj)
end
end
end
############################################################
# Find the C code corresponding to a Ruby method
def find_body(meth_name, meth_obj, body)
if body =~ %r{((?>/\*.*?\*/\s*))(static\s+)?VALUE\s+#{meth_name}
\s*(\(.*?\)).*?^}xm
comment, params = $1, $3
def find_body(meth_name, meth_obj, body, quiet = false)
case body
when %r{((?>/\*.*?\*/\s*))(?:static\s+)?VALUE\s+#{meth_name}
\s*(\(.*?\)).*?^}xm
comment, params = $1, $2
body_text = $&
# see if we can find the whole body
@ -561,25 +569,36 @@ module RDoc
override_comment = find_override_comment(meth_obj.name)
comment = override_comment if override_comment
find_call_seq(comment, meth_obj) if comment
find_modifiers(comment, meth_obj) if comment
# meth_obj.params = params
meth_obj.start_collecting_tokens
meth_obj.add_token(RubyToken::Token.new(1,1).set_text(body_text))
meth_obj.comment = mangle_comment(comment)
when %r{((?>/\*.*?\*/\s*))^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
comment = $1
find_body($2, meth_obj, body, true)
find_modifiers(comment, meth_obj)
meth_obj.comment = mangle_comment(comment) + meth_obj.comment
when %r{^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
unless find_body($1, meth_obj, body, true)
warn "No definition for #{meth_name}" unless quiet
return false
end
else
# No body, but might still have an override comment
comment = find_override_comment(meth_obj.name)
if comment
find_call_seq(comment, meth_obj)
find_modifiers(comment, meth_obj)
meth_obj.comment = mangle_comment(comment)
else
warn "No definition for #{meth_name}"
warn "No definition for #{meth_name}" unless quiet
return false
end
end
true
end
@ -590,8 +609,13 @@ module RDoc
# Array.new
# Array.new(10)
# use it for the parameters
def find_call_seq(comment, meth_obj)
if comment.sub!(/call-seq:(.*?)^\s*\*?\s*$/m, '')
def find_modifiers(comment, meth_obj)
if comment.sub!(/:nodoc:\s*^\s*\*?\s*$/m, '') or
comment.sub!(/\A\/\*\s*:nodoc:\s*\*\/\Z/, '')
meth_obj.document_self = false
end
if comment.sub!(/call-seq:(.*?)^\s*\*?\s*$/m, '') or
comment.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '')
seq = $1
seq.gsub!(/^\s*\*\s*/, '')
meth_obj.call_seq = seq