mail 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mail might be problematic. Click here for more details.

Files changed (107) hide show
  1. data/.gitignore +4 -0
  2. data/Manifest.txt +106 -0
  3. data/README.rdoc +441 -0
  4. data/Rakefile +38 -0
  5. data/lib/mail.rb +86 -0
  6. data/lib/mail/attachment.rb +90 -0
  7. data/lib/mail/body.rb +149 -0
  8. data/lib/mail/configuration.rb +90 -0
  9. data/lib/mail/core_extensions.rb +6 -0
  10. data/lib/mail/core_extensions/blank.rb +41 -0
  11. data/lib/mail/core_extensions/nil.rb +15 -0
  12. data/lib/mail/core_extensions/string.rb +31 -0
  13. data/lib/mail/elements/address.rb +293 -0
  14. data/lib/mail/elements/address_list.rb +62 -0
  15. data/lib/mail/elements/content_disposition_element.rb +34 -0
  16. data/lib/mail/elements/content_transfer_encoding_element.rb +21 -0
  17. data/lib/mail/elements/content_type_element.rb +39 -0
  18. data/lib/mail/elements/date_time_element.rb +26 -0
  19. data/lib/mail/elements/envelope_from_element.rb +34 -0
  20. data/lib/mail/elements/message_ids_element.rb +29 -0
  21. data/lib/mail/elements/mime_version_element.rb +26 -0
  22. data/lib/mail/elements/phrase_list.rb +21 -0
  23. data/lib/mail/elements/received_element.rb +30 -0
  24. data/lib/mail/encodings/base64.rb +17 -0
  25. data/lib/mail/encodings/encodings.rb +24 -0
  26. data/lib/mail/encodings/quoted_printable.rb +26 -0
  27. data/lib/mail/envelope.rb +35 -0
  28. data/lib/mail/field.rb +202 -0
  29. data/lib/mail/field_list.rb +33 -0
  30. data/lib/mail/fields/bcc_field.rb +40 -0
  31. data/lib/mail/fields/cc_field.rb +40 -0
  32. data/lib/mail/fields/comments_field.rb +41 -0
  33. data/lib/mail/fields/common/common_address.rb +62 -0
  34. data/lib/mail/fields/common/common_date.rb +35 -0
  35. data/lib/mail/fields/common/common_field.rb +128 -0
  36. data/lib/mail/fields/common/common_message_id.rb +35 -0
  37. data/lib/mail/fields/content_description_field.rb +15 -0
  38. data/lib/mail/fields/content_disposition_field.rb +34 -0
  39. data/lib/mail/fields/content_id_field.rb +50 -0
  40. data/lib/mail/fields/content_transfer_encoding_field.rb +28 -0
  41. data/lib/mail/fields/content_type_field.rb +50 -0
  42. data/lib/mail/fields/date_field.rb +44 -0
  43. data/lib/mail/fields/from_field.rb +40 -0
  44. data/lib/mail/fields/in_reply_to_field.rb +42 -0
  45. data/lib/mail/fields/keywords_field.rb +22 -0
  46. data/lib/mail/fields/message_id_field.rb +70 -0
  47. data/lib/mail/fields/mime_version_field.rb +42 -0
  48. data/lib/mail/fields/optional_field.rb +11 -0
  49. data/lib/mail/fields/received_field.rb +49 -0
  50. data/lib/mail/fields/references_field.rb +42 -0
  51. data/lib/mail/fields/reply_to_field.rb +40 -0
  52. data/lib/mail/fields/resent_bcc_field.rb +40 -0
  53. data/lib/mail/fields/resent_cc_field.rb +40 -0
  54. data/lib/mail/fields/resent_date_field.rb +16 -0
  55. data/lib/mail/fields/resent_from_field.rb +40 -0
  56. data/lib/mail/fields/resent_message_id_field.rb +20 -0
  57. data/lib/mail/fields/resent_sender_field.rb +48 -0
  58. data/lib/mail/fields/resent_to_field.rb +40 -0
  59. data/lib/mail/fields/return_path_field.rb +34 -0
  60. data/lib/mail/fields/sender_field.rb +48 -0
  61. data/lib/mail/fields/structured_field.rb +32 -0
  62. data/lib/mail/fields/subject_field.rb +14 -0
  63. data/lib/mail/fields/to_field.rb +40 -0
  64. data/lib/mail/fields/unstructured_field.rb +27 -0
  65. data/lib/mail/header.rb +213 -0
  66. data/lib/mail/mail.rb +120 -0
  67. data/lib/mail/message.rb +648 -0
  68. data/lib/mail/network/deliverable.rb +42 -0
  69. data/lib/mail/network/retrievable.rb +63 -0
  70. data/lib/mail/parsers/address_lists.rb +61 -0
  71. data/lib/mail/parsers/address_lists.treetop +19 -0
  72. data/lib/mail/parsers/content_disposition.rb +358 -0
  73. data/lib/mail/parsers/content_disposition.treetop +45 -0
  74. data/lib/mail/parsers/content_transfer_encoding.rb +179 -0
  75. data/lib/mail/parsers/content_transfer_encoding.treetop +25 -0
  76. data/lib/mail/parsers/content_type.rb +507 -0
  77. data/lib/mail/parsers/content_type.treetop +58 -0
  78. data/lib/mail/parsers/date_time.rb +111 -0
  79. data/lib/mail/parsers/date_time.treetop +11 -0
  80. data/lib/mail/parsers/envelope_from.rb +188 -0
  81. data/lib/mail/parsers/envelope_from.treetop +32 -0
  82. data/lib/mail/parsers/message_ids.rb +42 -0
  83. data/lib/mail/parsers/message_ids.treetop +15 -0
  84. data/lib/mail/parsers/mime_version.rb +141 -0
  85. data/lib/mail/parsers/mime_version.treetop +19 -0
  86. data/lib/mail/parsers/phrase_lists.rb +42 -0
  87. data/lib/mail/parsers/phrase_lists.treetop +15 -0
  88. data/lib/mail/parsers/received.rb +68 -0
  89. data/lib/mail/parsers/received.treetop +11 -0
  90. data/lib/mail/parsers/rfc2045.rb +406 -0
  91. data/lib/mail/parsers/rfc2045.treetop +35 -0
  92. data/lib/mail/parsers/rfc2822.rb +5005 -0
  93. data/lib/mail/parsers/rfc2822.treetop +402 -0
  94. data/lib/mail/parsers/rfc2822_obsolete.rb +3607 -0
  95. data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
  96. data/lib/mail/part.rb +120 -0
  97. data/lib/mail/patterns.rb +42 -0
  98. data/lib/mail/utilities.rb +142 -0
  99. data/lib/mail/version.rb +10 -0
  100. data/lib/mail/version_specific/multibyte.rb +62 -0
  101. data/lib/mail/version_specific/multibyte/chars.rb +701 -0
  102. data/lib/mail/version_specific/multibyte/exceptions.rb +8 -0
  103. data/lib/mail/version_specific/multibyte/unicode_database.rb +71 -0
  104. data/lib/mail/version_specific/ruby_1_8.rb +61 -0
  105. data/lib/mail/version_specific/ruby_1_8_string.rb +88 -0
  106. data/lib/mail/version_specific/ruby_1_9.rb +49 -0
  107. metadata +192 -0
@@ -0,0 +1,45 @@
1
+ module Mail
2
+ grammar ContentDisposition
3
+
4
+ include RFC2822
5
+ include RFC2045
6
+
7
+ rule content_disposition
8
+ disposition_type param_hashes:(CFWS ";" parameter CFWS)* {
9
+ def parameters
10
+ param_hashes.elements.map do |param|
11
+ param.parameter.param_hash
12
+ end
13
+ end
14
+ }
15
+ end
16
+
17
+ rule disposition_type
18
+ "inline" / "attachment" / extension_token
19
+ end
20
+
21
+ rule extension_token
22
+ ietf_token / x_token
23
+ end
24
+ rule parameter
25
+ CFWS? attr:attribute "=" val:value CFWS? {
26
+ def param_hash
27
+ {attr.text_value => val.text_value}
28
+ end
29
+ }
30
+ end
31
+
32
+ rule attribute
33
+ token+
34
+ end
35
+
36
+ rule value
37
+ quoted_string {
38
+ def text_value
39
+ quoted_content.text_value
40
+ end
41
+ } / (token / [\x3d])+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,179 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Mail
5
+ module ContentTransferEncoding
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root || :primary
10
+ end
11
+
12
+ include RFC2822
13
+
14
+ include RFC2045
15
+
16
+ module Primary0
17
+ def CFWS1
18
+ elements[0]
19
+ end
20
+
21
+ def encoding
22
+ elements[1]
23
+ end
24
+
25
+ def CFWS2
26
+ elements[2]
27
+ end
28
+ end
29
+
30
+ def _nt_primary
31
+ start_index = index
32
+ if node_cache[:primary].has_key?(index)
33
+ cached = node_cache[:primary][index]
34
+ @index = cached.interval.end if cached
35
+ return cached
36
+ end
37
+
38
+ i0, s0 = index, []
39
+ r1 = _nt_CFWS
40
+ s0 << r1
41
+ if r1
42
+ r2 = _nt_encoding
43
+ s0 << r2
44
+ if r2
45
+ r3 = _nt_CFWS
46
+ s0 << r3
47
+ end
48
+ end
49
+ if s0.last
50
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
51
+ r0.extend(Primary0)
52
+ else
53
+ @index = i0
54
+ r0 = nil
55
+ end
56
+
57
+ node_cache[:primary][start_index] = r0
58
+
59
+ r0
60
+ end
61
+
62
+ module Encoding0
63
+ def encoding
64
+ known_tokens.text_value || ietf_token.text_value || x_token.text_value
65
+ end
66
+ end
67
+
68
+ def _nt_encoding
69
+ start_index = index
70
+ if node_cache[:encoding].has_key?(index)
71
+ cached = node_cache[:encoding][index]
72
+ @index = cached.interval.end if cached
73
+ return cached
74
+ end
75
+
76
+ i0 = index
77
+ r1 = _nt_known_tokens
78
+ if r1
79
+ r0 = r1
80
+ else
81
+ r2 = _nt_ietf_token
82
+ if r2
83
+ r0 = r2
84
+ else
85
+ r3 = _nt_x_token
86
+ r3.extend(Encoding0)
87
+ if r3
88
+ r0 = r3
89
+ else
90
+ @index = i0
91
+ r0 = nil
92
+ end
93
+ end
94
+ end
95
+
96
+ node_cache[:encoding][start_index] = r0
97
+
98
+ r0
99
+ end
100
+
101
+ def _nt_known_tokens
102
+ start_index = index
103
+ if node_cache[:known_tokens].has_key?(index)
104
+ cached = node_cache[:known_tokens][index]
105
+ @index = cached.interval.end if cached
106
+ return cached
107
+ end
108
+
109
+ i0 = index
110
+ if has_terminal?("7bit", false, index)
111
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
112
+ @index += 4
113
+ else
114
+ terminal_parse_failure("7bit")
115
+ r1 = nil
116
+ end
117
+ if r1
118
+ r0 = r1
119
+ else
120
+ if has_terminal?("8bit", false, index)
121
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
122
+ @index += 4
123
+ else
124
+ terminal_parse_failure("8bit")
125
+ r2 = nil
126
+ end
127
+ if r2
128
+ r0 = r2
129
+ else
130
+ if has_terminal?("binary", false, index)
131
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 6))
132
+ @index += 6
133
+ else
134
+ terminal_parse_failure("binary")
135
+ r3 = nil
136
+ end
137
+ if r3
138
+ r0 = r3
139
+ else
140
+ if has_terminal?("quoted-printable", false, index)
141
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 16))
142
+ @index += 16
143
+ else
144
+ terminal_parse_failure("quoted-printable")
145
+ r4 = nil
146
+ end
147
+ if r4
148
+ r0 = r4
149
+ else
150
+ if has_terminal?("base64", false, index)
151
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 6))
152
+ @index += 6
153
+ else
154
+ terminal_parse_failure("base64")
155
+ r5 = nil
156
+ end
157
+ if r5
158
+ r0 = r5
159
+ else
160
+ @index = i0
161
+ r0 = nil
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
167
+
168
+ node_cache[:known_tokens][start_index] = r0
169
+
170
+ r0
171
+ end
172
+
173
+ end
174
+
175
+ class ContentTransferEncodingParser < Treetop::Runtime::CompiledParser
176
+ include ContentTransferEncoding
177
+ end
178
+
179
+ end
@@ -0,0 +1,25 @@
1
+ module Mail
2
+ grammar ContentTransferEncoding
3
+
4
+ include RFC2822
5
+ include RFC2045
6
+
7
+ rule primary
8
+ CFWS encoding CFWS
9
+ end
10
+
11
+ rule encoding
12
+ known_tokens / ietf_token / x_token {
13
+ def encoding
14
+ known_tokens.text_value || ietf_token.text_value || x_token.text_value
15
+ end
16
+ }
17
+ end
18
+
19
+ rule known_tokens
20
+ "7bit" / "8bit" / "binary" /
21
+ "quoted-printable" / "base64"
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,507 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Mail
5
+ module ContentType
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root || :content_type
10
+ end
11
+
12
+ include RFC2822
13
+
14
+ include RFC2045
15
+
16
+ module ContentType0
17
+ def CFWS1
18
+ elements[0]
19
+ end
20
+
21
+ def parameter
22
+ elements[2]
23
+ end
24
+
25
+ def CFWS2
26
+ elements[3]
27
+ end
28
+ end
29
+
30
+ module ContentType1
31
+ def main_type
32
+ elements[0]
33
+ end
34
+
35
+ def sub_type
36
+ elements[2]
37
+ end
38
+
39
+ def param_hashes
40
+ elements[3]
41
+ end
42
+ end
43
+
44
+ module ContentType2
45
+ def parameters
46
+ param_hashes.elements.map do |param|
47
+ param.parameter.param_hash
48
+ end
49
+ end
50
+ end
51
+
52
+ def _nt_content_type
53
+ start_index = index
54
+ if node_cache[:content_type].has_key?(index)
55
+ cached = node_cache[:content_type][index]
56
+ @index = cached.interval.end if cached
57
+ return cached
58
+ end
59
+
60
+ i0, s0 = index, []
61
+ r1 = _nt_main_type
62
+ s0 << r1
63
+ if r1
64
+ if has_terminal?("/", false, index)
65
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
66
+ @index += 1
67
+ else
68
+ terminal_parse_failure("/")
69
+ r2 = nil
70
+ end
71
+ s0 << r2
72
+ if r2
73
+ r3 = _nt_sub_type
74
+ s0 << r3
75
+ if r3
76
+ s4, i4 = [], index
77
+ loop do
78
+ i5, s5 = index, []
79
+ r6 = _nt_CFWS
80
+ s5 << r6
81
+ if r6
82
+ if has_terminal?(";", false, index)
83
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
84
+ @index += 1
85
+ else
86
+ terminal_parse_failure(";")
87
+ r7 = nil
88
+ end
89
+ s5 << r7
90
+ if r7
91
+ r8 = _nt_parameter
92
+ s5 << r8
93
+ if r8
94
+ r9 = _nt_CFWS
95
+ s5 << r9
96
+ end
97
+ end
98
+ end
99
+ if s5.last
100
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
101
+ r5.extend(ContentType0)
102
+ else
103
+ @index = i5
104
+ r5 = nil
105
+ end
106
+ if r5
107
+ s4 << r5
108
+ else
109
+ break
110
+ end
111
+ end
112
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
113
+ s0 << r4
114
+ end
115
+ end
116
+ end
117
+ if s0.last
118
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
119
+ r0.extend(ContentType1)
120
+ r0.extend(ContentType2)
121
+ else
122
+ @index = i0
123
+ r0 = nil
124
+ end
125
+
126
+ node_cache[:content_type][start_index] = r0
127
+
128
+ r0
129
+ end
130
+
131
+ def _nt_main_type
132
+ start_index = index
133
+ if node_cache[:main_type].has_key?(index)
134
+ cached = node_cache[:main_type][index]
135
+ @index = cached.interval.end if cached
136
+ return cached
137
+ end
138
+
139
+ i0 = index
140
+ r1 = _nt_discrete_type
141
+ if r1
142
+ r0 = r1
143
+ else
144
+ r2 = _nt_composite_type
145
+ if r2
146
+ r0 = r2
147
+ else
148
+ @index = i0
149
+ r0 = nil
150
+ end
151
+ end
152
+
153
+ node_cache[:main_type][start_index] = r0
154
+
155
+ r0
156
+ end
157
+
158
+ def _nt_discrete_type
159
+ start_index = index
160
+ if node_cache[:discrete_type].has_key?(index)
161
+ cached = node_cache[:discrete_type][index]
162
+ @index = cached.interval.end if cached
163
+ return cached
164
+ end
165
+
166
+ i0 = index
167
+ if has_terminal?("text", false, index)
168
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
169
+ @index += 4
170
+ else
171
+ terminal_parse_failure("text")
172
+ r1 = nil
173
+ end
174
+ if r1
175
+ r0 = r1
176
+ else
177
+ if has_terminal?("image", false, index)
178
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
179
+ @index += 5
180
+ else
181
+ terminal_parse_failure("image")
182
+ r2 = nil
183
+ end
184
+ if r2
185
+ r0 = r2
186
+ else
187
+ if has_terminal?("audio", false, index)
188
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
189
+ @index += 5
190
+ else
191
+ terminal_parse_failure("audio")
192
+ r3 = nil
193
+ end
194
+ if r3
195
+ r0 = r3
196
+ else
197
+ if has_terminal?("video", false, index)
198
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 5))
199
+ @index += 5
200
+ else
201
+ terminal_parse_failure("video")
202
+ r4 = nil
203
+ end
204
+ if r4
205
+ r0 = r4
206
+ else
207
+ if has_terminal?("application", false, index)
208
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 11))
209
+ @index += 11
210
+ else
211
+ terminal_parse_failure("application")
212
+ r5 = nil
213
+ end
214
+ if r5
215
+ r0 = r5
216
+ else
217
+ r6 = _nt_extension_token
218
+ if r6
219
+ r0 = r6
220
+ else
221
+ @index = i0
222
+ r0 = nil
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
229
+
230
+ node_cache[:discrete_type][start_index] = r0
231
+
232
+ r0
233
+ end
234
+
235
+ def _nt_composite_type
236
+ start_index = index
237
+ if node_cache[:composite_type].has_key?(index)
238
+ cached = node_cache[:composite_type][index]
239
+ @index = cached.interval.end if cached
240
+ return cached
241
+ end
242
+
243
+ i0 = index
244
+ if has_terminal?("message", false, index)
245
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
246
+ @index += 7
247
+ else
248
+ terminal_parse_failure("message")
249
+ r1 = nil
250
+ end
251
+ if r1
252
+ r0 = r1
253
+ else
254
+ if has_terminal?("multipart", false, index)
255
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 9))
256
+ @index += 9
257
+ else
258
+ terminal_parse_failure("multipart")
259
+ r2 = nil
260
+ end
261
+ if r2
262
+ r0 = r2
263
+ else
264
+ r3 = _nt_extension_token
265
+ if r3
266
+ r0 = r3
267
+ else
268
+ @index = i0
269
+ r0 = nil
270
+ end
271
+ end
272
+ end
273
+
274
+ node_cache[:composite_type][start_index] = r0
275
+
276
+ r0
277
+ end
278
+
279
+ def _nt_extension_token
280
+ start_index = index
281
+ if node_cache[:extension_token].has_key?(index)
282
+ cached = node_cache[:extension_token][index]
283
+ @index = cached.interval.end if cached
284
+ return cached
285
+ end
286
+
287
+ i0 = index
288
+ r1 = _nt_ietf_token
289
+ if r1
290
+ r0 = r1
291
+ else
292
+ r2 = _nt_x_token
293
+ if r2
294
+ r0 = r2
295
+ else
296
+ @index = i0
297
+ r0 = nil
298
+ end
299
+ end
300
+
301
+ node_cache[:extension_token][start_index] = r0
302
+
303
+ r0
304
+ end
305
+
306
+ def _nt_sub_type
307
+ start_index = index
308
+ if node_cache[:sub_type].has_key?(index)
309
+ cached = node_cache[:sub_type][index]
310
+ @index = cached.interval.end if cached
311
+ return cached
312
+ end
313
+
314
+ i0 = index
315
+ r1 = _nt_extension_token
316
+ if r1
317
+ r0 = r1
318
+ else
319
+ r2 = _nt_iana_token
320
+ if r2
321
+ r0 = r2
322
+ else
323
+ @index = i0
324
+ r0 = nil
325
+ end
326
+ end
327
+
328
+ node_cache[:sub_type][start_index] = r0
329
+
330
+ r0
331
+ end
332
+
333
+ module Parameter0
334
+ def attr
335
+ elements[1]
336
+ end
337
+
338
+ def val
339
+ elements[3]
340
+ end
341
+
342
+ end
343
+
344
+ module Parameter1
345
+ def param_hash
346
+ {attr.text_value => val.text_value}
347
+ end
348
+ end
349
+
350
+ def _nt_parameter
351
+ start_index = index
352
+ if node_cache[:parameter].has_key?(index)
353
+ cached = node_cache[:parameter][index]
354
+ @index = cached.interval.end if cached
355
+ return cached
356
+ end
357
+
358
+ i0, s0 = index, []
359
+ r2 = _nt_CFWS
360
+ if r2
361
+ r1 = r2
362
+ else
363
+ r1 = instantiate_node(SyntaxNode,input, index...index)
364
+ end
365
+ s0 << r1
366
+ if r1
367
+ r3 = _nt_attribute
368
+ s0 << r3
369
+ if r3
370
+ if has_terminal?("=", false, index)
371
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
372
+ @index += 1
373
+ else
374
+ terminal_parse_failure("=")
375
+ r4 = nil
376
+ end
377
+ s0 << r4
378
+ if r4
379
+ r5 = _nt_value
380
+ s0 << r5
381
+ if r5
382
+ r7 = _nt_CFWS
383
+ if r7
384
+ r6 = r7
385
+ else
386
+ r6 = instantiate_node(SyntaxNode,input, index...index)
387
+ end
388
+ s0 << r6
389
+ end
390
+ end
391
+ end
392
+ end
393
+ if s0.last
394
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
395
+ r0.extend(Parameter0)
396
+ r0.extend(Parameter1)
397
+ else
398
+ @index = i0
399
+ r0 = nil
400
+ end
401
+
402
+ node_cache[:parameter][start_index] = r0
403
+
404
+ r0
405
+ end
406
+
407
+ def _nt_attribute
408
+ start_index = index
409
+ if node_cache[:attribute].has_key?(index)
410
+ cached = node_cache[:attribute][index]
411
+ @index = cached.interval.end if cached
412
+ return cached
413
+ end
414
+
415
+ s0, i0 = [], index
416
+ loop do
417
+ r1 = _nt_token
418
+ if r1
419
+ s0 << r1
420
+ else
421
+ break
422
+ end
423
+ end
424
+ if s0.empty?
425
+ @index = i0
426
+ r0 = nil
427
+ else
428
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
429
+ end
430
+
431
+ node_cache[:attribute][start_index] = r0
432
+
433
+ r0
434
+ end
435
+
436
+ module Value0
437
+ def text_value
438
+ quoted_content.text_value
439
+ end
440
+ end
441
+
442
+ def _nt_value
443
+ start_index = index
444
+ if node_cache[:value].has_key?(index)
445
+ cached = node_cache[:value][index]
446
+ @index = cached.interval.end if cached
447
+ return cached
448
+ end
449
+
450
+ i0 = index
451
+ r1 = _nt_quoted_string
452
+ r1.extend(Value0)
453
+ if r1
454
+ r0 = r1
455
+ else
456
+ s2, i2 = [], index
457
+ loop do
458
+ i3 = index
459
+ r4 = _nt_token
460
+ if r4
461
+ r3 = r4
462
+ else
463
+ if has_terminal?('\G[\\x3d]', true, index)
464
+ r5 = true
465
+ @index += 1
466
+ else
467
+ r5 = nil
468
+ end
469
+ if r5
470
+ r3 = r5
471
+ else
472
+ @index = i3
473
+ r3 = nil
474
+ end
475
+ end
476
+ if r3
477
+ s2 << r3
478
+ else
479
+ break
480
+ end
481
+ end
482
+ if s2.empty?
483
+ @index = i2
484
+ r2 = nil
485
+ else
486
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
487
+ end
488
+ if r2
489
+ r0 = r2
490
+ else
491
+ @index = i0
492
+ r0 = nil
493
+ end
494
+ end
495
+
496
+ node_cache[:value][start_index] = r0
497
+
498
+ r0
499
+ end
500
+
501
+ end
502
+
503
+ class ContentTypeParser < Treetop::Runtime::CompiledParser
504
+ include ContentType
505
+ end
506
+
507
+ end