Skip to content

Commit f216ec4

Browse files
committed
Fix percent literal with the same sign of original
In identify_string method, percent literal is detected by literal type and quote sign. So %r/regexp/ is treated as /regexp/, because literal type is regexp and quote sign is /, it's the same. This commit fix it by checking "type" argument what is given only when percent literal.
1 parent 1261ff6 commit f216ec4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rdoc/ruby_lex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ def identify_string(ltype, quoted = ltype, type = nil)
13061306
@ltype = ltype
13071307
@quoted = quoted
13081308

1309-
str = if ltype == quoted and %w[" ' /].include? ltype then
1309+
str = if ltype == quoted and %w[" ' / `].include? ltype and type.nil? then
13101310
ltype.dup
13111311
else
13121312
"%#{type}#{PERCENT_PAREN_REV[quoted]||quoted}"

0 commit comments

Comments
 (0)