module Regexp::Expression::EscapeSequence

def char

Maybe this should be a unique top-level expression class?
def char
  raise NoMethodError, 'CodepointList responds only to #chars'
end

def chars

def chars
  codepoints.map { |cp| cp.chr('utf-8') }
end

def codepoint; 0x1B end }

def codepoint; 0x1B end }

def codepoint; 0x8 end }

def codepoint; 0x8  end }

def codepoint; 0x7 end }

def codepoint; 0x7  end }

def codepoint; 0xC end }

def codepoint; 0xC  end }

def codepoint; 0xA end }

def codepoint; 0xA  end }

def codepoint; 0xD end }

def codepoint; 0xD  end }

def codepoint; 0x9 end }

def codepoint; 0x9  end }

def codepoint; 0xB end }

def codepoint; 0xB  end }

def codepoint; text[1].ord end }

def codepoint; text[1].ord end }

def codepoint; text[/\d+/].to_i(8) end }

def codepoint; text[/\d+/].to_i(8) end }

def codepoint; text[/\h+/].hex end }

def codepoint; text[/\h+/].hex end }

def codepoint; text[/\h+/].hex end }

def codepoint; text[/\h+/].hex end }

def codepoint

def codepoint
  raise NoMethodError, 'CodepointList responds only to #codepoints'
end

def codepoint

def codepoint
  control_sequence_to_s(text).ord
end

def codepoint

def codepoint
  meta_char_to_codepoint(text[-1])
end

def codepoint

def codepoint
  meta_char_to_codepoint(control_sequence_to_s(text))
end

def codepoints

def codepoints
  text.scan(/\h+/).map(&:hex)
end

def control_sequence_to_s(control_sequence)

def control_sequence_to_s(control_sequence)
  five_lsb = control_sequence.unpack('B*').first[-5..-1]
  ["000#{five_lsb}"].pack('B*')
end

def meta_char_to_codepoint(meta_char)

def meta_char_to_codepoint(meta_char)
  byte_value = meta_char.ord
  byte_value < 128 ? byte_value + 128 : byte_value
end