summaryrefslogtreecommitdiff
path: root/tool/strip-rdoc.rb
diff options
context:
space:
mode:
author卜部昌平 <[email protected]>2020-12-26 14:45:57 +0900
committer卜部昌平 <[email protected]>2021-09-10 20:00:06 +0900
commitef7448359478a04d67a4a406cca1c8442b5e2f94 ()
treedbe2a89f17656c431ce51220a35a6f77cf8cb1a3 /tool/strip-rdoc.rb
parent94e5953b484517234ad476b1e179d1bdbcbafbd7 (diff)
tool/strip-rdoc.rb: optimize
This script is called from Doxygen many times. Worth optimising. [ci skip]
Notes: Merged: https://.com/ruby/ruby/pull/4815
-rwxr-xr-xtool/strip-rdoc.rb30
1 files changed, 9 insertions, 21 deletions
@@ -1,26 +1,14 @@
#!ruby
# Filter for preventing Doxygen from processing RDoc comments.
# Used by the Doxygen template.
-ARGF.binmode
-source = ARGF.read
-source = source.gsub(%r{/\*([!*])((?!\*/).+?)\*/}m) do |comment|
- marker, comment = $1, $2
- 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
- "/*#{marker}#{doxybody}*/"
-end
-print source