kbaum-mail 2.1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +289 -0
- data/README.rdoc +575 -0
- data/Rakefile +72 -0
- data/TODO.rdoc +19 -0
- data/lib/mail.rb +113 -0
- data/lib/mail/attachments_list.rb +76 -0
- data/lib/mail/body.rb +243 -0
- data/lib/mail/configuration.rb +69 -0
- data/lib/mail/core_extensions/nil.rb +11 -0
- data/lib/mail/core_extensions/string.rb +19 -0
- data/lib/mail/elements/address.rb +306 -0
- data/lib/mail/elements/address_list.rb +74 -0
- data/lib/mail/elements/content_disposition_element.rb +30 -0
- data/lib/mail/elements/content_location_element.rb +25 -0
- data/lib/mail/elements/content_transfer_encoding_element.rb +21 -0
- data/lib/mail/elements/content_type_element.rb +35 -0
- data/lib/mail/elements/date_time_element.rb +26 -0
- data/lib/mail/elements/envelope_from_element.rb +34 -0
- data/lib/mail/elements/message_ids_element.rb +29 -0
- data/lib/mail/elements/mime_version_element.rb +26 -0
- data/lib/mail/elements/phrase_list.rb +21 -0
- data/lib/mail/elements/received_element.rb +30 -0
- data/lib/mail/encodings/base64.rb +18 -0
- data/lib/mail/encodings/encodings.rb +201 -0
- data/lib/mail/encodings/quoted_printable.rb +26 -0
- data/lib/mail/envelope.rb +35 -0
- data/lib/mail/field.rb +219 -0
- data/lib/mail/field_list.rb +33 -0
- data/lib/mail/fields/bcc_field.rb +53 -0
- data/lib/mail/fields/cc_field.rb +52 -0
- data/lib/mail/fields/comments_field.rb +41 -0
- data/lib/mail/fields/common/address_container.rb +16 -0
- data/lib/mail/fields/common/common_address.rb +128 -0
- data/lib/mail/fields/common/common_date.rb +51 -0
- data/lib/mail/fields/common/common_field.rb +64 -0
- data/lib/mail/fields/common/common_message_id.rb +57 -0
- data/lib/mail/fields/common/parameter_hash.rb +39 -0
- data/lib/mail/fields/content_description_field.rb +19 -0
- data/lib/mail/fields/content_disposition_field.rb +60 -0
- data/lib/mail/fields/content_id_field.rb +63 -0
- data/lib/mail/fields/content_location_field.rb +42 -0
- data/lib/mail/fields/content_transfer_encoding_field.rb +45 -0
- data/lib/mail/fields/content_type_field.rb +175 -0
- data/lib/mail/fields/date_field.rb +53 -0
- data/lib/mail/fields/from_field.rb +53 -0
- data/lib/mail/fields/in_reply_to_field.rb +52 -0
- data/lib/mail/fields/keywords_field.rb +43 -0
- data/lib/mail/fields/message_id_field.rb +80 -0
- data/lib/mail/fields/mime_version_field.rb +54 -0
- data/lib/mail/fields/optional_field.rb +11 -0
- data/lib/mail/fields/received_field.rb +62 -0
- data/lib/mail/fields/references_field.rb +53 -0
- data/lib/mail/fields/reply_to_field.rb +53 -0
- data/lib/mail/fields/resent_bcc_field.rb +53 -0
- data/lib/mail/fields/resent_cc_field.rb +53 -0
- data/lib/mail/fields/resent_date_field.rb +33 -0
- data/lib/mail/fields/resent_from_field.rb +53 -0
- data/lib/mail/fields/resent_message_id_field.rb +32 -0
- data/lib/mail/fields/resent_sender_field.rb +60 -0
- data/lib/mail/fields/resent_to_field.rb +53 -0
- data/lib/mail/fields/return_path_field.rb +62 -0
- data/lib/mail/fields/sender_field.rb +65 -0
- data/lib/mail/fields/structured_field.rb +36 -0
- data/lib/mail/fields/subject_field.rb +15 -0
- data/lib/mail/fields/to_field.rb +53 -0
- data/lib/mail/fields/unstructured_field.rb +117 -0
- data/lib/mail/header.rb +235 -0
- data/lib/mail/mail.rb +194 -0
- data/lib/mail/message.rb +1780 -0
- data/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
- data/lib/mail/network/delivery_methods/sendmail.rb +62 -0
- data/lib/mail/network/delivery_methods/smtp.rb +110 -0
- data/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
- data/lib/mail/network/retriever_methods/imap.rb +31 -0
- data/lib/mail/network/retriever_methods/pop3.rb +149 -0
- data/lib/mail/parsers/address_lists.rb +61 -0
- data/lib/mail/parsers/address_lists.treetop +19 -0
- data/lib/mail/parsers/content_disposition.rb +369 -0
- data/lib/mail/parsers/content_disposition.treetop +46 -0
- data/lib/mail/parsers/content_location.rb +133 -0
- data/lib/mail/parsers/content_location.treetop +20 -0
- data/lib/mail/parsers/content_transfer_encoding.rb +179 -0
- data/lib/mail/parsers/content_transfer_encoding.treetop +25 -0
- data/lib/mail/parsers/content_type.rb +512 -0
- data/lib/mail/parsers/content_type.treetop +58 -0
- data/lib/mail/parsers/date_time.rb +111 -0
- data/lib/mail/parsers/date_time.treetop +11 -0
- data/lib/mail/parsers/envelope_from.rb +188 -0
- data/lib/mail/parsers/envelope_from.treetop +32 -0
- data/lib/mail/parsers/message_ids.rb +42 -0
- data/lib/mail/parsers/message_ids.treetop +15 -0
- data/lib/mail/parsers/mime_version.rb +141 -0
- data/lib/mail/parsers/mime_version.treetop +19 -0
- data/lib/mail/parsers/phrase_lists.rb +42 -0
- data/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/lib/mail/parsers/received.rb +68 -0
- data/lib/mail/parsers/received.treetop +11 -0
- data/lib/mail/parsers/rfc2045.rb +406 -0
- data/lib/mail/parsers/rfc2045.treetop +35 -0
- data/lib/mail/parsers/rfc2822.rb +5081 -0
- data/lib/mail/parsers/rfc2822.treetop +410 -0
- data/lib/mail/parsers/rfc2822_obsolete.rb +3607 -0
- data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/lib/mail/part.rb +82 -0
- data/lib/mail/parts_list.rb +34 -0
- data/lib/mail/patterns.rb +43 -0
- data/lib/mail/utilities.rb +163 -0
- data/lib/mail/vendor/treetop.rb +4 -0
- data/lib/mail/version.rb +10 -0
- data/lib/mail/version_specific/ruby_1_8.rb +84 -0
- data/lib/mail/version_specific/ruby_1_9.rb +77 -0
- data/lib/tasks/corpus.rake +125 -0
- data/lib/tasks/treetop.rake +10 -0
- metadata +188 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
module Mail
|
2
|
+
grammar AddressLists
|
3
|
+
|
4
|
+
include RFC2822
|
5
|
+
|
6
|
+
rule primary_address
|
7
|
+
address_list {
|
8
|
+
def addresses
|
9
|
+
[first_addr] + other_addr.elements.map { |o| o.addr_value }
|
10
|
+
end
|
11
|
+
} / obs_addr_list {
|
12
|
+
def addresses
|
13
|
+
[first_addr] + other_addr.elements.map { |o| o.addr_value }
|
14
|
+
end
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,369 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module ContentDisposition
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :content_disposition
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
include RFC2045
|
15
|
+
|
16
|
+
module ContentDisposition0
|
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 ContentDisposition1
|
31
|
+
def disposition_type
|
32
|
+
elements[0]
|
33
|
+
end
|
34
|
+
|
35
|
+
def param_hashes
|
36
|
+
elements[1]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module ContentDisposition2
|
41
|
+
def parameters
|
42
|
+
param_hashes.elements.map do |param|
|
43
|
+
param.parameter.param_hash
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def _nt_content_disposition
|
49
|
+
start_index = index
|
50
|
+
if node_cache[:content_disposition].has_key?(index)
|
51
|
+
cached = node_cache[:content_disposition][index]
|
52
|
+
@index = cached.interval.end if cached
|
53
|
+
return cached
|
54
|
+
end
|
55
|
+
|
56
|
+
i0, s0 = index, []
|
57
|
+
r1 = _nt_disposition_type
|
58
|
+
s0 << r1
|
59
|
+
if r1
|
60
|
+
s2, i2 = [], index
|
61
|
+
loop do
|
62
|
+
i3, s3 = index, []
|
63
|
+
r4 = _nt_CFWS
|
64
|
+
s3 << r4
|
65
|
+
if r4
|
66
|
+
if has_terminal?(";", false, index)
|
67
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
68
|
+
@index += 1
|
69
|
+
else
|
70
|
+
terminal_parse_failure(";")
|
71
|
+
r5 = nil
|
72
|
+
end
|
73
|
+
s3 << r5
|
74
|
+
if r5
|
75
|
+
r6 = _nt_parameter
|
76
|
+
s3 << r6
|
77
|
+
if r6
|
78
|
+
r7 = _nt_CFWS
|
79
|
+
s3 << r7
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
if s3.last
|
84
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
85
|
+
r3.extend(ContentDisposition0)
|
86
|
+
else
|
87
|
+
@index = i3
|
88
|
+
r3 = nil
|
89
|
+
end
|
90
|
+
if r3
|
91
|
+
s2 << r3
|
92
|
+
else
|
93
|
+
break
|
94
|
+
end
|
95
|
+
end
|
96
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
97
|
+
s0 << r2
|
98
|
+
end
|
99
|
+
if s0.last
|
100
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
101
|
+
r0.extend(ContentDisposition1)
|
102
|
+
r0.extend(ContentDisposition2)
|
103
|
+
else
|
104
|
+
@index = i0
|
105
|
+
r0 = nil
|
106
|
+
end
|
107
|
+
|
108
|
+
node_cache[:content_disposition][start_index] = r0
|
109
|
+
|
110
|
+
r0
|
111
|
+
end
|
112
|
+
|
113
|
+
def _nt_disposition_type
|
114
|
+
start_index = index
|
115
|
+
if node_cache[:disposition_type].has_key?(index)
|
116
|
+
cached = node_cache[:disposition_type][index]
|
117
|
+
@index = cached.interval.end if cached
|
118
|
+
return cached
|
119
|
+
end
|
120
|
+
|
121
|
+
i0 = index
|
122
|
+
if has_terminal?("inline", false, index)
|
123
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
124
|
+
@index += 6
|
125
|
+
else
|
126
|
+
terminal_parse_failure("inline")
|
127
|
+
r1 = nil
|
128
|
+
end
|
129
|
+
if r1
|
130
|
+
r0 = r1
|
131
|
+
else
|
132
|
+
if has_terminal?("attachment", false, index)
|
133
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 10))
|
134
|
+
@index += 10
|
135
|
+
else
|
136
|
+
terminal_parse_failure("attachment")
|
137
|
+
r2 = nil
|
138
|
+
end
|
139
|
+
if r2
|
140
|
+
r0 = r2
|
141
|
+
else
|
142
|
+
r3 = _nt_extension_token
|
143
|
+
if r3
|
144
|
+
r0 = r3
|
145
|
+
else
|
146
|
+
if has_terminal?('', false, index)
|
147
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
148
|
+
@index += 0
|
149
|
+
else
|
150
|
+
terminal_parse_failure('')
|
151
|
+
r4 = nil
|
152
|
+
end
|
153
|
+
if r4
|
154
|
+
r0 = r4
|
155
|
+
else
|
156
|
+
@index = i0
|
157
|
+
r0 = nil
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
node_cache[:disposition_type][start_index] = r0
|
164
|
+
|
165
|
+
r0
|
166
|
+
end
|
167
|
+
|
168
|
+
def _nt_extension_token
|
169
|
+
start_index = index
|
170
|
+
if node_cache[:extension_token].has_key?(index)
|
171
|
+
cached = node_cache[:extension_token][index]
|
172
|
+
@index = cached.interval.end if cached
|
173
|
+
return cached
|
174
|
+
end
|
175
|
+
|
176
|
+
i0 = index
|
177
|
+
r1 = _nt_ietf_token
|
178
|
+
if r1
|
179
|
+
r0 = r1
|
180
|
+
else
|
181
|
+
r2 = _nt_x_token
|
182
|
+
if r2
|
183
|
+
r0 = r2
|
184
|
+
else
|
185
|
+
@index = i0
|
186
|
+
r0 = nil
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
node_cache[:extension_token][start_index] = r0
|
191
|
+
|
192
|
+
r0
|
193
|
+
end
|
194
|
+
|
195
|
+
module Parameter0
|
196
|
+
def attr
|
197
|
+
elements[1]
|
198
|
+
end
|
199
|
+
|
200
|
+
def val
|
201
|
+
elements[3]
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
module Parameter1
|
207
|
+
def param_hash
|
208
|
+
{attr.text_value => val.text_value}
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def _nt_parameter
|
213
|
+
start_index = index
|
214
|
+
if node_cache[:parameter].has_key?(index)
|
215
|
+
cached = node_cache[:parameter][index]
|
216
|
+
@index = cached.interval.end if cached
|
217
|
+
return cached
|
218
|
+
end
|
219
|
+
|
220
|
+
i0, s0 = index, []
|
221
|
+
r2 = _nt_CFWS
|
222
|
+
if r2
|
223
|
+
r1 = r2
|
224
|
+
else
|
225
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
226
|
+
end
|
227
|
+
s0 << r1
|
228
|
+
if r1
|
229
|
+
r3 = _nt_attribute
|
230
|
+
s0 << r3
|
231
|
+
if r3
|
232
|
+
if has_terminal?("=", false, index)
|
233
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
234
|
+
@index += 1
|
235
|
+
else
|
236
|
+
terminal_parse_failure("=")
|
237
|
+
r4 = nil
|
238
|
+
end
|
239
|
+
s0 << r4
|
240
|
+
if r4
|
241
|
+
r5 = _nt_value
|
242
|
+
s0 << r5
|
243
|
+
if r5
|
244
|
+
r7 = _nt_CFWS
|
245
|
+
if r7
|
246
|
+
r6 = r7
|
247
|
+
else
|
248
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
249
|
+
end
|
250
|
+
s0 << r6
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
if s0.last
|
256
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
257
|
+
r0.extend(Parameter0)
|
258
|
+
r0.extend(Parameter1)
|
259
|
+
else
|
260
|
+
@index = i0
|
261
|
+
r0 = nil
|
262
|
+
end
|
263
|
+
|
264
|
+
node_cache[:parameter][start_index] = r0
|
265
|
+
|
266
|
+
r0
|
267
|
+
end
|
268
|
+
|
269
|
+
def _nt_attribute
|
270
|
+
start_index = index
|
271
|
+
if node_cache[:attribute].has_key?(index)
|
272
|
+
cached = node_cache[:attribute][index]
|
273
|
+
@index = cached.interval.end if cached
|
274
|
+
return cached
|
275
|
+
end
|
276
|
+
|
277
|
+
s0, i0 = [], index
|
278
|
+
loop do
|
279
|
+
r1 = _nt_token
|
280
|
+
if r1
|
281
|
+
s0 << r1
|
282
|
+
else
|
283
|
+
break
|
284
|
+
end
|
285
|
+
end
|
286
|
+
if s0.empty?
|
287
|
+
@index = i0
|
288
|
+
r0 = nil
|
289
|
+
else
|
290
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
291
|
+
end
|
292
|
+
|
293
|
+
node_cache[:attribute][start_index] = r0
|
294
|
+
|
295
|
+
r0
|
296
|
+
end
|
297
|
+
|
298
|
+
module Value0
|
299
|
+
def text_value
|
300
|
+
quoted_content.text_value
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def _nt_value
|
305
|
+
start_index = index
|
306
|
+
if node_cache[:value].has_key?(index)
|
307
|
+
cached = node_cache[:value][index]
|
308
|
+
@index = cached.interval.end if cached
|
309
|
+
return cached
|
310
|
+
end
|
311
|
+
|
312
|
+
i0 = index
|
313
|
+
r1 = _nt_quoted_string
|
314
|
+
r1.extend(Value0)
|
315
|
+
if r1
|
316
|
+
r0 = r1
|
317
|
+
else
|
318
|
+
s2, i2 = [], index
|
319
|
+
loop do
|
320
|
+
i3 = index
|
321
|
+
r4 = _nt_token
|
322
|
+
if r4
|
323
|
+
r3 = r4
|
324
|
+
else
|
325
|
+
if has_terminal?('\G[\\x3d]', true, index)
|
326
|
+
r5 = true
|
327
|
+
@index += 1
|
328
|
+
else
|
329
|
+
r5 = nil
|
330
|
+
end
|
331
|
+
if r5
|
332
|
+
r3 = r5
|
333
|
+
else
|
334
|
+
@index = i3
|
335
|
+
r3 = nil
|
336
|
+
end
|
337
|
+
end
|
338
|
+
if r3
|
339
|
+
s2 << r3
|
340
|
+
else
|
341
|
+
break
|
342
|
+
end
|
343
|
+
end
|
344
|
+
if s2.empty?
|
345
|
+
@index = i2
|
346
|
+
r2 = nil
|
347
|
+
else
|
348
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
349
|
+
end
|
350
|
+
if r2
|
351
|
+
r0 = r2
|
352
|
+
else
|
353
|
+
@index = i0
|
354
|
+
r0 = nil
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
node_cache[:value][start_index] = r0
|
359
|
+
|
360
|
+
r0
|
361
|
+
end
|
362
|
+
|
363
|
+
end
|
364
|
+
|
365
|
+
class ContentDispositionParser < Treetop::Runtime::CompiledParser
|
366
|
+
include ContentDisposition
|
367
|
+
end
|
368
|
+
|
369
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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
|
+
|
25
|
+
rule parameter
|
26
|
+
CFWS? attr:attribute "=" val:value CFWS? {
|
27
|
+
def param_hash
|
28
|
+
{attr.text_value => val.text_value}
|
29
|
+
end
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
rule attribute
|
34
|
+
token+
|
35
|
+
end
|
36
|
+
|
37
|
+
rule value
|
38
|
+
quoted_string {
|
39
|
+
def text_value
|
40
|
+
quoted_content.text_value
|
41
|
+
end
|
42
|
+
} / (token / [\x3d])+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module ContentLocation
|
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 location
|
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_location
|
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 Location0
|
63
|
+
def text_value
|
64
|
+
quoted_content.text_value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def _nt_location
|
69
|
+
start_index = index
|
70
|
+
if node_cache[:location].has_key?(index)
|
71
|
+
cached = node_cache[:location][index]
|
72
|
+
@index = cached.interval.end if cached
|
73
|
+
return cached
|
74
|
+
end
|
75
|
+
|
76
|
+
i0 = index
|
77
|
+
r1 = _nt_quoted_string
|
78
|
+
r1.extend(Location0)
|
79
|
+
if r1
|
80
|
+
r0 = r1
|
81
|
+
else
|
82
|
+
s2, i2 = [], index
|
83
|
+
loop do
|
84
|
+
i3 = index
|
85
|
+
r4 = _nt_token
|
86
|
+
if r4
|
87
|
+
r3 = r4
|
88
|
+
else
|
89
|
+
if has_terminal?('\G[\\x3d]', true, index)
|
90
|
+
r5 = true
|
91
|
+
@index += 1
|
92
|
+
else
|
93
|
+
r5 = nil
|
94
|
+
end
|
95
|
+
if r5
|
96
|
+
r3 = r5
|
97
|
+
else
|
98
|
+
@index = i3
|
99
|
+
r3 = nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
if r3
|
103
|
+
s2 << r3
|
104
|
+
else
|
105
|
+
break
|
106
|
+
end
|
107
|
+
end
|
108
|
+
if s2.empty?
|
109
|
+
@index = i2
|
110
|
+
r2 = nil
|
111
|
+
else
|
112
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
113
|
+
end
|
114
|
+
if r2
|
115
|
+
r0 = r2
|
116
|
+
else
|
117
|
+
@index = i0
|
118
|
+
r0 = nil
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
node_cache[:location][start_index] = r0
|
123
|
+
|
124
|
+
r0
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
class ContentLocationParser < Treetop::Runtime::CompiledParser
|
130
|
+
include ContentLocation
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|