mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge rdoc-6.1.0.beta1.
* https://github.com/ruby/rdoc/compare/v6.0.4...v6.1.0.beta1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
41fb243684
commit
95e213d354
22 changed files with 575 additions and 193 deletions
|
@ -19,7 +19,7 @@ class RDoc::CrossReference
|
|||
#
|
||||
# See CLASS_REGEXP_STR
|
||||
|
||||
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>)(?:\([\w.+*/=<>-]*\))?'
|
||||
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
|
||||
|
||||
##
|
||||
# Regular expressions matching text that should potentially have
|
||||
|
@ -127,23 +127,41 @@ class RDoc::CrossReference
|
|||
|
||||
if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
|
||||
type = $2
|
||||
type = '' if type == '.' # will find either #method or ::method
|
||||
method = "#{type}#{$3}"
|
||||
if '.' == type # will find either #method or ::method
|
||||
method = $3
|
||||
else
|
||||
method = "#{type}#{$3}"
|
||||
end
|
||||
container = @context.find_symbol_module($1)
|
||||
elsif /^([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
|
||||
type = $1
|
||||
type = '' if type == '.'
|
||||
method = "#{type}#{$2}"
|
||||
if '.' == type
|
||||
method = $2
|
||||
else
|
||||
method = "#{type}#{$2}"
|
||||
end
|
||||
container = @context
|
||||
else
|
||||
type = nil
|
||||
container = nil
|
||||
end
|
||||
|
||||
if container then
|
||||
ref = container.find_local_symbol method
|
||||
|
||||
unless ref || RDoc::TopLevel === container then
|
||||
ref = container.find_ancestor_local_symbol method
|
||||
unless RDoc::TopLevel === container then
|
||||
if '.' == type then
|
||||
if 'new' == method then # AnyClassName.new will be class method
|
||||
ref = container.find_local_symbol method
|
||||
ref = container.find_ancestor_local_symbol method unless ref
|
||||
else
|
||||
ref = container.find_local_symbol "::#{method}"
|
||||
ref = container.find_ancestor_local_symbol "::#{method}" unless ref
|
||||
ref = container.find_local_symbol "##{method}" unless ref
|
||||
ref = container.find_ancestor_local_symbol "##{method}" unless ref
|
||||
end
|
||||
else
|
||||
ref = container.find_local_symbol method
|
||||
ref = container.find_ancestor_local_symbol method unless ref
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue