module Mail::Parsers::MessageIdsParser
def self.parse(data)
def self.parse(data) data = data.dup.force_encoding(Encoding::ASCII_8BIT) if data.respond_to?(:force_encoding) raise Mail::Field::NilParseError.new(Mail::MessageIdsElement) if data.nil? # Parser state message_ids = MessageIdsStruct.new([]) msg_id_s = nil # 5.1 Variables Used by Ragel p = 0 eof = pe = data.length stack = [] begin p ||= 0 pe ||= data.length cs = start top = 0 end begin testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 _eof_trans = 15 _again = 20 _test_eof = 30 _out = 40 while true if _goto_level <= 0 if p == pe _goto_level = _test_eof next end if cs == 0 _goto_level = _out next end end if _goto_level <= _resume _keys = cs << 1 _inds = _index_offsets[cs] _slen = _key_spans[cs] _wide = data[p].ord _trans = if (_slen > 0 && _trans_keys[_keys] <= _wide && _wide <= _trans_keys[_keys + 1]) _indicies[_inds + _wide - _trans_keys[_keys]] else _indicies[_inds + _slen] end cs = _trans_targs[_trans] if _trans_actions[_trans] != 0 case _trans_actions[_trans] when 1 begin msg_id_s = p end when 30 begin id = chars(data, msg_id_s, p - 1) id = $1 if id =~ /.*<(.*)>.*/ message_ids.message_ids << id end when 9 begin end when 26 begin end when 14 begin end when 12 begin end when 8 begin end when 5 begin end when 3 begin end when 18 begin end when 16 begin end when 22 begin end when 2 begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 29 begin begin top -= 1 cs = stack[top] _goto_level = _again next end end when 32 begin id = chars(data, msg_id_s, p - 1) id = $1 if id =~ /.*<(.*)>.*/ message_ids.message_ids << id end begin msg_id_s = p end when 31 begin id = chars(data, msg_id_s, p - 1) id = $1 if id =~ /.*<(.*)>.*/ message_ids.message_ids << id end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 25 begin end begin msg_id_s = p end when 15 begin end begin end when 11 begin end begin end when 24 begin end begin end when 23 begin end begin end when 10 begin end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 27 begin end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 28 begin end begin begin top -= 1 cs = stack[top] _goto_level = _again next end end when 13 begin end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 20 begin end begin end when 33 begin end begin id = chars(data, msg_id_s, p - 1) id = $1 if id =~ /.*<(.*)>.*/ message_ids.message_ids << id end when 7 begin end begin end when 6 begin end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 4 begin end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end when 17 begin end begin end when 21 begin end begin end begin end when 19 begin end begin end begin end when 34 begin end begin begin stack[top] = cs top += 1 cs = 306 _goto_level = _again next end end begin id = chars(data, msg_id_s, p - 1) id = $1 if id =~ /.*<(.*)>.*/ message_ids.message_ids << id end end end end if _goto_level <= _again if cs == 0 _goto_level = _out next end p += 1 if p != pe _goto_level = _resume next end end if _goto_level <= _test_eof if p == eof case _eof_actions[cs] when 30 begin id = chars(data, msg_id_s, p - 1) id = $1 if id =~ /.*<(.*)>.*/ message_ids.message_ids << id end when 9 begin end end end end if _goto_level <= _out break end end end if p != eof || cs < 318 raise Mail::Field::IncompleteParseError.new(Mail::MessageIdsElement, data, p) end message_ids end