Skip to content

Commit a89ee95

Browse files
committed
Really fix regular expression to avoid overcapture
Previously there was a bogus .* in the regular expression that matched newlines which is bad and would cause RDoc to find the wrong comment (which was fixed by another .* removed in the previous commit). Now we remove these things properly. Fixes #327 (for real).
1 parent ee808bc commit a89ee95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rdoc/parser/c.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,10 @@ def find_class_comment class_name, class_mod
746746
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then
747747
comment = "/*\n#{$1}"
748748
elsif @content =~ %r%((?>/\*.*?\*/\s+))
749-
([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(#{class_name})"%xm then
749+
([\w\.\s]+\s* = \s+)?rb_define_(class|module)[\t (]*?"(#{class_name})"%xm then
750750
comment = $1
751751
elsif @content =~ %r%((?>/\*.*?\*/\s+))
752-
([\w\.\s]+\s* = \s+)?rb_define_(class|module)_under.*?"(#{class_name.split('::').last})"%xm then
752+
([\w\. \t]+ = \s+)?rb_define_(class|module)_under[\t (]*?"(#{class_name.split('::').last})"%xm then
753753
comment = $1
754754
else
755755
comment = ''

0 commit comments

Comments
 (0)