class Regexp::Parser

def parse(input, syntax = "ruby/#{RUBY_VERSION}", &block)

def parse(input, syntax = "ruby/#{RUBY_VERSION}", &block)
  root = Root.new(options_from_input(input))
  self.root = root
  self.node = root
  self.nesting = [root]
  self.options_stack = [root.options]
  self.switching_options = false
  self.conditional_nesting = []
  Regexp::Lexer.scan(input, syntax) do |token|
    parse_token(token)
  end
  if block_given?
    block.call(root)
  else
    root
  end
end