Skip to content

Commit 962e029

Browse files
authored
Merge pull request #471 from aycabta/stop-dropping-continuing-backslash
Stop dropping continuing backslash
2 parents 69222fd + cb349b1 commit 962e029

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/rdoc/ruby_lex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ def identify_string(ltype, quoted = ltype, type = nil)
12371237
elsif ch == '\\'
12381238
if %w[' /].include? @ltype then
12391239
case ch = getc
1240-
when "\\", "\n", "'"
1240+
when "\n", "'"
12411241
when @ltype
12421242
str << ch
12431243
else

test/test_rdoc_ruby_lex.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,17 @@ def test_class_tokenize_regexp_escape
339339
assert_equal expected, tokens
340340
end
341341

342+
def test_class_tokenize_regexp_continuing_backslash
343+
tokens = RDoc::RubyLex.tokenize "/(?<!\\\\)\\n\z/", nil
344+
345+
expected = [
346+
@TK::TkREGEXP.new( 0, 1, 0, "/(?<!\\\\)\\n\z/"),
347+
@TK::TkNL .new(12, 1, 12, "\n"),
348+
]
349+
350+
assert_equal expected, tokens
351+
end
352+
342353
def test_class_tokenize_string
343354
tokens = RDoc::RubyLex.tokenize "'hi'", nil
344355

0 commit comments

Comments
 (0)