mail 2.5.5 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +1 -1
- data/README.md +170 -108
- data/lib/mail/attachments_list.rb +13 -10
- data/lib/mail/body.rb +105 -91
- data/lib/mail/check_delivery_params.rb +30 -22
- data/lib/mail/configuration.rb +3 -0
- data/lib/mail/constants.rb +79 -0
- data/lib/mail/elements/address.rb +118 -174
- data/lib/mail/elements/address_list.rb +16 -56
- data/lib/mail/elements/content_disposition_element.rb +12 -22
- data/lib/mail/elements/content_location_element.rb +9 -17
- data/lib/mail/elements/content_transfer_encoding_element.rb +8 -19
- data/lib/mail/elements/content_type_element.rb +20 -30
- data/lib/mail/elements/date_time_element.rb +10 -21
- data/lib/mail/elements/envelope_from_element.rb +23 -31
- data/lib/mail/elements/message_ids_element.rb +22 -20
- data/lib/mail/elements/mime_version_element.rb +10 -21
- data/lib/mail/elements/phrase_list.rb +13 -15
- data/lib/mail/elements/received_element.rb +26 -21
- data/lib/mail/elements.rb +1 -0
- data/lib/mail/encodings/7bit.rb +10 -14
- data/lib/mail/encodings/8bit.rb +5 -18
- data/lib/mail/encodings/base64.rb +15 -10
- data/lib/mail/encodings/binary.rb +4 -22
- data/lib/mail/encodings/identity.rb +24 -0
- data/lib/mail/encodings/quoted_printable.rb +13 -7
- data/lib/mail/encodings/transfer_encoding.rb +47 -28
- data/lib/mail/encodings/unix_to_unix.rb +20 -0
- data/lib/mail/encodings.rb +102 -93
- data/lib/mail/envelope.rb +12 -19
- data/lib/mail/field.rb +143 -71
- data/lib/mail/field_list.rb +73 -19
- data/lib/mail/fields/bcc_field.rb +42 -48
- data/lib/mail/fields/cc_field.rb +29 -50
- data/lib/mail/fields/comments_field.rb +28 -37
- data/lib/mail/fields/common_address_field.rb +170 -0
- data/lib/mail/fields/common_date_field.rb +58 -0
- data/lib/mail/fields/common_field.rb +77 -0
- data/lib/mail/fields/common_message_id_field.rb +42 -0
- data/lib/mail/fields/content_description_field.rb +8 -14
- data/lib/mail/fields/content_disposition_field.rb +20 -44
- data/lib/mail/fields/content_id_field.rb +25 -51
- data/lib/mail/fields/content_location_field.rb +12 -25
- data/lib/mail/fields/content_transfer_encoding_field.rb +31 -36
- data/lib/mail/fields/content_type_field.rb +51 -80
- data/lib/mail/fields/date_field.rb +24 -52
- data/lib/mail/fields/from_field.rb +29 -50
- data/lib/mail/fields/in_reply_to_field.rb +39 -49
- data/lib/mail/fields/keywords_field.rb +19 -32
- data/lib/mail/fields/message_id_field.rb +26 -71
- data/lib/mail/fields/mime_version_field.rb +20 -30
- data/lib/mail/fields/named_structured_field.rb +11 -0
- data/lib/mail/fields/named_unstructured_field.rb +11 -0
- data/lib/mail/fields/optional_field.rb +10 -7
- data/lib/mail/fields/{common/parameter_hash.rb → parameter_hash.rb} +16 -13
- data/lib/mail/fields/received_field.rb +44 -57
- data/lib/mail/fields/references_field.rb +36 -49
- data/lib/mail/fields/reply_to_field.rb +29 -50
- data/lib/mail/fields/resent_bcc_field.rb +29 -50
- data/lib/mail/fields/resent_cc_field.rb +29 -50
- data/lib/mail/fields/resent_date_field.rb +6 -30
- data/lib/mail/fields/resent_from_field.rb +29 -50
- data/lib/mail/fields/resent_message_id_field.rb +6 -29
- data/lib/mail/fields/resent_sender_field.rb +28 -57
- data/lib/mail/fields/resent_to_field.rb +29 -50
- data/lib/mail/fields/return_path_field.rb +51 -55
- data/lib/mail/fields/sender_field.rb +35 -56
- data/lib/mail/fields/structured_field.rb +4 -30
- data/lib/mail/fields/subject_field.rb +10 -11
- data/lib/mail/fields/to_field.rb +29 -50
- data/lib/mail/fields/unstructured_field.rb +43 -51
- data/lib/mail/fields.rb +1 -0
- data/lib/mail/header.rb +78 -129
- data/lib/mail/indifferent_hash.rb +1 -0
- data/lib/mail/mail.rb +18 -11
- data/lib/mail/matchers/attachment_matchers.rb +44 -0
- data/lib/mail/matchers/has_sent_mail.rb +81 -4
- data/lib/mail/message.rb +142 -139
- data/lib/mail/multibyte/chars.rb +24 -180
- data/lib/mail/multibyte/unicode.rb +32 -27
- data/lib/mail/multibyte/utils.rb +27 -43
- data/lib/mail/multibyte.rb +56 -16
- data/lib/mail/network/delivery_methods/exim.rb +6 -4
- data/lib/mail/network/delivery_methods/file_delivery.rb +12 -10
- data/lib/mail/network/delivery_methods/logger_delivery.rb +34 -0
- data/lib/mail/network/delivery_methods/sendmail.rb +63 -21
- data/lib/mail/network/delivery_methods/smtp.rb +76 -50
- data/lib/mail/network/delivery_methods/smtp_connection.rb +4 -4
- data/lib/mail/network/delivery_methods/test_mailer.rb +5 -2
- data/lib/mail/network/retriever_methods/base.rb +9 -8
- data/lib/mail/network/retriever_methods/imap.rb +37 -18
- data/lib/mail/network/retriever_methods/pop3.rb +6 -3
- data/lib/mail/network/retriever_methods/test_retriever.rb +4 -2
- data/lib/mail/network.rb +2 -0
- data/lib/mail/parser_tools.rb +15 -0
- data/lib/mail/parsers/address_lists_parser.rb +33242 -0
- data/lib/mail/parsers/address_lists_parser.rl +179 -0
- data/lib/mail/parsers/content_disposition_parser.rb +901 -0
- data/lib/mail/parsers/content_disposition_parser.rl +89 -0
- data/lib/mail/parsers/content_location_parser.rb +822 -0
- data/lib/mail/parsers/content_location_parser.rl +78 -0
- data/lib/mail/parsers/content_transfer_encoding_parser.rb +522 -0
- data/lib/mail/parsers/content_transfer_encoding_parser.rl +71 -0
- data/lib/mail/parsers/content_type_parser.rb +1048 -0
- data/lib/mail/parsers/content_type_parser.rl +90 -0
- data/lib/mail/parsers/date_time_parser.rb +891 -0
- data/lib/mail/parsers/date_time_parser.rl +69 -0
- data/lib/mail/parsers/envelope_from_parser.rb +3675 -0
- data/lib/mail/parsers/envelope_from_parser.rl +89 -0
- data/lib/mail/parsers/message_ids_parser.rb +5161 -0
- data/lib/mail/parsers/message_ids_parser.rl +93 -0
- data/lib/mail/parsers/mime_version_parser.rb +513 -0
- data/lib/mail/parsers/mime_version_parser.rl +68 -0
- data/lib/mail/parsers/phrase_lists_parser.rb +884 -0
- data/lib/mail/parsers/phrase_lists_parser.rl +90 -0
- data/lib/mail/parsers/received_parser.rb +8782 -0
- data/lib/mail/parsers/received_parser.rl +91 -0
- data/lib/mail/parsers/rfc2045_content_transfer_encoding.rl +13 -0
- data/lib/mail/parsers/rfc2045_content_type.rl +25 -0
- data/lib/mail/parsers/rfc2045_mime.rl +16 -0
- data/lib/mail/parsers/rfc2183_content_disposition.rl +15 -0
- data/lib/mail/parsers/rfc3629_utf8.rl +19 -0
- data/lib/mail/parsers/rfc5234_abnf_core_rules.rl +22 -0
- data/lib/mail/parsers/rfc5322.rl +74 -0
- data/lib/mail/parsers/rfc5322_address.rl +72 -0
- data/lib/mail/parsers/rfc5322_date_time.rl +37 -0
- data/lib/mail/parsers/rfc5322_lexical_tokens.rl +60 -0
- data/lib/mail/parsers.rb +13 -0
- data/lib/mail/part.rb +11 -12
- data/lib/mail/parts_list.rb +90 -14
- data/lib/mail/smtp_envelope.rb +57 -0
- data/lib/mail/utilities.rb +415 -76
- data/lib/mail/values/unicode_tables.dat +0 -0
- data/lib/mail/version.rb +8 -15
- data/lib/mail/yaml.rb +30 -0
- data/lib/mail.rb +9 -32
- metadata +127 -79
- data/CHANGELOG.rdoc +0 -742
- data/CONTRIBUTING.md +0 -45
- data/Dependencies.txt +0 -3
- data/Gemfile +0 -32
- data/Rakefile +0 -21
- data/TODO.rdoc +0 -9
- data/lib/VERSION +0 -4
- data/lib/load_parsers.rb +0 -35
- data/lib/mail/core_extensions/nil.rb +0 -19
- data/lib/mail/core_extensions/object.rb +0 -13
- data/lib/mail/core_extensions/smtp.rb +0 -24
- data/lib/mail/core_extensions/string/access.rb +0 -145
- data/lib/mail/core_extensions/string/multibyte.rb +0 -78
- data/lib/mail/core_extensions/string.rb +0 -33
- data/lib/mail/fields/common/address_container.rb +0 -16
- data/lib/mail/fields/common/common_address.rb +0 -140
- data/lib/mail/fields/common/common_date.rb +0 -42
- data/lib/mail/fields/common/common_field.rb +0 -57
- data/lib/mail/fields/common/common_message_id.rb +0 -48
- data/lib/mail/multibyte/exceptions.rb +0 -8
- data/lib/mail/parsers/address_lists.rb +0 -64
- data/lib/mail/parsers/address_lists.treetop +0 -19
- data/lib/mail/parsers/content_disposition.rb +0 -535
- data/lib/mail/parsers/content_disposition.treetop +0 -46
- data/lib/mail/parsers/content_location.rb +0 -139
- data/lib/mail/parsers/content_location.treetop +0 -20
- data/lib/mail/parsers/content_transfer_encoding.rb +0 -201
- data/lib/mail/parsers/content_transfer_encoding.treetop +0 -18
- data/lib/mail/parsers/content_type.rb +0 -971
- data/lib/mail/parsers/content_type.treetop +0 -68
- data/lib/mail/parsers/date_time.rb +0 -114
- data/lib/mail/parsers/date_time.treetop +0 -11
- data/lib/mail/parsers/envelope_from.rb +0 -194
- data/lib/mail/parsers/envelope_from.treetop +0 -32
- data/lib/mail/parsers/message_ids.rb +0 -45
- data/lib/mail/parsers/message_ids.treetop +0 -15
- data/lib/mail/parsers/mime_version.rb +0 -144
- data/lib/mail/parsers/mime_version.treetop +0 -19
- data/lib/mail/parsers/phrase_lists.rb +0 -45
- data/lib/mail/parsers/phrase_lists.treetop +0 -15
- data/lib/mail/parsers/received.rb +0 -71
- data/lib/mail/parsers/received.treetop +0 -11
- data/lib/mail/parsers/rfc2045.rb +0 -421
- data/lib/mail/parsers/rfc2045.treetop +0 -35
- data/lib/mail/parsers/rfc2822.rb +0 -5397
- data/lib/mail/parsers/rfc2822.treetop +0 -408
- data/lib/mail/parsers/rfc2822_obsolete.rb +0 -3768
- data/lib/mail/parsers/rfc2822_obsolete.treetop +0 -241
- data/lib/mail/patterns.rb +0 -35
- data/lib/mail/version_specific/ruby_1_8.rb +0 -119
- data/lib/mail/version_specific/ruby_1_9.rb +0 -147
- data/lib/tasks/corpus.rake +0 -125
- data/lib/tasks/treetop.rake +0 -10
@@ -1,71 +0,0 @@
|
|
1
|
-
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
-
|
3
|
-
|
4
|
-
module Mail
|
5
|
-
module Received
|
6
|
-
include Treetop::Runtime
|
7
|
-
|
8
|
-
def root
|
9
|
-
@root ||= :primary
|
10
|
-
end
|
11
|
-
|
12
|
-
include RFC2822
|
13
|
-
|
14
|
-
module Primary0
|
15
|
-
def name_val_list
|
16
|
-
elements[0]
|
17
|
-
end
|
18
|
-
|
19
|
-
def date_time
|
20
|
-
elements[2]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def _nt_primary
|
25
|
-
start_index = index
|
26
|
-
if node_cache[:primary].has_key?(index)
|
27
|
-
cached = node_cache[:primary][index]
|
28
|
-
if cached
|
29
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
30
|
-
@index = cached.interval.end
|
31
|
-
end
|
32
|
-
return cached
|
33
|
-
end
|
34
|
-
|
35
|
-
i0, s0 = index, []
|
36
|
-
r1 = _nt_name_val_list
|
37
|
-
s0 << r1
|
38
|
-
if r1
|
39
|
-
if has_terminal?(";", false, index)
|
40
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
41
|
-
@index += 1
|
42
|
-
else
|
43
|
-
terminal_parse_failure(";")
|
44
|
-
r2 = nil
|
45
|
-
end
|
46
|
-
s0 << r2
|
47
|
-
if r2
|
48
|
-
r3 = _nt_date_time
|
49
|
-
s0 << r3
|
50
|
-
end
|
51
|
-
end
|
52
|
-
if s0.last
|
53
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
54
|
-
r0.extend(Primary0)
|
55
|
-
else
|
56
|
-
@index = i0
|
57
|
-
r0 = nil
|
58
|
-
end
|
59
|
-
|
60
|
-
node_cache[:primary][start_index] = r0
|
61
|
-
|
62
|
-
r0
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
class ReceivedParser < Treetop::Runtime::CompiledParser
|
68
|
-
include Received
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
data/lib/mail/parsers/rfc2045.rb
DELETED
@@ -1,421 +0,0 @@
|
|
1
|
-
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
-
|
3
|
-
|
4
|
-
module Mail
|
5
|
-
module RFC2045
|
6
|
-
include Treetop::Runtime
|
7
|
-
|
8
|
-
def root
|
9
|
-
@root ||= :tspecials
|
10
|
-
end
|
11
|
-
|
12
|
-
def _nt_tspecials
|
13
|
-
start_index = index
|
14
|
-
if node_cache[:tspecials].has_key?(index)
|
15
|
-
cached = node_cache[:tspecials][index]
|
16
|
-
if cached
|
17
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
18
|
-
@index = cached.interval.end
|
19
|
-
end
|
20
|
-
return cached
|
21
|
-
end
|
22
|
-
|
23
|
-
i0 = index
|
24
|
-
if has_terminal?("(", false, index)
|
25
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
26
|
-
@index += 1
|
27
|
-
else
|
28
|
-
terminal_parse_failure("(")
|
29
|
-
r1 = nil
|
30
|
-
end
|
31
|
-
if r1
|
32
|
-
r0 = r1
|
33
|
-
else
|
34
|
-
if has_terminal?(")", false, index)
|
35
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
36
|
-
@index += 1
|
37
|
-
else
|
38
|
-
terminal_parse_failure(")")
|
39
|
-
r2 = nil
|
40
|
-
end
|
41
|
-
if r2
|
42
|
-
r0 = r2
|
43
|
-
else
|
44
|
-
if has_terminal?("<", false, index)
|
45
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
46
|
-
@index += 1
|
47
|
-
else
|
48
|
-
terminal_parse_failure("<")
|
49
|
-
r3 = nil
|
50
|
-
end
|
51
|
-
if r3
|
52
|
-
r0 = r3
|
53
|
-
else
|
54
|
-
if has_terminal?(">", false, index)
|
55
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
56
|
-
@index += 1
|
57
|
-
else
|
58
|
-
terminal_parse_failure(">")
|
59
|
-
r4 = nil
|
60
|
-
end
|
61
|
-
if r4
|
62
|
-
r0 = r4
|
63
|
-
else
|
64
|
-
if has_terminal?("@", false, index)
|
65
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
66
|
-
@index += 1
|
67
|
-
else
|
68
|
-
terminal_parse_failure("@")
|
69
|
-
r5 = nil
|
70
|
-
end
|
71
|
-
if r5
|
72
|
-
r0 = r5
|
73
|
-
else
|
74
|
-
if has_terminal?(",", false, index)
|
75
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
76
|
-
@index += 1
|
77
|
-
else
|
78
|
-
terminal_parse_failure(",")
|
79
|
-
r6 = nil
|
80
|
-
end
|
81
|
-
if r6
|
82
|
-
r0 = r6
|
83
|
-
else
|
84
|
-
if has_terminal?(";", false, index)
|
85
|
-
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
86
|
-
@index += 1
|
87
|
-
else
|
88
|
-
terminal_parse_failure(";")
|
89
|
-
r7 = nil
|
90
|
-
end
|
91
|
-
if r7
|
92
|
-
r0 = r7
|
93
|
-
else
|
94
|
-
if has_terminal?(":", false, index)
|
95
|
-
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
96
|
-
@index += 1
|
97
|
-
else
|
98
|
-
terminal_parse_failure(":")
|
99
|
-
r8 = nil
|
100
|
-
end
|
101
|
-
if r8
|
102
|
-
r0 = r8
|
103
|
-
else
|
104
|
-
if has_terminal?('\\', false, index)
|
105
|
-
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
106
|
-
@index += 1
|
107
|
-
else
|
108
|
-
terminal_parse_failure('\\')
|
109
|
-
r9 = nil
|
110
|
-
end
|
111
|
-
if r9
|
112
|
-
r0 = r9
|
113
|
-
else
|
114
|
-
if has_terminal?("<", false, index)
|
115
|
-
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
116
|
-
@index += 1
|
117
|
-
else
|
118
|
-
terminal_parse_failure("<")
|
119
|
-
r10 = nil
|
120
|
-
end
|
121
|
-
if r10
|
122
|
-
r0 = r10
|
123
|
-
else
|
124
|
-
if has_terminal?(">", false, index)
|
125
|
-
r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
126
|
-
@index += 1
|
127
|
-
else
|
128
|
-
terminal_parse_failure(">")
|
129
|
-
r11 = nil
|
130
|
-
end
|
131
|
-
if r11
|
132
|
-
r0 = r11
|
133
|
-
else
|
134
|
-
if has_terminal?("/", false, index)
|
135
|
-
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
136
|
-
@index += 1
|
137
|
-
else
|
138
|
-
terminal_parse_failure("/")
|
139
|
-
r12 = nil
|
140
|
-
end
|
141
|
-
if r12
|
142
|
-
r0 = r12
|
143
|
-
else
|
144
|
-
if has_terminal?("[", false, index)
|
145
|
-
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
146
|
-
@index += 1
|
147
|
-
else
|
148
|
-
terminal_parse_failure("[")
|
149
|
-
r13 = nil
|
150
|
-
end
|
151
|
-
if r13
|
152
|
-
r0 = r13
|
153
|
-
else
|
154
|
-
if has_terminal?("]", false, index)
|
155
|
-
r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
156
|
-
@index += 1
|
157
|
-
else
|
158
|
-
terminal_parse_failure("]")
|
159
|
-
r14 = nil
|
160
|
-
end
|
161
|
-
if r14
|
162
|
-
r0 = r14
|
163
|
-
else
|
164
|
-
if has_terminal?("?", false, index)
|
165
|
-
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
166
|
-
@index += 1
|
167
|
-
else
|
168
|
-
terminal_parse_failure("?")
|
169
|
-
r15 = nil
|
170
|
-
end
|
171
|
-
if r15
|
172
|
-
r0 = r15
|
173
|
-
else
|
174
|
-
if has_terminal?("=", false, index)
|
175
|
-
r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
176
|
-
@index += 1
|
177
|
-
else
|
178
|
-
terminal_parse_failure("=")
|
179
|
-
r16 = nil
|
180
|
-
end
|
181
|
-
if r16
|
182
|
-
r0 = r16
|
183
|
-
else
|
184
|
-
@index = i0
|
185
|
-
r0 = nil
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
node_cache[:tspecials][start_index] = r0
|
204
|
-
|
205
|
-
r0
|
206
|
-
end
|
207
|
-
|
208
|
-
def _nt_ietf_token
|
209
|
-
start_index = index
|
210
|
-
if node_cache[:ietf_token].has_key?(index)
|
211
|
-
cached = node_cache[:ietf_token][index]
|
212
|
-
if cached
|
213
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
214
|
-
@index = cached.interval.end
|
215
|
-
end
|
216
|
-
return cached
|
217
|
-
end
|
218
|
-
|
219
|
-
s0, i0 = [], index
|
220
|
-
loop do
|
221
|
-
r1 = _nt_token
|
222
|
-
if r1
|
223
|
-
s0 << r1
|
224
|
-
else
|
225
|
-
break
|
226
|
-
end
|
227
|
-
end
|
228
|
-
if s0.empty?
|
229
|
-
@index = i0
|
230
|
-
r0 = nil
|
231
|
-
else
|
232
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
233
|
-
end
|
234
|
-
|
235
|
-
node_cache[:ietf_token][start_index] = r0
|
236
|
-
|
237
|
-
r0
|
238
|
-
end
|
239
|
-
|
240
|
-
module CustomXToken0
|
241
|
-
end
|
242
|
-
|
243
|
-
def _nt_custom_x_token
|
244
|
-
start_index = index
|
245
|
-
if node_cache[:custom_x_token].has_key?(index)
|
246
|
-
cached = node_cache[:custom_x_token][index]
|
247
|
-
if cached
|
248
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
249
|
-
@index = cached.interval.end
|
250
|
-
end
|
251
|
-
return cached
|
252
|
-
end
|
253
|
-
|
254
|
-
i0, s0 = index, []
|
255
|
-
if has_terminal?('\G[xX]', true, index)
|
256
|
-
r1 = true
|
257
|
-
@index += 1
|
258
|
-
else
|
259
|
-
r1 = nil
|
260
|
-
end
|
261
|
-
s0 << r1
|
262
|
-
if r1
|
263
|
-
if has_terminal?("-", false, index)
|
264
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
265
|
-
@index += 1
|
266
|
-
else
|
267
|
-
terminal_parse_failure("-")
|
268
|
-
r2 = nil
|
269
|
-
end
|
270
|
-
s0 << r2
|
271
|
-
if r2
|
272
|
-
s3, i3 = [], index
|
273
|
-
loop do
|
274
|
-
r4 = _nt_token
|
275
|
-
if r4
|
276
|
-
s3 << r4
|
277
|
-
else
|
278
|
-
break
|
279
|
-
end
|
280
|
-
end
|
281
|
-
if s3.empty?
|
282
|
-
@index = i3
|
283
|
-
r3 = nil
|
284
|
-
else
|
285
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
286
|
-
end
|
287
|
-
s0 << r3
|
288
|
-
end
|
289
|
-
end
|
290
|
-
if s0.last
|
291
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
292
|
-
r0.extend(CustomXToken0)
|
293
|
-
else
|
294
|
-
@index = i0
|
295
|
-
r0 = nil
|
296
|
-
end
|
297
|
-
|
298
|
-
node_cache[:custom_x_token][start_index] = r0
|
299
|
-
|
300
|
-
r0
|
301
|
-
end
|
302
|
-
|
303
|
-
def _nt_iana_token
|
304
|
-
start_index = index
|
305
|
-
if node_cache[:iana_token].has_key?(index)
|
306
|
-
cached = node_cache[:iana_token][index]
|
307
|
-
if cached
|
308
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
309
|
-
@index = cached.interval.end
|
310
|
-
end
|
311
|
-
return cached
|
312
|
-
end
|
313
|
-
|
314
|
-
s0, i0 = [], index
|
315
|
-
loop do
|
316
|
-
r1 = _nt_token
|
317
|
-
if r1
|
318
|
-
s0 << r1
|
319
|
-
else
|
320
|
-
break
|
321
|
-
end
|
322
|
-
end
|
323
|
-
if s0.empty?
|
324
|
-
@index = i0
|
325
|
-
r0 = nil
|
326
|
-
else
|
327
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
328
|
-
end
|
329
|
-
|
330
|
-
node_cache[:iana_token][start_index] = r0
|
331
|
-
|
332
|
-
r0
|
333
|
-
end
|
334
|
-
|
335
|
-
def _nt_token
|
336
|
-
start_index = index
|
337
|
-
if node_cache[:token].has_key?(index)
|
338
|
-
cached = node_cache[:token][index]
|
339
|
-
if cached
|
340
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
341
|
-
@index = cached.interval.end
|
342
|
-
end
|
343
|
-
return cached
|
344
|
-
end
|
345
|
-
|
346
|
-
i0 = index
|
347
|
-
if has_terminal?('\G[\\x21-\\x27]', true, index)
|
348
|
-
r1 = true
|
349
|
-
@index += 1
|
350
|
-
else
|
351
|
-
r1 = nil
|
352
|
-
end
|
353
|
-
if r1
|
354
|
-
r0 = r1
|
355
|
-
else
|
356
|
-
if has_terminal?('\G[\\x2a-\\x2b]', true, index)
|
357
|
-
r2 = true
|
358
|
-
@index += 1
|
359
|
-
else
|
360
|
-
r2 = nil
|
361
|
-
end
|
362
|
-
if r2
|
363
|
-
r0 = r2
|
364
|
-
else
|
365
|
-
if has_terminal?('\G[\\x2c-\\x2e]', true, index)
|
366
|
-
r3 = true
|
367
|
-
@index += 1
|
368
|
-
else
|
369
|
-
r3 = nil
|
370
|
-
end
|
371
|
-
if r3
|
372
|
-
r0 = r3
|
373
|
-
else
|
374
|
-
if has_terminal?('\G[\\x30-\\x39]', true, index)
|
375
|
-
r4 = true
|
376
|
-
@index += 1
|
377
|
-
else
|
378
|
-
r4 = nil
|
379
|
-
end
|
380
|
-
if r4
|
381
|
-
r0 = r4
|
382
|
-
else
|
383
|
-
if has_terminal?('\G[\\x41-\\x5a]', true, index)
|
384
|
-
r5 = true
|
385
|
-
@index += 1
|
386
|
-
else
|
387
|
-
r5 = nil
|
388
|
-
end
|
389
|
-
if r5
|
390
|
-
r0 = r5
|
391
|
-
else
|
392
|
-
if has_terminal?('\G[\\x5e-\\x7e]', true, index)
|
393
|
-
r6 = true
|
394
|
-
@index += 1
|
395
|
-
else
|
396
|
-
r6 = nil
|
397
|
-
end
|
398
|
-
if r6
|
399
|
-
r0 = r6
|
400
|
-
else
|
401
|
-
@index = i0
|
402
|
-
r0 = nil
|
403
|
-
end
|
404
|
-
end
|
405
|
-
end
|
406
|
-
end
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
node_cache[:token][start_index] = r0
|
411
|
-
|
412
|
-
r0
|
413
|
-
end
|
414
|
-
|
415
|
-
end
|
416
|
-
|
417
|
-
class RFC2045Parser < Treetop::Runtime::CompiledParser
|
418
|
-
include RFC2045
|
419
|
-
end
|
420
|
-
|
421
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Mail
|
2
|
-
grammar RFC2045
|
3
|
-
|
4
|
-
rule tspecials
|
5
|
-
"(" / ")" / "<" / ">" / "@" /
|
6
|
-
"," / ";" / ":" / '\\' / "<" / ">" /
|
7
|
-
"/" / "[" / "]" / "?" / "="
|
8
|
-
end
|
9
|
-
|
10
|
-
rule ietf_token
|
11
|
-
token+
|
12
|
-
end
|
13
|
-
|
14
|
-
rule custom_x_token
|
15
|
-
[xX] "-" token+
|
16
|
-
end
|
17
|
-
|
18
|
-
rule iana_token
|
19
|
-
token+
|
20
|
-
# <A publicly-defined extension token. Tokens
|
21
|
-
# of this form must be registered with IANA
|
22
|
-
# as specified in RFC 2048.>
|
23
|
-
end
|
24
|
-
|
25
|
-
rule token
|
26
|
-
[\x21-\x27] / # any (US-ASCII) CHAR
|
27
|
-
[\x2a-\x2b] / # except SPACE,
|
28
|
-
[\x2c-\x2e] / # CTLs,
|
29
|
-
[\x30-\x39] / # or tspecials
|
30
|
-
[\x41-\x5a] /
|
31
|
-
[\x5e-\x7e]
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|