diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 4a55eb0448..30d8dee5f1 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -927,6 +927,8 @@ def parse_constant_body container, constant # :nodoc: end when TkCOLON2, TkCOLON3 then rhs_name << '::' + when TkBACKSLASH then + get_tk if TkNL === peek_tk when nil then break end diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 9f5d48d01a..d728809e61 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2286,6 +2286,9 @@ class Foo SIXTH_CONSTANT = #{sixth_constant} SEVENTH_CONSTANT = proc { |i| begin i end } + + EIGHTH_CONSTANT = "a" \\ + "b" end EOF @@ -2331,6 +2334,11 @@ class Foo assert_equal 'SEVENTH_CONSTANT', constant.name assert_equal "proc { |i| begin i end }", constant.value assert_equal @top_level, constant.file + + constant = constants[7] + assert_equal 'EIGHTH_CONSTANT', constant.name + assert_equal "\"a\" \\\n\"b\"", constant.value + assert_equal @top_level, constant.file end def test_parse_statements_identifier_attr