diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-12-06 18:09:30 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-12-06 09:35:44 +0000 |
commit | e03e872eea75ee63672c755dccc340a1f6042fce (patch) | |
tree | c52ef0d3c15a543236e7775204c52cbd45425889 /lib/rdoc/parser | |
parent | 379f06797d563084ed28f397419f97b7d2e01d87 (diff) |
[ruby/rdoc] Only word-ending colon separates new definition
When followed by non-space characters, rather it looks like a URL or a
path name on Windows.
https://github.com/ruby/rdoc/commit/72c6560773
Diffstat (limited to 'lib/rdoc/parser')
-rw-r--r-- | lib/rdoc/parser/c.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 6436ef243a..5555818e9e 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -938,10 +938,10 @@ class RDoc::Parser::C < RDoc::Parser # "/* definition: comment */" form. The literal ':' and '\' characters # can be escaped with a backslash. if type.downcase == 'const' then - no_match, new_definition, new_comment = comment.text.split(/(\A.*):/) + if /\A(.+?)?:(?!\S)/ =~ comment.text + new_definition, new_comment = $1, $' - if no_match and no_match.empty? then - if new_definition.empty? then # Default to literal C definition + if !new_definition # Default to literal C definition new_definition = definition else new_definition = new_definition.gsub(/\\([\\:])/, '\1') |