mail 2.5.5 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +8 -9
  3. data/CONTRIBUTING.md +13 -0
  4. data/Dependencies.txt +0 -1
  5. data/Gemfile +7 -24
  6. data/README.md +36 -15
  7. data/Rakefile +10 -2
  8. data/VERSION +4 -0
  9. data/lib/mail.rb +1 -1
  10. data/lib/mail/body.rb +2 -2
  11. data/lib/mail/check_delivery_params.rb +10 -47
  12. data/lib/mail/core_extensions/string.rb +12 -2
  13. data/lib/mail/elements/address.rb +38 -82
  14. data/lib/mail/elements/address_list.rb +19 -42
  15. data/lib/mail/elements/content_disposition_element.rb +3 -7
  16. data/lib/mail/elements/content_location_element.rb +2 -6
  17. data/lib/mail/elements/content_transfer_encoding_element.rb +3 -10
  18. data/lib/mail/elements/content_type_element.rb +4 -8
  19. data/lib/mail/elements/date_time_element.rb +3 -7
  20. data/lib/mail/elements/envelope_from_element.rb +3 -11
  21. data/lib/mail/elements/message_ids_element.rb +1 -6
  22. data/lib/mail/elements/mime_version_element.rb +3 -7
  23. data/lib/mail/elements/phrase_list.rb +2 -7
  24. data/lib/mail/elements/received_element.rb +3 -7
  25. data/lib/mail/encodings.rb +0 -1
  26. data/lib/mail/envelope.rb +0 -5
  27. data/lib/mail/field.rb +53 -17
  28. data/lib/mail/field_list.rb +18 -18
  29. data/lib/mail/fields/common/common_address.rb +15 -20
  30. data/lib/mail/fields/common/common_date.rb +0 -7
  31. data/lib/mail/fields/common/common_field.rb +1 -1
  32. data/lib/mail/fields/content_transfer_encoding_field.rb +0 -6
  33. data/lib/mail/fields/resent_sender_field.rb +1 -1
  34. data/lib/mail/fields/sender_field.rb +1 -1
  35. data/lib/mail/fields/unstructured_field.rb +7 -1
  36. data/lib/mail/header.rb +8 -22
  37. data/lib/mail/mail.rb +12 -0
  38. data/lib/mail/matchers/has_sent_mail.rb +34 -1
  39. data/lib/mail/message.rb +18 -11
  40. data/lib/mail/multibyte/unicode.rb +1 -1
  41. data/lib/mail/network/delivery_methods/exim.rb +10 -6
  42. data/lib/mail/network/delivery_methods/file_delivery.rb +8 -4
  43. data/lib/mail/network/delivery_methods/sendmail.rb +7 -9
  44. data/lib/mail/network/delivery_methods/smtp.rb +5 -2
  45. data/lib/mail/network/delivery_methods/smtp_connection.rb +6 -2
  46. data/lib/mail/network/delivery_methods/test_mailer.rb +8 -5
  47. data/lib/mail/network/retriever_methods/imap.rb +18 -13
  48. data/lib/mail/parsers.rb +26 -0
  49. data/lib/mail/parsers/address_lists_parser.rb +132 -0
  50. data/lib/mail/parsers/content_disposition_parser.rb +67 -0
  51. data/lib/mail/parsers/content_location_parser.rb +35 -0
  52. data/lib/mail/parsers/content_transfer_encoding_parser.rb +33 -0
  53. data/lib/mail/parsers/content_type_parser.rb +64 -0
  54. data/lib/mail/parsers/date_time_parser.rb +36 -0
  55. data/lib/mail/parsers/envelope_from_parser.rb +45 -0
  56. data/lib/mail/parsers/message_ids_parser.rb +39 -0
  57. data/lib/mail/parsers/mime_version_parser.rb +41 -0
  58. data/lib/mail/parsers/phrase_lists_parser.rb +33 -0
  59. data/lib/mail/parsers/ragel.rb +17 -0
  60. data/lib/mail/parsers/ragel/common.rl +184 -0
  61. data/lib/mail/parsers/ragel/date_time.rl +30 -0
  62. data/lib/mail/parsers/ragel/parser_info.rb +61 -0
  63. data/lib/mail/parsers/ragel/ruby.rb +29 -0
  64. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb +14864 -0
  65. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb.rl +37 -0
  66. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb +751 -0
  67. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb.rl +37 -0
  68. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb +614 -0
  69. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb.rl +37 -0
  70. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb +447 -0
  71. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl +37 -0
  72. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb +825 -0
  73. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb.rl +37 -0
  74. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb +817 -0
  75. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb.rl +37 -0
  76. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb +2129 -0
  77. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb.rl +37 -0
  78. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb +1570 -0
  79. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb.rl +37 -0
  80. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb +440 -0
  81. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb.rl +37 -0
  82. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb +564 -0
  83. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb.rl +37 -0
  84. data/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl +51 -0
  85. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb +5144 -0
  86. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb.rl +37 -0
  87. data/lib/mail/parsers/ragel/ruby/parser.rb.rl.erb +37 -0
  88. data/lib/mail/parsers/received_parser.rb +47 -0
  89. data/lib/mail/parts_list.rb +4 -2
  90. data/lib/mail/patterns.rb +3 -1
  91. data/lib/mail/utilities.rb +3 -1
  92. data/lib/mail/version.rb +1 -1
  93. data/lib/mail/version_specific/ruby_1_8.rb +1 -1
  94. data/lib/mail/version_specific/ruby_1_9.rb +13 -1
  95. metadata +55 -51
  96. data/lib/VERSION +0 -4
  97. data/lib/load_parsers.rb +0 -35
  98. data/lib/mail/parsers/address_lists.rb +0 -64
  99. data/lib/mail/parsers/address_lists.treetop +0 -19
  100. data/lib/mail/parsers/content_disposition.rb +0 -535
  101. data/lib/mail/parsers/content_disposition.treetop +0 -46
  102. data/lib/mail/parsers/content_location.rb +0 -139
  103. data/lib/mail/parsers/content_location.treetop +0 -20
  104. data/lib/mail/parsers/content_transfer_encoding.rb +0 -201
  105. data/lib/mail/parsers/content_transfer_encoding.treetop +0 -18
  106. data/lib/mail/parsers/content_type.rb +0 -971
  107. data/lib/mail/parsers/content_type.treetop +0 -68
  108. data/lib/mail/parsers/date_time.rb +0 -114
  109. data/lib/mail/parsers/date_time.treetop +0 -11
  110. data/lib/mail/parsers/envelope_from.rb +0 -194
  111. data/lib/mail/parsers/envelope_from.treetop +0 -32
  112. data/lib/mail/parsers/message_ids.rb +0 -45
  113. data/lib/mail/parsers/message_ids.treetop +0 -15
  114. data/lib/mail/parsers/mime_version.rb +0 -144
  115. data/lib/mail/parsers/mime_version.treetop +0 -19
  116. data/lib/mail/parsers/phrase_lists.rb +0 -45
  117. data/lib/mail/parsers/phrase_lists.treetop +0 -15
  118. data/lib/mail/parsers/received.rb +0 -71
  119. data/lib/mail/parsers/received.treetop +0 -11
  120. data/lib/mail/parsers/rfc2045.rb +0 -421
  121. data/lib/mail/parsers/rfc2045.treetop +0 -35
  122. data/lib/mail/parsers/rfc2822.rb +0 -5397
  123. data/lib/mail/parsers/rfc2822.treetop +0 -408
  124. data/lib/mail/parsers/rfc2822_obsolete.rb +0 -3768
  125. data/lib/mail/parsers/rfc2822_obsolete.treetop +0 -241
  126. data/lib/tasks/corpus.rake +0 -125
  127. data/lib/tasks/treetop.rake +0 -10
@@ -0,0 +1,37 @@
1
+ %%{
2
+ machine content_location;
3
+
4
+ include rb_actions "rb_actions.rl";
5
+ include common "../../common.rl";
6
+
7
+ getkey data_unpacked[p];
8
+
9
+ main := content_location;
10
+ }%%
11
+
12
+ module Mail
13
+ module Parsers
14
+ module Ragel
15
+ module ContentLocationMachine
16
+ %%write data;
17
+
18
+ def self.parse(data)
19
+ p = 0
20
+ eof = data.length
21
+ stack = []
22
+
23
+ actions = []
24
+ data_unpacked = data.bytes.to_a
25
+ %%write init;
26
+ %%write exec;
27
+
28
+ if p == eof && cs >= %%{ write first_final; }%%
29
+ return actions, nil
30
+ else
31
+ return [], "Only able to parse up to #{data[0..p]}"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,447 @@
1
+
2
+ # line 1 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl"
3
+
4
+ # line 10 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl"
5
+
6
+
7
+ module Mail
8
+ module Parsers
9
+ module Ragel
10
+ module ContentTransferEncodingMachine
11
+
12
+ # line 13 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb"
13
+ class << self
14
+ attr_accessor :_content_transfer_encoding_trans_keys
15
+ private :_content_transfer_encoding_trans_keys, :_content_transfer_encoding_trans_keys=
16
+ end
17
+ self._content_transfer_encoding_trans_keys = [
18
+ 0, 0, 9, 126, 10, 10,
19
+ 9, 32, 10, 10, 9,
20
+ 32, 10, 10, 9, 32,
21
+ 9, 126, 1, 127, 1, 127,
22
+ 10, 10, 9, 32, -128,
23
+ -1, 9, 126, 9, 59,
24
+ 9, 59, 9, 40, 9, 40,
25
+ 0, 0, 0
26
+ ]
27
+
28
+ class << self
29
+ attr_accessor :_content_transfer_encoding_key_spans
30
+ private :_content_transfer_encoding_key_spans, :_content_transfer_encoding_key_spans=
31
+ end
32
+ self._content_transfer_encoding_key_spans = [
33
+ 0, 118, 1, 24, 1, 24, 1, 24,
34
+ 118, 127, 127, 1, 24, 128, 118, 51,
35
+ 51, 32, 32, 0
36
+ ]
37
+
38
+ class << self
39
+ attr_accessor :_content_transfer_encoding_index_offsets
40
+ private :_content_transfer_encoding_index_offsets, :_content_transfer_encoding_index_offsets=
41
+ end
42
+ self._content_transfer_encoding_index_offsets = [
43
+ 0, 0, 119, 121, 146, 148, 173, 175,
44
+ 200, 319, 447, 575, 577, 602, 731, 850,
45
+ 902, 954, 987, 1020
46
+ ]
47
+
48
+ class << self
49
+ attr_accessor :_content_transfer_encoding_indicies
50
+ private :_content_transfer_encoding_indicies, :_content_transfer_encoding_indicies=
51
+ end
52
+ self._content_transfer_encoding_indicies = [
53
+ 0, 1, 1, 1, 2, 1, 1, 1,
54
+ 1, 1, 1, 1, 1, 1, 1, 1,
55
+ 1, 1, 1, 1, 1, 1, 1, 0,
56
+ 3, 3, 3, 3, 3, 3, 3, 4,
57
+ 1, 3, 3, 3, 3, 3, 1, 3,
58
+ 3, 3, 3, 3, 3, 3, 3, 3,
59
+ 3, 1, 1, 1, 1, 1, 1, 1,
60
+ 3, 3, 3, 3, 3, 3, 3, 3,
61
+ 3, 3, 3, 3, 3, 3, 3, 3,
62
+ 3, 3, 3, 3, 3, 3, 3, 3,
63
+ 3, 3, 1, 1, 1, 3, 3, 3,
64
+ 3, 3, 3, 3, 3, 3, 3, 3,
65
+ 3, 3, 3, 3, 3, 3, 3, 3,
66
+ 3, 3, 3, 3, 3, 3, 3, 3,
67
+ 3, 3, 3, 3, 3, 3, 1, 5,
68
+ 1, 0, 1, 1, 1, 1, 1, 1,
69
+ 1, 1, 1, 1, 1, 1, 1, 1,
70
+ 1, 1, 1, 1, 1, 1, 1, 1,
71
+ 0, 1, 6, 1, 7, 1, 1, 1,
72
+ 1, 1, 1, 1, 1, 1, 1, 1,
73
+ 1, 1, 1, 1, 1, 1, 1, 1,
74
+ 1, 1, 1, 7, 1, 8, 1, 9,
75
+ 1, 1, 1, 1, 1, 1, 1, 1,
76
+ 1, 1, 1, 1, 1, 1, 1, 1,
77
+ 1, 1, 1, 1, 1, 1, 9, 1,
78
+ 10, 1, 1, 1, 11, 1, 1, 1,
79
+ 1, 1, 1, 1, 1, 1, 1, 1,
80
+ 1, 1, 1, 1, 1, 1, 1, 10,
81
+ 12, 12, 12, 12, 12, 12, 12, 13,
82
+ 1, 12, 12, 12, 12, 12, 1, 12,
83
+ 12, 12, 12, 12, 12, 12, 12, 12,
84
+ 12, 1, 1, 1, 1, 1, 1, 1,
85
+ 12, 12, 12, 12, 12, 12, 12, 12,
86
+ 12, 12, 12, 12, 12, 12, 12, 12,
87
+ 12, 12, 12, 12, 12, 12, 12, 12,
88
+ 12, 12, 1, 1, 1, 12, 12, 12,
89
+ 12, 12, 12, 12, 12, 12, 12, 12,
90
+ 12, 12, 12, 12, 12, 12, 12, 12,
91
+ 12, 12, 12, 12, 12, 12, 12, 12,
92
+ 12, 12, 12, 12, 12, 12, 1, 14,
93
+ 14, 14, 14, 14, 14, 14, 14, 14,
94
+ 1, 14, 14, 15, 14, 14, 14, 14,
95
+ 14, 14, 14, 14, 14, 14, 14, 14,
96
+ 14, 14, 14, 14, 14, 14, 14, 14,
97
+ 14, 14, 14, 14, 14, 14, 16, 17,
98
+ 14, 14, 14, 14, 14, 14, 14, 14,
99
+ 14, 14, 14, 14, 14, 14, 14, 14,
100
+ 14, 14, 14, 14, 14, 14, 14, 14,
101
+ 14, 14, 14, 14, 14, 14, 14, 14,
102
+ 14, 14, 14, 14, 14, 14, 14, 14,
103
+ 14, 14, 14, 14, 14, 14, 14, 14,
104
+ 14, 14, 18, 14, 14, 14, 14, 14,
105
+ 14, 14, 14, 14, 14, 14, 14, 14,
106
+ 14, 14, 14, 14, 14, 14, 14, 14,
107
+ 14, 14, 14, 14, 14, 14, 14, 14,
108
+ 14, 14, 14, 14, 14, 14, 1, 19,
109
+ 19, 19, 19, 19, 19, 19, 19, 19,
110
+ 1, 19, 19, 20, 19, 19, 19, 19,
111
+ 19, 19, 19, 19, 19, 19, 19, 19,
112
+ 19, 19, 19, 19, 19, 19, 19, 19,
113
+ 19, 19, 19, 19, 19, 19, 21, 22,
114
+ 19, 19, 19, 19, 19, 19, 19, 19,
115
+ 19, 19, 19, 19, 19, 19, 19, 19,
116
+ 19, 19, 19, 19, 19, 19, 19, 19,
117
+ 19, 19, 19, 19, 19, 19, 19, 19,
118
+ 19, 19, 19, 19, 19, 19, 19, 19,
119
+ 19, 19, 19, 19, 19, 19, 19, 19,
120
+ 19, 19, 23, 19, 19, 19, 19, 19,
121
+ 19, 19, 19, 19, 19, 19, 19, 19,
122
+ 19, 19, 19, 19, 19, 19, 19, 19,
123
+ 19, 19, 19, 19, 19, 19, 19, 19,
124
+ 19, 19, 19, 19, 19, 19, 1, 24,
125
+ 1, 19, 1, 1, 1, 1, 1, 1,
126
+ 1, 1, 1, 1, 1, 1, 1, 1,
127
+ 1, 1, 1, 1, 1, 1, 1, 1,
128
+ 19, 1, 1, 1, 1, 1, 1, 1,
129
+ 1, 1, 1, 1, 1, 1, 1, 1,
130
+ 1, 1, 1, 1, 1, 1, 1, 1,
131
+ 1, 1, 1, 1, 1, 1, 1, 1,
132
+ 1, 1, 1, 1, 1, 1, 1, 1,
133
+ 1, 1, 1, 1, 1, 1, 1, 1,
134
+ 1, 1, 1, 1, 1, 1, 1, 1,
135
+ 1, 1, 1, 1, 1, 1, 1, 1,
136
+ 1, 1, 1, 1, 1, 1, 1, 1,
137
+ 1, 1, 1, 1, 1, 1, 1, 1,
138
+ 1, 1, 1, 1, 1, 1, 1, 1,
139
+ 1, 1, 1, 1, 1, 1, 1, 1,
140
+ 1, 1, 1, 1, 1, 1, 1, 1,
141
+ 1, 1, 1, 1, 1, 1, 1, 1,
142
+ 1, 1, 1, 1, 1, 1, 1, 1,
143
+ 1, 1, 1, 1, 1, 1, 1, 1,
144
+ 1, 1, 19, 25, 1, 1, 1, 26,
145
+ 1, 1, 1, 1, 1, 1, 1, 1,
146
+ 1, 1, 1, 1, 1, 1, 1, 1,
147
+ 1, 1, 25, 27, 27, 27, 27, 27,
148
+ 27, 27, 28, 1, 27, 27, 27, 27,
149
+ 27, 1, 27, 27, 27, 27, 27, 27,
150
+ 27, 27, 27, 27, 1, 29, 1, 1,
151
+ 1, 1, 1, 27, 27, 27, 27, 27,
152
+ 27, 27, 27, 27, 27, 27, 27, 27,
153
+ 27, 27, 27, 27, 27, 27, 27, 27,
154
+ 27, 27, 27, 27, 27, 1, 1, 1,
155
+ 27, 27, 27, 27, 27, 27, 27, 27,
156
+ 27, 27, 27, 27, 27, 27, 27, 27,
157
+ 27, 27, 27, 27, 27, 27, 27, 27,
158
+ 27, 27, 27, 27, 27, 27, 27, 27,
159
+ 27, 1, 7, 1, 1, 1, 30, 1,
160
+ 1, 1, 1, 1, 1, 1, 1, 1,
161
+ 1, 1, 1, 1, 1, 1, 1, 1,
162
+ 1, 7, 1, 1, 1, 1, 1, 1,
163
+ 1, 31, 1, 1, 1, 1, 1, 1,
164
+ 1, 1, 1, 1, 1, 1, 1, 1,
165
+ 1, 1, 1, 1, 9, 1, 32, 1,
166
+ 1, 1, 33, 1, 1, 1, 1, 1,
167
+ 1, 1, 1, 1, 1, 1, 1, 1,
168
+ 1, 1, 1, 1, 1, 32, 1, 1,
169
+ 1, 1, 1, 1, 1, 34, 1, 1,
170
+ 1, 1, 1, 1, 1, 1, 1, 1,
171
+ 1, 1, 1, 1, 1, 1, 1, 1,
172
+ 35, 1, 9, 1, 1, 1, 36, 1,
173
+ 1, 1, 1, 1, 1, 1, 1, 1,
174
+ 1, 1, 1, 1, 1, 1, 1, 1,
175
+ 1, 9, 1, 1, 1, 1, 1, 1,
176
+ 1, 37, 1, 35, 1, 1, 1, 38,
177
+ 1, 1, 1, 1, 1, 1, 1, 1,
178
+ 1, 1, 1, 1, 1, 1, 1, 1,
179
+ 1, 1, 35, 1, 1, 1, 1, 1,
180
+ 1, 1, 39, 1, 1, 0
181
+ ]
182
+
183
+ class << self
184
+ attr_accessor :_content_transfer_encoding_trans_targs
185
+ private :_content_transfer_encoding_trans_targs, :_content_transfer_encoding_trans_targs=
186
+ end
187
+ self._content_transfer_encoding_trans_targs = [
188
+ 1, 0, 2, 14, 8, 3, 5, 15,
189
+ 7, 17, 1, 2, 14, 8, 10, 11,
190
+ 10, 19, 13, 10, 11, 10, 19, 13,
191
+ 12, 15, 4, 14, 16, 17, 4, 16,
192
+ 15, 4, 16, 17, 6, 18, 6, 18
193
+ ]
194
+
195
+ class << self
196
+ attr_accessor :_content_transfer_encoding_trans_actions
197
+ private :_content_transfer_encoding_trans_actions, :_content_transfer_encoding_trans_actions=
198
+ end
199
+ self._content_transfer_encoding_trans_actions = [
200
+ 0, 0, 0, 1, 2, 0, 0, 0,
201
+ 0, 0, 3, 3, 4, 5, 6, 6,
202
+ 7, 8, 6, 0, 0, 2, 9, 0,
203
+ 0, 10, 10, 0, 11, 10, 0, 2,
204
+ 3, 3, 5, 3, 0, 2, 3, 5
205
+ ]
206
+
207
+ class << self
208
+ attr_accessor :_content_transfer_encoding_eof_actions
209
+ private :_content_transfer_encoding_eof_actions, :_content_transfer_encoding_eof_actions=
210
+ end
211
+ self._content_transfer_encoding_eof_actions = [
212
+ 0, 0, 0, 0, 0, 0, 0, 0,
213
+ 0, 0, 0, 0, 0, 0, 10, 0,
214
+ 3, 0, 3, 0
215
+ ]
216
+
217
+ class << self
218
+ attr_accessor :content_transfer_encoding_start
219
+ end
220
+ self.content_transfer_encoding_start = 1;
221
+ class << self
222
+ attr_accessor :content_transfer_encoding_first_final
223
+ end
224
+ self.content_transfer_encoding_first_final = 14;
225
+ class << self
226
+ attr_accessor :content_transfer_encoding_error
227
+ end
228
+ self.content_transfer_encoding_error = 0;
229
+
230
+ class << self
231
+ attr_accessor :content_transfer_encoding_en_comment_tail
232
+ end
233
+ self.content_transfer_encoding_en_comment_tail = 9;
234
+ class << self
235
+ attr_accessor :content_transfer_encoding_en_main
236
+ end
237
+ self.content_transfer_encoding_en_main = 1;
238
+
239
+
240
+ # line 17 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl"
241
+
242
+ def self.parse(data)
243
+ p = 0
244
+ eof = data.length
245
+ stack = []
246
+
247
+ actions = []
248
+ data_unpacked = data.bytes.to_a
249
+
250
+ # line 251 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb"
251
+ begin
252
+ p ||= 0
253
+ pe ||= data.length
254
+ cs = content_transfer_encoding_start
255
+ top = 0
256
+ end
257
+
258
+ # line 26 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl"
259
+
260
+ # line 261 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb"
261
+ begin
262
+ testEof = false
263
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
264
+ _goto_level = 0
265
+ _resume = 10
266
+ _eof_trans = 15
267
+ _again = 20
268
+ _test_eof = 30
269
+ _out = 40
270
+ while true
271
+ if _goto_level <= 0
272
+ if p == pe
273
+ _goto_level = _test_eof
274
+ next
275
+ end
276
+ if cs == 0
277
+ _goto_level = _out
278
+ next
279
+ end
280
+ end
281
+ if _goto_level <= _resume
282
+ _keys = cs << 1
283
+ _inds = _content_transfer_encoding_index_offsets[cs]
284
+ _slen = _content_transfer_encoding_key_spans[cs]
285
+ _trans = if ( _slen > 0 &&
286
+ _content_transfer_encoding_trans_keys[_keys] <= ( data_unpacked[p]) &&
287
+ ( data_unpacked[p]) <= _content_transfer_encoding_trans_keys[_keys + 1]
288
+ ) then
289
+ _content_transfer_encoding_indicies[ _inds + ( data_unpacked[p]) - _content_transfer_encoding_trans_keys[_keys] ]
290
+ else
291
+ _content_transfer_encoding_indicies[ _inds + _slen ]
292
+ end
293
+ cs = _content_transfer_encoding_trans_targs[_trans]
294
+ if _content_transfer_encoding_trans_actions[_trans] != 0
295
+ case _content_transfer_encoding_trans_actions[_trans]
296
+ when 3 then
297
+ # line 7 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
298
+ begin
299
+ actions.push(4, p) end
300
+ when 6 then
301
+ # line 8 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
302
+ begin
303
+ actions.push(5, p) end
304
+ when 10 then
305
+ # line 17 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
306
+ begin
307
+ actions.push(14, p) end
308
+ when 1 then
309
+ # line 18 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
310
+ begin
311
+ actions.push(15, p) end
312
+ when 2 then
313
+ # line 5 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/../../common.rl"
314
+ begin
315
+ begin
316
+ stack[top] = cs
317
+ top+= 1
318
+ cs = 9
319
+ _goto_level = _again
320
+ next
321
+ end
322
+ end
323
+ when 9 then
324
+ # line 6 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/../../common.rl"
325
+ begin
326
+ begin
327
+ top -= 1
328
+ cs = stack[top]
329
+ _goto_level = _again
330
+ next
331
+ end
332
+ end
333
+ when 4 then
334
+ # line 7 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
335
+ begin
336
+ actions.push(4, p) end
337
+ # line 18 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
338
+ begin
339
+ actions.push(15, p) end
340
+ when 5 then
341
+ # line 7 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
342
+ begin
343
+ actions.push(4, p) end
344
+ # line 5 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/../../common.rl"
345
+ begin
346
+ begin
347
+ stack[top] = cs
348
+ top+= 1
349
+ cs = 9
350
+ _goto_level = _again
351
+ next
352
+ end
353
+ end
354
+ when 7 then
355
+ # line 8 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
356
+ begin
357
+ actions.push(5, p) end
358
+ # line 5 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/../../common.rl"
359
+ begin
360
+ begin
361
+ stack[top] = cs
362
+ top+= 1
363
+ cs = 9
364
+ _goto_level = _again
365
+ next
366
+ end
367
+ end
368
+ when 8 then
369
+ # line 8 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
370
+ begin
371
+ actions.push(5, p) end
372
+ # line 6 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/../../common.rl"
373
+ begin
374
+ begin
375
+ top -= 1
376
+ cs = stack[top]
377
+ _goto_level = _again
378
+ next
379
+ end
380
+ end
381
+ when 11 then
382
+ # line 17 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
383
+ begin
384
+ actions.push(14, p) end
385
+ # line 5 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/../../common.rl"
386
+ begin
387
+ begin
388
+ stack[top] = cs
389
+ top+= 1
390
+ cs = 9
391
+ _goto_level = _again
392
+ next
393
+ end
394
+ end
395
+ # line 396 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb"
396
+ end
397
+ end
398
+ end
399
+ if _goto_level <= _again
400
+ if cs == 0
401
+ _goto_level = _out
402
+ next
403
+ end
404
+ p += 1
405
+ if p != pe
406
+ _goto_level = _resume
407
+ next
408
+ end
409
+ end
410
+ if _goto_level <= _test_eof
411
+ if p == eof
412
+ case _content_transfer_encoding_eof_actions[cs]
413
+ when 3 then
414
+ # line 7 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
415
+ begin
416
+ actions.push(4, p) end
417
+ when 10 then
418
+ # line 17 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl"
419
+ begin
420
+ actions.push(14, p) end
421
+ # line 422 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb"
422
+ end
423
+ end
424
+
425
+ end
426
+ if _goto_level <= _out
427
+ break
428
+ end
429
+ end
430
+ end
431
+
432
+ # line 27 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl"
433
+
434
+ if p == eof && cs >=
435
+ # line 436 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb"
436
+ 14
437
+ # line 28 "/home/bpot/src/gh/bpot/mail/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl"
438
+
439
+ return actions, nil
440
+ else
441
+ return [], "Only able to parse up to #{data[0..p]}"
442
+ end
443
+ end
444
+ end
445
+ end
446
+ end
447
+ end