Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rdoc/ruby_lex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions test/test_rdoc_ruby_lex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 "/(?<!\\\\)\\n\z/", nil

expected = [
@TK::TkREGEXP.new( 0, 1, 0, "/(?<!\\\\)\\n\z/"),
@TK::TkNL .new(12, 1, 12, "\n"),
]

assert_equal expected, tokens
end

def test_class_tokenize_string
tokens = RDoc::RubyLex.tokenize "'hi'", nil

Expand Down