Skip to content

Commit 3364622

Browse files
committed
Fix escape in string
1 parent d0a599f commit 3364622

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/rdoc/ruby_lex.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,13 +1199,14 @@ def identify_string(ltype, quoted = ltype, type = nil)
11991199
ungetc
12001200
end
12011201
elsif ch == '\\'
1202-
if %w[' /].include? @ltype then
1202+
case @ltype
1203+
when "'" then
12031204
case ch = getc
1204-
when "\\", "\n", "'"
1205-
when @ltype
1205+
when "'", '\\' then
12061206
str << ch
12071207
else
1208-
ungetc
1208+
str << '\\'
1209+
str << ch
12091210
end
12101211
else
12111212
str << read_escape

0 commit comments

Comments
 (0)