Skip to content

Commit

Permalink
Merge pull request #58 from hsbt/remove-3rd-arg-regex
Browse files Browse the repository at this point in the history
Removed 3rd argument of Regexp.new.
  • Loading branch information
evanphx authored Mar 6, 2023
2 parents 9f65a94 + b4b9982 commit da08e46
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lib/kpeg/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit da08e46

Please sign in to comment.