otherinbox-mail 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/CHANGELOG.rdoc +607 -0
  2. data/CONTRIBUTING.md +45 -0
  3. data/Dependencies.txt +3 -0
  4. data/Gemfile +26 -0
  5. data/Gemfile.lock +44 -0
  6. data/README.md +663 -0
  7. data/Rakefile +40 -0
  8. data/TODO.rdoc +9 -0
  9. data/lib/VERSION +4 -0
  10. data/lib/mail.rb +101 -0
  11. data/lib/mail/attachments_list.rb +104 -0
  12. data/lib/mail/body.rb +291 -0
  13. data/lib/mail/configuration.rb +75 -0
  14. data/lib/mail/core_extensions/nil.rb +17 -0
  15. data/lib/mail/core_extensions/object.rb +13 -0
  16. data/lib/mail/core_extensions/shell_escape.rb +56 -0
  17. data/lib/mail/core_extensions/smtp.rb +25 -0
  18. data/lib/mail/core_extensions/string.rb +33 -0
  19. data/lib/mail/core_extensions/string/access.rb +145 -0
  20. data/lib/mail/core_extensions/string/multibyte.rb +78 -0
  21. data/lib/mail/elements.rb +14 -0
  22. data/lib/mail/elements/address.rb +306 -0
  23. data/lib/mail/elements/address_list.rb +74 -0
  24. data/lib/mail/elements/content_disposition_element.rb +30 -0
  25. data/lib/mail/elements/content_location_element.rb +25 -0
  26. data/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
  27. data/lib/mail/elements/content_type_element.rb +35 -0
  28. data/lib/mail/elements/date_time_element.rb +26 -0
  29. data/lib/mail/elements/envelope_from_element.rb +34 -0
  30. data/lib/mail/elements/message_ids_element.rb +29 -0
  31. data/lib/mail/elements/mime_version_element.rb +26 -0
  32. data/lib/mail/elements/phrase_list.rb +21 -0
  33. data/lib/mail/elements/received_element.rb +30 -0
  34. data/lib/mail/encodings.rb +274 -0
  35. data/lib/mail/encodings/7bit.rb +31 -0
  36. data/lib/mail/encodings/8bit.rb +31 -0
  37. data/lib/mail/encodings/base64.rb +33 -0
  38. data/lib/mail/encodings/binary.rb +31 -0
  39. data/lib/mail/encodings/quoted_printable.rb +38 -0
  40. data/lib/mail/encodings/transfer_encoding.rb +58 -0
  41. data/lib/mail/envelope.rb +35 -0
  42. data/lib/mail/field.rb +234 -0
  43. data/lib/mail/field_list.rb +33 -0
  44. data/lib/mail/fields.rb +35 -0
  45. data/lib/mail/fields/bcc_field.rb +56 -0
  46. data/lib/mail/fields/cc_field.rb +55 -0
  47. data/lib/mail/fields/comments_field.rb +41 -0
  48. data/lib/mail/fields/common/address_container.rb +16 -0
  49. data/lib/mail/fields/common/common_address.rb +125 -0
  50. data/lib/mail/fields/common/common_date.rb +42 -0
  51. data/lib/mail/fields/common/common_field.rb +51 -0
  52. data/lib/mail/fields/common/common_message_id.rb +44 -0
  53. data/lib/mail/fields/common/parameter_hash.rb +58 -0
  54. data/lib/mail/fields/content_description_field.rb +19 -0
  55. data/lib/mail/fields/content_disposition_field.rb +69 -0
  56. data/lib/mail/fields/content_id_field.rb +63 -0
  57. data/lib/mail/fields/content_location_field.rb +42 -0
  58. data/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
  59. data/lib/mail/fields/content_type_field.rb +198 -0
  60. data/lib/mail/fields/date_field.rb +57 -0
  61. data/lib/mail/fields/from_field.rb +55 -0
  62. data/lib/mail/fields/in_reply_to_field.rb +55 -0
  63. data/lib/mail/fields/keywords_field.rb +44 -0
  64. data/lib/mail/fields/message_id_field.rb +83 -0
  65. data/lib/mail/fields/mime_version_field.rb +53 -0
  66. data/lib/mail/fields/optional_field.rb +13 -0
  67. data/lib/mail/fields/received_field.rb +75 -0
  68. data/lib/mail/fields/references_field.rb +55 -0
  69. data/lib/mail/fields/reply_to_field.rb +55 -0
  70. data/lib/mail/fields/resent_bcc_field.rb +55 -0
  71. data/lib/mail/fields/resent_cc_field.rb +55 -0
  72. data/lib/mail/fields/resent_date_field.rb +35 -0
  73. data/lib/mail/fields/resent_from_field.rb +55 -0
  74. data/lib/mail/fields/resent_message_id_field.rb +34 -0
  75. data/lib/mail/fields/resent_sender_field.rb +62 -0
  76. data/lib/mail/fields/resent_to_field.rb +55 -0
  77. data/lib/mail/fields/return_path_field.rb +65 -0
  78. data/lib/mail/fields/sender_field.rb +67 -0
  79. data/lib/mail/fields/structured_field.rb +51 -0
  80. data/lib/mail/fields/subject_field.rb +16 -0
  81. data/lib/mail/fields/to_field.rb +55 -0
  82. data/lib/mail/fields/unstructured_field.rb +191 -0
  83. data/lib/mail/header.rb +265 -0
  84. data/lib/mail/indifferent_hash.rb +146 -0
  85. data/lib/mail/mail.rb +255 -0
  86. data/lib/mail/matchers/has_sent_mail.rb +124 -0
  87. data/lib/mail/message.rb +2059 -0
  88. data/lib/mail/multibyte.rb +42 -0
  89. data/lib/mail/multibyte/chars.rb +474 -0
  90. data/lib/mail/multibyte/exceptions.rb +8 -0
  91. data/lib/mail/multibyte/unicode.rb +392 -0
  92. data/lib/mail/multibyte/utils.rb +60 -0
  93. data/lib/mail/network.rb +14 -0
  94. data/lib/mail/network/delivery_methods/exim.rb +53 -0
  95. data/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
  96. data/lib/mail/network/delivery_methods/sendmail.rb +62 -0
  97. data/lib/mail/network/delivery_methods/smtp.rb +153 -0
  98. data/lib/mail/network/delivery_methods/smtp_connection.rb +74 -0
  99. data/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
  100. data/lib/mail/network/retriever_methods/base.rb +63 -0
  101. data/lib/mail/network/retriever_methods/imap.rb +168 -0
  102. data/lib/mail/network/retriever_methods/pop3.rb +140 -0
  103. data/lib/mail/network/retriever_methods/test_retriever.rb +47 -0
  104. data/lib/mail/parsers/address_lists.rb +64 -0
  105. data/lib/mail/parsers/address_lists.treetop +19 -0
  106. data/lib/mail/parsers/content_disposition.rb +535 -0
  107. data/lib/mail/parsers/content_disposition.treetop +46 -0
  108. data/lib/mail/parsers/content_location.rb +139 -0
  109. data/lib/mail/parsers/content_location.treetop +20 -0
  110. data/lib/mail/parsers/content_transfer_encoding.rb +162 -0
  111. data/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
  112. data/lib/mail/parsers/content_type.rb +967 -0
  113. data/lib/mail/parsers/content_type.treetop +68 -0
  114. data/lib/mail/parsers/date_time.rb +114 -0
  115. data/lib/mail/parsers/date_time.treetop +11 -0
  116. data/lib/mail/parsers/envelope_from.rb +194 -0
  117. data/lib/mail/parsers/envelope_from.treetop +32 -0
  118. data/lib/mail/parsers/message_ids.rb +45 -0
  119. data/lib/mail/parsers/message_ids.treetop +15 -0
  120. data/lib/mail/parsers/mime_version.rb +144 -0
  121. data/lib/mail/parsers/mime_version.treetop +19 -0
  122. data/lib/mail/parsers/phrase_lists.rb +45 -0
  123. data/lib/mail/parsers/phrase_lists.treetop +15 -0
  124. data/lib/mail/parsers/received.rb +71 -0
  125. data/lib/mail/parsers/received.treetop +11 -0
  126. data/lib/mail/parsers/rfc2045.rb +464 -0
  127. data/lib/mail/parsers/rfc2045.treetop +36 -0
  128. data/lib/mail/parsers/rfc2822.rb +5341 -0
  129. data/lib/mail/parsers/rfc2822.treetop +410 -0
  130. data/lib/mail/parsers/rfc2822_obsolete.rb +3768 -0
  131. data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
  132. data/lib/mail/part.rb +116 -0
  133. data/lib/mail/parts_list.rb +55 -0
  134. data/lib/mail/patterns.rb +34 -0
  135. data/lib/mail/utilities.rb +215 -0
  136. data/lib/mail/version.rb +24 -0
  137. data/lib/mail/version_specific/ruby_1_8.rb +98 -0
  138. data/lib/mail/version_specific/ruby_1_9.rb +113 -0
  139. data/lib/tasks/corpus.rake +125 -0
  140. data/lib/tasks/treetop.rake +10 -0
  141. metadata +253 -0
@@ -0,0 +1,15 @@
1
+ module Mail
2
+ grammar MessageIds
3
+
4
+ include RFC2822
5
+
6
+ rule primary
7
+ message_ids {
8
+ def message_ids
9
+ [first_msg_id] + other_msg_ids.elements.map { |o| o.msg_id_value }
10
+ end
11
+ }
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,144 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Mail
5
+ module MimeVersion
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :version
10
+ end
11
+
12
+ include RFC2822
13
+
14
+ module Version0
15
+ def CFWS1
16
+ elements[0]
17
+ end
18
+
19
+ def major_digits
20
+ elements[1]
21
+ end
22
+
23
+ def minor_digits
24
+ elements[5]
25
+ end
26
+
27
+ def CFWS2
28
+ elements[6]
29
+ end
30
+ end
31
+
32
+ module Version1
33
+ def major
34
+ major_digits
35
+ end
36
+
37
+ def minor
38
+ minor_digits
39
+ end
40
+ end
41
+
42
+ def _nt_version
43
+ start_index = index
44
+ if node_cache[:version].has_key?(index)
45
+ cached = node_cache[:version][index]
46
+ if cached
47
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
48
+ @index = cached.interval.end
49
+ end
50
+ return cached
51
+ end
52
+
53
+ i0, s0 = index, []
54
+ r1 = _nt_CFWS
55
+ s0 << r1
56
+ if r1
57
+ s2, i2 = [], index
58
+ loop do
59
+ r3 = _nt_DIGIT
60
+ if r3
61
+ s2 << r3
62
+ else
63
+ break
64
+ end
65
+ end
66
+ if s2.empty?
67
+ @index = i2
68
+ r2 = nil
69
+ else
70
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
71
+ end
72
+ s0 << r2
73
+ if r2
74
+ r5 = _nt_comment
75
+ if r5
76
+ r4 = r5
77
+ else
78
+ r4 = instantiate_node(SyntaxNode,input, index...index)
79
+ end
80
+ s0 << r4
81
+ if r4
82
+ if has_terminal?(".", false, index)
83
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
84
+ @index += 1
85
+ else
86
+ terminal_parse_failure(".")
87
+ r6 = nil
88
+ end
89
+ s0 << r6
90
+ if r6
91
+ r8 = _nt_comment
92
+ if r8
93
+ r7 = r8
94
+ else
95
+ r7 = instantiate_node(SyntaxNode,input, index...index)
96
+ end
97
+ s0 << r7
98
+ if r7
99
+ s9, i9 = [], index
100
+ loop do
101
+ r10 = _nt_DIGIT
102
+ if r10
103
+ s9 << r10
104
+ else
105
+ break
106
+ end
107
+ end
108
+ if s9.empty?
109
+ @index = i9
110
+ r9 = nil
111
+ else
112
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
113
+ end
114
+ s0 << r9
115
+ if r9
116
+ r11 = _nt_CFWS
117
+ s0 << r11
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ if s0.last
125
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
126
+ r0.extend(Version0)
127
+ r0.extend(Version1)
128
+ else
129
+ @index = i0
130
+ r0 = nil
131
+ end
132
+
133
+ node_cache[:version][start_index] = r0
134
+
135
+ r0
136
+ end
137
+
138
+ end
139
+
140
+ class MimeVersionParser < Treetop::Runtime::CompiledParser
141
+ include MimeVersion
142
+ end
143
+
144
+ end
@@ -0,0 +1,19 @@
1
+ module Mail
2
+ grammar MimeVersion
3
+
4
+ include RFC2822
5
+
6
+ rule version
7
+ CFWS major_digits:DIGIT+ comment? "." comment? minor_digits:DIGIT+ CFWS {
8
+ def major
9
+ major_digits
10
+ end
11
+
12
+ def minor
13
+ minor_digits
14
+ end
15
+ }
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,45 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Mail
5
+ module PhraseLists
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :primary_phrase
10
+ end
11
+
12
+ include RFC2822
13
+
14
+ module PrimaryPhrase0
15
+ def phrases
16
+ [first_phrase] + other_phrases.elements.map { |o| o.phrase_value }
17
+ end
18
+ end
19
+
20
+ def _nt_primary_phrase
21
+ start_index = index
22
+ if node_cache[:primary_phrase].has_key?(index)
23
+ cached = node_cache[:primary_phrase][index]
24
+ if cached
25
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
26
+ @index = cached.interval.end
27
+ end
28
+ return cached
29
+ end
30
+
31
+ r0 = _nt_phrase_list
32
+ r0.extend(PrimaryPhrase0)
33
+
34
+ node_cache[:primary_phrase][start_index] = r0
35
+
36
+ r0
37
+ end
38
+
39
+ end
40
+
41
+ class PhraseListsParser < Treetop::Runtime::CompiledParser
42
+ include PhraseLists
43
+ end
44
+
45
+ end
@@ -0,0 +1,15 @@
1
+ module Mail
2
+ grammar PhraseLists
3
+
4
+ include RFC2822
5
+
6
+ rule primary_phrase
7
+ phrase_list {
8
+ def phrases
9
+ [first_phrase] + other_phrases.elements.map { |o| o.phrase_value }
10
+ end
11
+ }
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,71 @@
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
@@ -0,0 +1,11 @@
1
+ module Mail
2
+ grammar Received
3
+
4
+ include RFC2822
5
+
6
+ rule primary
7
+ name_val_list ";" date_time
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,464 @@
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
+ i0 = index
220
+ if has_terminal?("7bit", false, index)
221
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
222
+ @index += 4
223
+ else
224
+ terminal_parse_failure("7bit")
225
+ r1 = nil
226
+ end
227
+ if r1
228
+ r0 = r1
229
+ else
230
+ if has_terminal?("8bit", false, index)
231
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
232
+ @index += 4
233
+ else
234
+ terminal_parse_failure("8bit")
235
+ r2 = nil
236
+ end
237
+ if r2
238
+ r0 = r2
239
+ else
240
+ if has_terminal?("binary", false, index)
241
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 6))
242
+ @index += 6
243
+ else
244
+ terminal_parse_failure("binary")
245
+ r3 = nil
246
+ end
247
+ if r3
248
+ r0 = r3
249
+ else
250
+ if has_terminal?("quoted-printable", false, index)
251
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 16))
252
+ @index += 16
253
+ else
254
+ terminal_parse_failure("quoted-printable")
255
+ r4 = nil
256
+ end
257
+ if r4
258
+ r0 = r4
259
+ else
260
+ if has_terminal?("base64", false, index)
261
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 6))
262
+ @index += 6
263
+ else
264
+ terminal_parse_failure("base64")
265
+ r5 = nil
266
+ end
267
+ if r5
268
+ r0 = r5
269
+ else
270
+ @index = i0
271
+ r0 = nil
272
+ end
273
+ end
274
+ end
275
+ end
276
+ end
277
+
278
+ node_cache[:ietf_token][start_index] = r0
279
+
280
+ r0
281
+ end
282
+
283
+ module CustomXToken0
284
+ end
285
+
286
+ def _nt_custom_x_token
287
+ start_index = index
288
+ if node_cache[:custom_x_token].has_key?(index)
289
+ cached = node_cache[:custom_x_token][index]
290
+ if cached
291
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
292
+ @index = cached.interval.end
293
+ end
294
+ return cached
295
+ end
296
+
297
+ i0, s0 = index, []
298
+ if has_terminal?('\G[xX]', true, index)
299
+ r1 = true
300
+ @index += 1
301
+ else
302
+ r1 = nil
303
+ end
304
+ s0 << r1
305
+ if r1
306
+ if has_terminal?("-", false, index)
307
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
308
+ @index += 1
309
+ else
310
+ terminal_parse_failure("-")
311
+ r2 = nil
312
+ end
313
+ s0 << r2
314
+ if r2
315
+ s3, i3 = [], index
316
+ loop do
317
+ r4 = _nt_token
318
+ if r4
319
+ s3 << r4
320
+ else
321
+ break
322
+ end
323
+ end
324
+ if s3.empty?
325
+ @index = i3
326
+ r3 = nil
327
+ else
328
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
329
+ end
330
+ s0 << r3
331
+ end
332
+ end
333
+ if s0.last
334
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
335
+ r0.extend(CustomXToken0)
336
+ else
337
+ @index = i0
338
+ r0 = nil
339
+ end
340
+
341
+ node_cache[:custom_x_token][start_index] = r0
342
+
343
+ r0
344
+ end
345
+
346
+ def _nt_iana_token
347
+ start_index = index
348
+ if node_cache[:iana_token].has_key?(index)
349
+ cached = node_cache[:iana_token][index]
350
+ if cached
351
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
352
+ @index = cached.interval.end
353
+ end
354
+ return cached
355
+ end
356
+
357
+ s0, i0 = [], index
358
+ loop do
359
+ r1 = _nt_token
360
+ if r1
361
+ s0 << r1
362
+ else
363
+ break
364
+ end
365
+ end
366
+ if s0.empty?
367
+ @index = i0
368
+ r0 = nil
369
+ else
370
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
371
+ end
372
+
373
+ node_cache[:iana_token][start_index] = r0
374
+
375
+ r0
376
+ end
377
+
378
+ def _nt_token
379
+ start_index = index
380
+ if node_cache[:token].has_key?(index)
381
+ cached = node_cache[:token][index]
382
+ if cached
383
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
384
+ @index = cached.interval.end
385
+ end
386
+ return cached
387
+ end
388
+
389
+ i0 = index
390
+ if has_terminal?('\G[\\x21-\\x27]', true, index)
391
+ r1 = true
392
+ @index += 1
393
+ else
394
+ r1 = nil
395
+ end
396
+ if r1
397
+ r0 = r1
398
+ else
399
+ if has_terminal?('\G[\\x2a-\\x2b]', true, index)
400
+ r2 = true
401
+ @index += 1
402
+ else
403
+ r2 = nil
404
+ end
405
+ if r2
406
+ r0 = r2
407
+ else
408
+ if has_terminal?('\G[\\x2c-\\x2e]', true, index)
409
+ r3 = true
410
+ @index += 1
411
+ else
412
+ r3 = nil
413
+ end
414
+ if r3
415
+ r0 = r3
416
+ else
417
+ if has_terminal?('\G[\\x30-\\x39]', true, index)
418
+ r4 = true
419
+ @index += 1
420
+ else
421
+ r4 = nil
422
+ end
423
+ if r4
424
+ r0 = r4
425
+ else
426
+ if has_terminal?('\G[\\x41-\\x5a]', true, index)
427
+ r5 = true
428
+ @index += 1
429
+ else
430
+ r5 = nil
431
+ end
432
+ if r5
433
+ r0 = r5
434
+ else
435
+ if has_terminal?('\G[\\x5e-\\x7e]', true, index)
436
+ r6 = true
437
+ @index += 1
438
+ else
439
+ r6 = nil
440
+ end
441
+ if r6
442
+ r0 = r6
443
+ else
444
+ @index = i0
445
+ r0 = nil
446
+ end
447
+ end
448
+ end
449
+ end
450
+ end
451
+ end
452
+
453
+ node_cache[:token][start_index] = r0
454
+
455
+ r0
456
+ end
457
+
458
+ end
459
+
460
+ class RFC2045Parser < Treetop::Runtime::CompiledParser
461
+ include RFC2045
462
+ end
463
+
464
+ end