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