[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
This commit is contained in:
parent
379f06797d
commit
e03e872eea
@ -938,10 +938,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|||||||
# "/* definition: comment */" form. The literal ':' and '\' characters
|
# "/* definition: comment */" form. The literal ':' and '\' characters
|
||||||
# can be escaped with a backslash.
|
# can be escaped with a backslash.
|
||||||
if type.downcase == 'const' then
|
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 # Default to literal C definition
|
||||||
if new_definition.empty? then # Default to literal C definition
|
|
||||||
new_definition = definition
|
new_definition = definition
|
||||||
else
|
else
|
||||||
new_definition = new_definition.gsub(/\\([\\:])/, '\1')
|
new_definition = new_definition.gsub(/\\([\\:])/, '\1')
|
||||||
|
@ -475,6 +475,9 @@ void Init_foo(){
|
|||||||
/* TEST\:TEST: Checking to see if escaped colon works */
|
/* TEST\:TEST: Checking to see if escaped colon works */
|
||||||
rb_define_const(cFoo, "TEST", rb_str_new2("TEST:TEST"));
|
rb_define_const(cFoo, "TEST", rb_str_new2("TEST:TEST"));
|
||||||
|
|
||||||
|
/* TEST: TEST:Checking to see if only word-ending colon works */
|
||||||
|
rb_define_const(cFoo, "TEST2", rb_str_new2("TEST:TEST"));
|
||||||
|
|
||||||
/* \\: The file separator on MS Windows */
|
/* \\: The file separator on MS Windows */
|
||||||
rb_define_const(cFoo, "MSEPARATOR", rb_str_new2("\\"));
|
rb_define_const(cFoo, "MSEPARATOR", rb_str_new2("\\"));
|
||||||
|
|
||||||
@ -538,6 +541,9 @@ void Init_foo(){
|
|||||||
assert_equal ['TEST', 'TEST:TEST',
|
assert_equal ['TEST', 'TEST:TEST',
|
||||||
'Checking to see if escaped colon works '],
|
'Checking to see if escaped colon works '],
|
||||||
constants.shift
|
constants.shift
|
||||||
|
assert_equal ['TEST2', 'TEST',
|
||||||
|
'TEST:Checking to see if only word-ending colon works '],
|
||||||
|
constants.shift
|
||||||
assert_equal ['MSEPARATOR', '\\',
|
assert_equal ['MSEPARATOR', '\\',
|
||||||
'The file separator on MS Windows '],
|
'The file separator on MS Windows '],
|
||||||
constants.shift
|
constants.shift
|
||||||
|
Loading…
x
Reference in New Issue
Block a user