mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
23 lines
444 B
Ruby
23 lines
444 B
Ruby
|
#!ruby
|
||
|
|
||
|
source = ARGF.read
|
||
|
source = source.gsub(%r{/\*\*((?!\*/).+?)\*/}m) do |comment|
|
||
|
comment = $1
|
||
|
next "/**#{comment}*/" unless /^\s*\*\s?\-\-\s*$/ =~ comment
|
||
|
doxybody = nil
|
||
|
comment.each_line do |line|
|
||
|
if doxybody
|
||
|
if /^\s*\*\s?\+\+\s*$/ =~ line
|
||
|
break
|
||
|
end
|
||
|
doxybody << line
|
||
|
else
|
||
|
if /^\s*\*\s?--\s*$/ =~ line
|
||
|
doxybody = "\n"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
"/**#{doxybody}*/"
|
||
|
end
|
||
|
print source
|