From e2e70b76a76a3711663f6ff4500acc216946e24b Mon Sep 17 00:00:00 2001 From: Code Ass Date: Thu, 27 Jul 2017 01:31:46 +0900 Subject: [PATCH 1/2] Stop dropping \ after \ In string or regexp literal, \ is a escape character and continuing \ is dropped. This Pull Request stop the dropping. --- lib/rdoc/ruby_lex.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb index 7488b80773..fd26a0945d 100644 --- a/lib/rdoc/ruby_lex.rb +++ b/lib/rdoc/ruby_lex.rb @@ -1235,7 +1235,7 @@ def identify_string(ltype, quoted = ltype, type = nil) elsif ch == '\\' if %w[' /].include? @ltype then case ch = getc - when "\\", "\n", "'" + when "\n", "'" when @ltype str << ch else From cb349b1999d376fb9cb430c3e907be8b4aa34e90 Mon Sep 17 00:00:00 2001 From: Code Ass Date: Thu, 27 Jul 2017 01:44:42 +0900 Subject: [PATCH 2/2] Add test_class_tokenize_regexp_continuing_backslash --- test/test_rdoc_ruby_lex.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_rdoc_ruby_lex.rb b/test/test_rdoc_ruby_lex.rb index 5ded86fd8c..15367c17a0 100644 --- a/test/test_rdoc_ruby_lex.rb +++ b/test/test_rdoc_ruby_lex.rb @@ -339,6 +339,17 @@ def test_class_tokenize_regexp_escape assert_equal expected, tokens end + def test_class_tokenize_regexp_continuing_backslash + tokens = RDoc::RubyLex.tokenize "/(?