correct the dedup code

This commit is contained in:
Sam 2018-02-16 09:19:57 +11:00 committed by Rafael Mendonça França
parent 6781bd966d
commit 23c5558f37
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ module ActionDispatch
end
private
# takes advantage of String @- deduping capabilities in Ruby 2.5 upwards
# see: https://bugs.ruby-lang.org/issues/13077
def dedup_scan(regex)
@ -58,9 +58,9 @@ module ActionDispatch
[:SYMBOL, text]
when text = dedup_scan(/\*\w+/)
[:STAR, text]
when text = dedup_scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/)
when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/)
text.tr! "\\", ""
[:LITERAL, text]
[:LITERAL, -text]
# any char
when text = dedup_scan(/./)
[:LITERAL, text]