module Regexp::Parser

def self.parse_token(token)

def self.parse_token(token)
  case token.type
  when :meta;         meta(token)
  when :quantifier;   quantifier(token)
  when :anchor;       anchor(token)
  when :escape;       escape(token)
  when :group;        group(token)
  when :assertion;    group(token)
  when :set, :subset; set(token)
  when :type;         type(token)
  when :backref;      backref(token)
  when :conditional;  conditional(token)
  when :keep;         keep(token)
  when :property, :nonproperty
    property(token)
  when :literal
    @node << Literal.new(token)
  when :free_space
    free_space(token)
  else
    raise UnknownTokenTypeError.new(token.type, token)
  end
end