class Regexp::Parser

def options_group(token)

def options_group(token)
  positive, negative = token.text.split('-', 2)
  negative ||= ''
  self.switching_options = !token.text.include?(':')
  # TODO: change this -^ to token.type == :options_switch in v1.0.0
  new_options = active_opts.dup
  # Negative options have precedence. E.g. /(?i-i)a/ is case-sensitive.
  %w[i m x].each do |flag|
    new_options[flag.to_sym] = true if positive.include?(flag)
    new_options.delete(flag.to_sym) if negative.include?(flag)
  end
  # Any encoding flag overrides all previous encoding flags. If there are
  # multiple encoding flags in an options string, the last one wins.
  # E.g. /(?dau)\w/ matches UTF8 chars but /(?dua)\w/ only ASCII chars.
  if (flag = positive.reverse[/[adu]/])
    %w[a d u].each { |key| new_options.delete(key.to_sym) }
    new_options[flag.to_sym] = true
  end
  options_stack << new_options
  exp = Group::Options.new(token, active_opts)
  nest(exp)
end