Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed 3rd argument of Regexp.new. #58

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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