@@ -19,7 +19,7 @@ class RDoc::CrossReference
1919 #
2020 # See CLASS_REGEXP_STR
2121
22- METHOD_REGEXP_STR = '([a -z]\w*[!?=]?|%|===?|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
22+ METHOD_REGEXP_STR = '([A-Za -z]\w*[!?=]?|%|===?|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
2323
2424 ##
2525 # Regular expressions matching text that should potentially have
@@ -34,12 +34,6 @@ class RDoc::CrossReference
3434 # A::B::C.meth
3535 #{ CLASS_REGEXP_STR } (?:[.#]|::)#{ METHOD_REGEXP_STR }
3636
37- # Stand-alone method (preceded by a #)
38- | \\ ?\# #{ METHOD_REGEXP_STR }
39-
40- # Stand-alone method (preceded by ::)
41- | ::#{ METHOD_REGEXP_STR }
42-
4337 # A::B::C
4438 # The stuff after CLASS_REGEXP_STR is a
4539 # nasty hack. CLASS_REGEXP_STR unfortunately matches
@@ -56,6 +50,12 @@ class RDoc::CrossReference
5650 # marker.
5751 | #{ CLASS_REGEXP_STR } (?=[@\s ).?!,;<\000 ]|\z )
5852
53+ # Stand-alone method (preceded by a #)
54+ | \\ ?\# #{ METHOD_REGEXP_STR }
55+
56+ # Stand-alone method (preceded by ::)
57+ | ::#{ METHOD_REGEXP_STR }
58+
5959 # Things that look like filenames
6060 # The key thing is that there must be at least
6161 # one special character (period, slash, or
@@ -82,12 +82,12 @@ class RDoc::CrossReference
8282 # A::B::C.meth
8383 #{ CLASS_REGEXP_STR } (?:[.#]|::)#{ METHOD_REGEXP_STR }
8484
85- # Stand-alone method
86- | \\ ?#{ METHOD_REGEXP_STR }
87-
8885 # A::B::C
8986 | #{ CLASS_REGEXP_STR } (?=[@\s ).?!,;<\000 ]|\z )
9087
88+ # Stand-alone method
89+ | \\ ?#{ METHOD_REGEXP_STR }
90+
9191 # Things that look like filenames
9292 | (?:\. \. \/ )*[-\/ \w ]+[_\/ .][-\w \/ .]+
9393
@@ -115,15 +115,8 @@ def initialize context
115115 @seen = { }
116116 end
117117
118- ##
119- # Returns a reference to +name+.
120- #
121- # If the reference is found and +name+ is not documented +text+ will be
122- # returned. If +name+ is escaped +name+ is returned. If +name+ is not
123- # found +text+ is returned.
124-
125- def resolve name , text
126- return @seen [ name ] if @seen . include? name
118+ def resolve_method name
119+ ref = nil
127120
128121 if /#{ CLASS_REGEXP_STR } ([.#]|::)#{ METHOD_REGEXP_STR } /o =~ name then
129122 type = $2
@@ -165,12 +158,27 @@ def resolve name, text
165158 end
166159 end
167160
161+ ref
162+ end
163+
164+ ##
165+ # Returns a reference to +name+.
166+ #
167+ # If the reference is found and +name+ is not documented +text+ will be
168+ # returned. If +name+ is escaped +name+ is returned. If +name+ is not
169+ # found +text+ is returned.
170+
171+ def resolve name , text
172+ return @seen [ name ] if @seen . include? name
173+
168174 ref = case name
169175 when /^\\ (#{ CLASS_REGEXP_STR } )$/o then
170176 @context . find_symbol $1
171177 else
172178 @context . find_symbol name
173- end unless ref
179+ end
180+
181+ ref = resolve_method name unless ref
174182
175183 # Try a page name
176184 ref = @store . page name if not ref and name =~ /^[\w .]+$/
0 commit comments