From: Daniel Berger Date: 2007-03-20T23:55:37+09:00 Subject: Re: [ ruby-Bugs-4467 ] RDoc looks for doc headers at function prototypes noreply@rubyforge.org wrote: > Bugs item #4467, was opened at 2006-05-13 04:50 > You can respond by visiting: > http://rubyforge.org/tracker/?func=detail&atid=1698&aid=4467&group_id=426 > > Category: Standard Library > Group: None > Status: Open > Resolution: None > Priority: 3 > Submitted By: Tilman Sauerbeck (tilman) >> Assigned to: Eric Hodel (drbrain) > Summary: RDoc looks for doc headers at function prototypes > > Initial Comment: > RDoc looks for documentation chunks at function prototypes, too. > > So if you have the snippet of code below, it won't work correctly. > I expect RDoc to pick up the doc header from the implementation of the function, not from the prototype. This patch seems to do the trick: --- parse_c.orig Tue Mar 20 07:57:16 2007 +++ parse_c.rb Tue Mar 20 08:44:44 2007 @@ -626,10 +626,18 @@ def find_body(meth_name, meth_obj, body, quiet = false) case body when %r{((?>/\*.*?\*/\s*))(?:static\s+)?VALUE\s+#{meth_name} - \s*(\(.*?\)).*?^}xm + \s*(\(.*?\))(.).*?^}xm comment, params = $1, $2 body_text = $& + # If it's a function prototype rescan the body with the + # prototype text removed. + + if $3 == ';' + temp = body.gsub(body_text, '') + return find_body(meth_name, meth_obj, temp, quiet) + end + remove_private_comments(comment) if comment # see if we can find the whole body