From b4b9982e5dcf2956314e1ebedf7ebf5c5d143eaa Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 3 Mar 2023 12:09:43 +0900 Subject: [PATCH] Removed 3rd argument of Regexp.new. This argument is broken and deprecated Ruby 3.2. And this will be removed at Ruby 3.3. https://bugs.ruby-lang.org/issues/18797 --- lib/kpeg/grammar.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/kpeg/grammar.rb b/lib/kpeg/grammar.rb index fab8ad2..9038b7a 100644 --- a/lib/kpeg/grammar.rb +++ b/lib/kpeg/grammar.rb @@ -106,20 +106,10 @@ def initialize(reg, opts=nil) if reg.kind_of? String flags = 0 - lang = nil if opts opts.split("").each do |o| case o - when "n", "N", "e", "E", "s", "S" - lang = o.downcase - when "u", "U" - if RUBY_VERSION > "1.8.7" - # Ruby 1.9 defaults to UTF-8 for string matching - lang = "" - else - lang = "u" - end when "m" flags |= Regexp::MULTILINE when "x" @@ -130,7 +120,7 @@ def initialize(reg, opts=nil) end end - @regexp = Regexp.new(reg, flags, lang) + @regexp = Regexp.new(reg, flags) else @regexp = reg end