Module: Mail::Parsers::AddressListsParser

Extended by:
Mail::ParserTools
Defined in:
lib/mail/parsers/address_lists_parser.rb

Defined Under Namespace

Classes: AddressListStruct, AddressStruct

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Mail::ParserTools

chars

Class Attribute Details

._eof_actionsObject

Returns the value of attribute _eof_actions


31611
31612
31613
# File 'lib/mail/parsers/address_lists_parser.rb', line 31611

def _eof_actions
  @_eof_actions
end

._index_offsetsObject

Returns the value of attribute _index_offsets


1297
1298
1299
# File 'lib/mail/parsers/address_lists_parser.rb', line 1297

def _index_offsets
  @_index_offsets
end

._indiciesObject

Returns the value of attribute _indicies


1621
1622
1623
# File 'lib/mail/parsers/address_lists_parser.rb', line 1621

def _indicies
  @_indicies
end

._key_spansObject

Returns the value of attribute _key_spans


973
974
975
# File 'lib/mail/parsers/address_lists_parser.rb', line 973

def _key_spans
  @_key_spans
end

._trans_actionsObject

Returns the value of attribute _trans_actions


30980
30981
30982
# File 'lib/mail/parsers/address_lists_parser.rb', line 30980

def _trans_actions
  @_trans_actions
end

._trans_keysObject

Returns the value of attribute _trans_keys


15
16
17
# File 'lib/mail/parsers/address_lists_parser.rb', line 15

def _trans_keys
  @_trans_keys
end

._trans_targsObject

Returns the value of attribute _trans_targs


30349
30350
30351
# File 'lib/mail/parsers/address_lists_parser.rb', line 30349

def _trans_targs
  @_trans_targs
end

.en_comment_tailObject

Returns the value of attribute en_comment_tail


31948
31949
31950
# File 'lib/mail/parsers/address_lists_parser.rb', line 31948

def en_comment_tail
  @en_comment_tail
end

.en_mainObject

Returns the value of attribute en_main


31952
31953
31954
# File 'lib/mail/parsers/address_lists_parser.rb', line 31952

def en_main
  @en_main
end

.errorObject

Returns the value of attribute error


31943
31944
31945
# File 'lib/mail/parsers/address_lists_parser.rb', line 31943

def error
  @error
end

.first_finalObject

Returns the value of attribute first_final


31939
31940
31941
# File 'lib/mail/parsers/address_lists_parser.rb', line 31939

def first_final
  @first_final
end

.startObject

Returns the value of attribute start


31935
31936
31937
# File 'lib/mail/parsers/address_lists_parser.rb', line 31935

def start
  @start
end

Class Method Details

.parse(data) ⇒ Object


31956
31957
31958
31959
31960
31961
31962
31963
31964
31965
31966
31967
31968
31969
31970
31971
31972
31973
31974
31975
31976
31977
31978
31979
31980
31981
31982
31983
31984
31985
31986
31987
31988
31989
31990
31991
31992
31993
31994
31995
31996
31997
31998
31999
32000
32001
32002
32003
32004
32005
32006
32007
32008
32009
32010
32011
32012
32013
32014
32015
32016
32017
32018
32019
32020
32021
32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
32035
32036
32037
32038
32039
32040
32041
32042
32043
32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064
32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
32076
32077
32078
32079
32080
32081
32082
32083
32084
32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
32096
32097
32098
32099
32100
32101
32102
32103
32104
32105
32106
32107
32108
32109
32110
32111
32112
32113
32114
32115
32116
32117
32118
32119
32120
32121
32122
32123
32124
32125
32126
32127
32128
32129
32130
32131
32132
32133
32134
32135
32136
32137
32138
32139
32140
32141
32142
32143
32144
32145
32146
32147
32148
32149
32150
32151
32152
32153
32154
32155
32156
32157
32158
32159
32160
32161
32162
32163
32164
32165
32166
32167
32168
32169
32170
32171
32172
32173
32174
32175
32176
32177
32178
32179
32180
32181
32182
32183
32184
32185
32186
32187
32188
32189
32190
32191
32192
32193
32194
32195
32196
32197
32198
32199
32200
32201
32202
32203
32204
32205
32206
32207
32208
32209
32210
32211
32212
32213
32214
32215
32216
32217
32218
32219
32220
32221
32222
32223
32224
32225
32226
32227
32228
32229
32230
32231
32232
32233
32234
32235
32236
32237
32238
32239
32240
32241
32242
32243
32244
32245
32246
32247
32248
32249
32250
32251
32252
32253
32254
32255
32256
32257
32258
32259
32260
32261
32262
32263
32264
32265
32266
32267
32268
32269
32270
32271
32272
32273
32274
32275
32276
32277
32278
32279
32280
32281
32282
32283
32284
32285
32286
32287
32288
32289
32290
32291
32292
32293
32294
32295
32296
32297
32298
32299
32300
32301
32302
32303
32304
32305
32306
32307
32308
32309
32310
32311
32312
32313
32314
32315
32316
32317
32318
32319
32320
32321
32322
32323
32324
32325
32326
32327
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338
32339
32340
32341
32342
32343
32344
32345
32346
32347
32348
32349
32350
32351
32352
32353
32354
32355
32356
32357
32358
32359
32360
32361
32362
32363
32364
32365
32366
32367
32368
32369
32370
32371
32372
32373
32374
32375
32376
32377
32378
32379
32380
32381
32382
32383
32384
32385
32386
32387
32388
32389
32390
32391
32392
32393
32394
32395
32396
32397
32398
32399
32400
32401
32402
32403
32404
32405
32406
32407
32408
32409
32410
32411
32412
32413
32414
32415
32416
32417
32418
32419
32420
32421
32422
32423
32424
32425
32426
32427
32428
32429
32430
32431
32432
32433
32434
32435
32436
32437
32438
32439
32440
32441
32442
32443
32444
32445
32446
32447
32448
32449
32450
32451
32452
32453
32454
32455
32456
32457
32458
32459
32460
32461
32462
32463
32464
32465
32466
32467
32468
32469
32470
32471
32472
32473
32474
32475
32476
32477
32478
32479
32480
32481
32482
32483
32484
32485
32486
32487
32488
32489
32490
32491
32492
32493
32494
32495
32496
32497
32498
32499
32500
32501
32502
32503
32504
32505
32506
32507
32508
32509
32510
32511
32512
32513
32514
32515
32516
32517
32518
32519
32520
32521
32522
32523
32524
32525
32526
32527
32528
32529
32530
32531
32532
32533
32534
32535
32536
32537
32538
32539
32540
32541
32542
32543
32544
32545
32546
32547
32548
32549
32550
32551
32552
32553
32554
32555
32556
32557
32558
32559
32560
32561
32562
32563
32564
32565
32566
32567
32568
32569
32570
32571
32572
32573
32574
32575
32576
32577
32578
32579
32580
32581
32582
32583
32584
32585
32586
32587
32588
32589
32590
32591
32592
32593
32594
32595
32596
32597
32598
32599
32600
32601
32602
32603
32604
32605
32606
32607
32608
32609
32610
32611
32612
32613
32614
32615
32616
32617
32618
32619
32620
32621
32622
32623
32624
32625
32626
32627
32628
32629
32630
32631
32632
32633
32634
32635
32636
32637
32638
32639
32640
32641
32642
32643
32644
32645
32646
32647
32648
32649
32650
32651
32652
32653
32654
32655
32656
32657
32658
32659
32660
32661
32662
32663
32664
32665
32666
32667
32668
32669
32670
32671
32672
32673
32674
32675
32676
32677
32678
32679
32680
32681
32682
32683
32684
32685
32686
32687
32688
32689
32690
32691
32692
32693
32694
32695
32696
32697
32698
32699
32700
32701
32702
32703
32704
32705
32706
32707
32708
32709
32710
32711
32712
32713
32714
32715
32716
32717
32718
32719
32720
32721
32722
32723
32724
32725
32726
32727
32728
32729
32730
32731
32732
32733
32734
32735
32736
32737
32738
32739
32740
32741
32742
32743
32744
32745
32746
32747
32748
32749
32750
32751
32752
32753
32754
32755
32756
32757
32758
32759
32760
32761
32762
32763
32764
32765
32766
32767
32768
32769
32770
32771
32772
32773
32774
32775
32776
32777
32778
32779
32780
32781
32782
32783
32784
32785
32786
32787
32788
32789
32790
32791
32792
32793
32794
32795
32796
32797
32798
32799
32800
32801
32802
32803
32804
32805
32806
32807
32808
32809
32810
32811
32812
32813
32814
32815
32816
32817
32818
32819
32820
32821
32822
32823
32824
32825
32826
32827
32828
32829
32830
32831
32832
32833
32834
32835
32836
32837
32838
32839
32840
32841
32842
32843
32844
32845
32846
32847
32848
32849
32850
32851
32852
32853
32854
32855
32856
32857
32858
32859
32860
32861
32862
32863
32864
32865
32866
32867
32868
32869
32870
32871
32872
32873
32874
32875
32876
32877
32878
32879
32880
32881
32882
32883
32884
32885
32886
32887
32888
32889
32890
32891
32892
32893
32894
32895
32896
32897
32898
32899
32900
32901
32902
32903
32904
32905
32906
32907
32908
32909
32910
32911
32912
32913
32914
32915
32916
32917
32918
32919
32920
32921
32922
32923
32924
32925
32926
32927
32928
32929
32930
32931
32932
32933
32934
32935
32936
32937
32938
32939
32940
32941
32942
32943
32944
32945
32946
32947
32948
32949
32950
32951
32952
32953
32954
32955
32956
32957
32958
32959
32960
32961
32962
32963
32964
32965
32966
32967
32968
32969
32970
32971
32972
32973
32974
32975
32976
32977
32978
32979
32980
32981
32982
32983
32984
32985
32986
32987
32988
32989
32990
32991
32992
32993
32994
32995
32996
32997
32998
32999
33000
33001
33002
33003
33004
33005
33006
33007
33008
33009
33010
33011
33012
33013
33014
33015
33016
33017
33018
33019
33020
33021
33022
33023
33024
33025
33026
33027
33028
33029
33030
33031
33032
33033
33034
33035
33036
33037
33038
33039
33040
33041
33042
33043
33044
33045
33046
33047
33048
33049
33050
33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
33074
33075
33076
33077
33078
33079
33080
33081
33082
33083
33084
33085
33086
33087
33088
33089
33090
33091
33092
33093
33094
33095
33096
33097
33098
33099
33100
33101
33102
33103
33104
33105
33106
33107
33108
33109
33110
33111
33112
33113
33114
33115
33116
33117
33118
33119
33120
33121
33122
33123
33124
33125
33126
33127
33128
33129
33130
33131
33132
33133
33134
33135
33136
33137
33138
33139
33140
33141
33142
33143
33144
33145
33146
33147
33148
33149
33150
33151
33152
33153
33154
33155
33156
33157
33158
33159
33160
33161
33162
33163
33164
33165
33166
33167
33168
33169
33170
33171
33172
33173
33174
33175
33176
33177
33178
33179
33180
33181
33182
33183
33184
33185
33186
33187
33188
33189
33190
33191
33192
33193
33194
33195
33196
33197
33198
33199
33200
33201
33202
33203
33204
33205
33206
33207
33208
33209
33210
33211
33212
33213
33214
33215
33216
33217
33218
33219
33220
33221
33222
33223
33224
33225
33226
33227
33228
33229
33230
33231
33232
33233
33234
# File 'lib/mail/parsers/address_lists_parser.rb', line 31956

def self.parse(data)
  data = data.dup.force_encoding(Encoding::ASCII_8BIT) if data.respond_to?(:force_encoding)

  address_list = AddressListStruct.new([], [])
  return address_list if Mail::Utilities.blank?(data)

  phrase_s = phrase_e = qstr_s = qstr = comment_s = nil
  group_name_s = domain_s = group_name = nil
  local_dot_atom_s = local_dot_atom_e = nil
  local_dot_atom_pre_comment_e = nil
  obs_domain_list_s = nil

  address_s = 0
  address = AddressStruct.new(nil, nil, [], nil, nil, nil, 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 4
            begin
              phrase_e = p - 1
            end
          when 8
            begin
              qstr_s = p
            end
          when 10
            begin
              qstr = chars(data, qstr_s, p - 1)
            end
          when 59
            begin
              comment_s = p unless comment_s
            end
          when 12
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
          when 34
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 3
            begin
              if qstr
                address.display_name = Mail::Utilities.unescape(qstr)
                qstr = nil
              elsif phrase_e
                address.display_name = chars(data, phrase_s, phrase_e).strip
                phrase_e = phrase_s = nil
              end
            end
          when 43
            begin
              domain_s = p
            end
          when 54
            begin
              address.domain = chars(data, domain_s, p - 1).rstrip if address
            end
          when 1
            begin
              local_dot_atom_s = p
            end
          when 24
            begin
              local_dot_atom_e = p - 1
            end
          when 21
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
          when 50
            begin
              address.local = '"' + qstr + '"' if address
            end
          when 20
            begin
              obs_domain_list_s = p
            end
          when 2
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
          when 62
            begin
              begin
                top -= 1
                cs = stack[top]
                _goto_level = _again
                next
              end
            end
          when 6
            begin
              phrase_e = p - 1
            end
            begin
              if qstr
                group = qstr
                qstr = nil
              else
                group = chars(data, group_name_s, p - 1)
                group_name_s = nil
              end
              address_list.group_names << group
              group_name = group

              # Start next address
              address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
              address_s = p
              address.group = group_name
            end
          when 7
            begin
              phrase_e = p - 1
            end
            begin
              if qstr
                address.display_name = Mail::Utilities.unescape(qstr)
                qstr = nil
              elsif phrase_e
                address.display_name = chars(data, phrase_s, phrase_e).strip
                phrase_e = phrase_s = nil
              end
            end
          when 42
            begin
              phrase_e = p - 1
            end
            begin
              domain_s = p
            end
          when 30
            begin
              phrase_e = p - 1
            end
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
          when 9
            begin
              qstr_s = p
            end
            begin
              qstr = chars(data, qstr_s, p - 1)
            end
          when 60
            begin
              comment_s = p unless comment_s
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
          when 61
            begin
              comment_s = p unless comment_s
            end
            begin
              begin
                top -= 1
                cs = stack[top]
                _goto_level = _again
                next
              end
            end
          when 11
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              phrase_e = p - 1
            end
          when 35
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 17
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              if qstr
                address.display_name = Mail::Utilities.unescape(qstr)
                qstr = nil
              elsif phrase_e
                address.display_name = chars(data, phrase_s, phrase_e).strip
                phrase_e = phrase_s = nil
              end
            end
          when 55
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              address.domain = chars(data, domain_s, p - 1).rstrip if address
            end
          when 53
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_s = p
            end
          when 25
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_e = p - 1
            end
          when 52
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
          when 16
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
          when 29
            begin
              address_s = p
            end
            begin
              phrase_s = p
            end
          when 28
            begin
              address_s = p
            end
            begin
              if qstr
                address.display_name = Mail::Utilities.unescape(qstr)
                qstr = nil
              elsif phrase_e
                address.display_name = chars(data, phrase_s, phrase_e).strip
                phrase_e = phrase_s = nil
              end
            end
          when 48
            begin
              domain_s = p
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
          when 45
            begin
              address.domain = chars(data, domain_s, p - 1).rstrip if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 18
            begin
              local_dot_atom_s = p
            end
            begin
              obs_domain_list_s = p
            end
          when 33
            begin
              local_dot_atom_e = p - 1
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 39
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
          when 23
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              local_dot_atom_e = p - 1
            end
          when 22
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
          when 49
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 56
            begin
              address.obs_domain_list = chars(data, obs_domain_list_s, p - 1)
            end
            begin
              local_dot_atom_s = p
            end
          when 5
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              phrase_e = p - 1
            end
          when 14
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              phrase_e = p - 1
            end
            begin
              if qstr
                group = qstr
                qstr = nil
              else
                group = chars(data, group_name_s, p - 1)
                group_name_s = nil
              end
              address_list.group_names << group
              group_name = group

              # Start next address
              address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
              address_s = p
              address.group = group_name
            end
          when 15
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              phrase_e = p - 1
            end
            begin
              if qstr
                address.display_name = Mail::Utilities.unescape(qstr)
                qstr = nil
              elsif phrase_e
                address.display_name = chars(data, phrase_s, phrase_e).strip
                phrase_e = phrase_s = nil
              end
            end
          when 46
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              address.domain = chars(data, domain_s, p - 1).rstrip if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 47
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 41
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
          when 51
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 13
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              phrase_e = p - 1
            end
          when 65
            begin
              group_name_s = p
            end
            begin
              phrase_s = p
            end
            begin
              address_s = p
            end
          when 26
            begin
              address_s = p
            end
            begin
              phrase_s = p
            end
            begin
              local_dot_atom_s = p
            end
          when 19
            begin
              local_dot_atom_s = p
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              obs_domain_list_s = p
            end
          when 38
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 32
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 37
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
          when 57
            begin
              address.obs_domain_list = chars(data, obs_domain_list_s, p - 1)
            end
            begin
              local_dot_atom_s = p
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
          when 44
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              phrase_e = p - 1
            end
            begin
              domain_s = p
            end
          when 31
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              phrase_e = p - 1
            end
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
          when 40
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 63
            begin
              group_name_s = p
            end
            begin
              phrase_s = p
            end
            begin
              address_s = p
            end
            begin
              local_dot_atom_s = p
            end
          when 27
            begin
              address_s = p
            end
            begin
              phrase_s = p
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              local_dot_atom_s = p
            end
          when 36
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 58
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              address_s = p
            end
            begin
              phrase_s = p
            end
            begin
              local_dot_atom_s = p
            end
          when 64
            begin
              group_name_s = p
            end
            begin
              phrase_s = p
            end
            begin
              begin
                stack[top] = cs
                top += 1
                cs = 2449
                _goto_level = _again
                next
              end
            end
            begin
              address_s = p
            end
            begin
              local_dot_atom_s = p
            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 12
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
          when 34
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 35
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 45
            begin
              address.domain = chars(data, domain_s, p - 1).rstrip if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 33
            begin
              local_dot_atom_e = p - 1
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 49
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 46
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              address.domain = chars(data, domain_s, p - 1).rstrip if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 47
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 51
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 38
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 32
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 40
            begin
              if address
                address.comments << chars(data, comment_s, p - 2)
              end
              comment_s = nil
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          when 36
            begin
              local_dot_atom_pre_comment_e = p - 1
            end
            begin
              local_dot_atom_e = p - 1
            end
            begin
              address.local = '"' + qstr + '"' if address
            end
            begin
              if address_s
                if address.local.nil? && local_dot_atom_pre_comment_e && local_dot_atom_s && local_dot_atom_e
                  if address.domain
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_e)
                  else
                    address.local = chars(data, local_dot_atom_s, local_dot_atom_pre_comment_e)
                  end
                end
                address.raw = chars(data, address_s, p - 1)
                address_list.addresses << address if address

                # Start next address
                address = AddressStruct.new(nil, nil, [], nil, nil, nil, nil)
                address.group = group_name
                address_s = nil
              end
            end
          end
        end
      end
      if _goto_level <= _out
        break
      end
    end
  end

  if p != eof || cs < 2461
    raise Mail::Field::IncompleteParseError.new(Mail::AddressList, data, p)
  end

  address_list
end