Module: Mail::ContentType
Defined Under Namespace
Modules: CompositeType0, CompositeType1, ContentType0, ContentType1, ContentType2, DiscreteType0, DiscreteType1, DiscreteType2, DiscreteType3, DiscreteType4, Parameter0, Parameter1, Value0
Instance Method Summary
collapse
Methods included from RFC2045
#_nt_custom_x_token, #_nt_iana_token, #_nt_ietf_token, #_nt_token, #_nt_tspecials
Methods included from RFC2822
#_nt_ALPHA, #_nt_CFWS, #_nt_CR, #_nt_CRLF, #_nt_DIGIT, #_nt_DQUOTE, #_nt_FWS, #_nt_LF, #_nt_NO_WS_CTL, #_nt_WSP, #_nt_addr_spec, #_nt_address, #_nt_address_list, #_nt_angle_addr, #_nt_atext, #_nt_atom, #_nt_ccontent, #_nt_comment, #_nt_ctext, #_nt_date, #_nt_date_time, #_nt_day, #_nt_day_name, #_nt_day_of_week, #_nt_dcontent, #_nt_display_name, #_nt_domain, #_nt_domain_literal, #_nt_domain_text, #_nt_dot_atom, #_nt_dot_atom_text, #_nt_dtext, #_nt_group, #_nt_hour, #_nt_id_left, #_nt_id_right, #_nt_item_name, #_nt_item_value, #_nt_local_dot_atom, #_nt_local_dot_atom_text, #_nt_local_part, #_nt_mailbox, #_nt_mailbox_list, #_nt_mailbox_list_group, #_nt_message_id_text, #_nt_message_ids, #_nt_minute, #_nt_month, #_nt_month_name, #_nt_msg_id, #_nt_msg_id_atext, #_nt_msg_id_domain_text, #_nt_msg_id_dot_atom_text, #_nt_msg_id_value, #_nt_mtext, #_nt_name_addr, #_nt_name_val_list, #_nt_name_val_pair, #_nt_no_fold_literal, #_nt_no_fold_quote, #_nt_path, #_nt_phrase, #_nt_phrase_list, #_nt_qcontent, #_nt_qdcontent, #_nt_qtext, #_nt_quoted_domain, #_nt_quoted_pair, #_nt_quoted_string, #_nt_received, #_nt_return, #_nt_second, #_nt_specials, #_nt_text, #_nt_time, #_nt_time_of_day, #_nt_word, #_nt_year, #_nt_zone
#_nt_obs_FWS, #_nt_obs_addr_list, #_nt_obs_angle_addr, #_nt_obs_bcc, #_nt_obs_cc, #_nt_obs_char, #_nt_obs_comments, #_nt_obs_day, #_nt_obs_day_of_week, #_nt_obs_domain, #_nt_obs_domain_list, #_nt_obs_fields, #_nt_obs_from, #_nt_obs_hour, #_nt_obs_id_left, #_nt_obs_id_right, #_nt_obs_in_reply_to, #_nt_obs_keywords, #_nt_obs_local_part, #_nt_obs_mbox_list, #_nt_obs_message_id, #_nt_obs_minute, #_nt_obs_month, #_nt_obs_optional, #_nt_obs_orig_date, #_nt_obs_path, #_nt_obs_phrase, #_nt_obs_phrase_list, #_nt_obs_qp, #_nt_obs_received, #_nt_obs_references, #_nt_obs_reply_to, #_nt_obs_resent_bcc, #_nt_obs_resent_cc, #_nt_obs_resent_date, #_nt_obs_resent_from, #_nt_obs_resent_mid, #_nt_obs_resent_rply, #_nt_obs_resent_send, #_nt_obs_resent_to, #_nt_obs_return, #_nt_obs_route, #_nt_obs_second, #_nt_obs_sender, #_nt_obs_subject, #_nt_obs_text, #_nt_obs_to, #_nt_obs_utext, #_nt_obs_year, #_nt_obs_zone
Instance Method Details
#_nt_attribute ⇒ Object
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
|
# File 'lib/mail/parsers/content_type.rb', line 861
def _nt_attribute
start_index = index
if node_cache[:attribute].has_key?(index)
cached = node_cache[:attribute][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
s0, i0 = [], index
loop do
r1 = _nt_token
if r1
s0 << r1
else
break
end
end
if s0.empty?
@index = i0
r0 = nil
else
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
end
node_cache[:attribute][start_index] = r0
r0
end
|
#_nt_composite_type ⇒ Object
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
|
# File 'lib/mail/parsers/content_type.rb', line 535
def _nt_composite_type
start_index = index
if node_cache[:composite_type].has_key?(index)
cached = node_cache[:composite_type][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
i1, s1 = index, []
if has_terminal?('\G[mM]', true, index)
r2 = true
@index += 1
else
r2 = nil
end
s1 << r2
if r2
if has_terminal?('\G[eE]', true, index)
r3 = true
@index += 1
else
r3 = nil
end
s1 << r3
if r3
if has_terminal?('\G[sS]', true, index)
r4 = true
@index += 1
else
r4 = nil
end
s1 << r4
if r4
if has_terminal?('\G[sS]', true, index)
r5 = true
@index += 1
else
r5 = nil
end
s1 << r5
if r5
if has_terminal?('\G[aA]', true, index)
r6 = true
@index += 1
else
r6 = nil
end
s1 << r6
if r6
if has_terminal?('\G[gG]', true, index)
r7 = true
@index += 1
else
r7 = nil
end
s1 << r7
if r7
if has_terminal?('\G[eE]', true, index)
r8 = true
@index += 1
else
r8 = nil
end
s1 << r8
end
end
end
end
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
r1.extend(CompositeType0)
else
@index = i1
r1 = nil
end
if r1
r0 = r1
else
i9, s9 = index, []
if has_terminal?('\G[mM]', true, index)
r10 = true
@index += 1
else
r10 = nil
end
s9 << r10
if r10
if has_terminal?('\G[uU]', true, index)
r11 = true
@index += 1
else
r11 = nil
end
s9 << r11
if r11
if has_terminal?('\G[lL]', true, index)
r12 = true
@index += 1
else
r12 = nil
end
s9 << r12
if r12
if has_terminal?('\G[tT]', true, index)
r13 = true
@index += 1
else
r13 = nil
end
s9 << r13
if r13
if has_terminal?('\G[iI]', true, index)
r14 = true
@index += 1
else
r14 = nil
end
s9 << r14
if r14
if has_terminal?('\G[pP]', true, index)
r15 = true
@index += 1
else
r15 = nil
end
s9 << r15
if r15
if has_terminal?('\G[aA]', true, index)
r16 = true
@index += 1
else
r16 = nil
end
s9 << r16
if r16
if has_terminal?('\G[rR]', true, index)
r17 = true
@index += 1
else
r17 = nil
end
s9 << r17
if r17
if has_terminal?('\G[tT]', true, index)
r18 = true
@index += 1
else
r18 = nil
end
s9 << r18
end
end
end
end
end
end
end
end
if s9.last
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
r9.extend(CompositeType1)
else
@index = i9
r9 = nil
end
if r9
r0 = r9
else
r19 = _nt_extension_token
if r19
r0 = r19
else
@index = i0
r0 = nil
end
end
end
node_cache[:composite_type][start_index] = r0
r0
end
|
#_nt_content_type ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# File 'lib/mail/parsers/content_type.rb', line 52
def _nt_content_type
start_index = index
if node_cache[:content_type].has_key?(index)
cached = node_cache[:content_type][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
r1 = _nt_main_type
s0 << r1
if r1
if has_terminal?("/", false, index)
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("/")
r2 = nil
end
s0 << r2
if r2
r3 = _nt_sub_type
s0 << r3
if r3
s4, i4 = [], index
loop do
i5, s5 = index, []
r6 = _nt_CFWS
s5 << r6
if r6
if has_terminal?(";", false, index)
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure(";")
r8 = nil
end
if r8
r7 = r8
else
r7 = instantiate_node(SyntaxNode,input, index...index)
end
s5 << r7
if r7
r9 = _nt_parameter
s5 << r9
if r9
r10 = _nt_CFWS
s5 << r10
end
end
end
if s5.last
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
r5.extend(ContentType0)
else
@index = i5
r5 = nil
end
if r5
s4 << r5
else
break
end
end
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
s0 << r4
end
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(ContentType1)
r0.extend(ContentType2)
else
@index = i0
r0 = nil
end
node_cache[:content_type][start_index] = r0
r0
end
|
#_nt_discrete_type ⇒ Object
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
|
# File 'lib/mail/parsers/content_type.rb', line 184
def _nt_discrete_type
start_index = index
if node_cache[:discrete_type].has_key?(index)
cached = node_cache[:discrete_type][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
i1, s1 = index, []
if has_terminal?('\G[tT]', true, index)
r2 = true
@index += 1
else
r2 = nil
end
s1 << r2
if r2
if has_terminal?('\G[eE]', true, index)
r3 = true
@index += 1
else
r3 = nil
end
s1 << r3
if r3
if has_terminal?('\G[xX]', true, index)
r4 = true
@index += 1
else
r4 = nil
end
s1 << r4
if r4
if has_terminal?('\G[tT]', true, index)
r5 = true
@index += 1
else
r5 = nil
end
s1 << r5
end
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
r1.extend(DiscreteType0)
else
@index = i1
r1 = nil
end
if r1
r0 = r1
else
i6, s6 = index, []
if has_terminal?('\G[iI]', true, index)
r7 = true
@index += 1
else
r7 = nil
end
s6 << r7
if r7
if has_terminal?('\G[mM]', true, index)
r8 = true
@index += 1
else
r8 = nil
end
s6 << r8
if r8
if has_terminal?('\G[aA]', true, index)
r9 = true
@index += 1
else
r9 = nil
end
s6 << r9
if r9
if has_terminal?('\G[gG]', true, index)
r10 = true
@index += 1
else
r10 = nil
end
s6 << r10
if r10
if has_terminal?('\G[eE]', true, index)
r11 = true
@index += 1
else
r11 = nil
end
s6 << r11
end
end
end
end
if s6.last
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
r6.extend(DiscreteType1)
else
@index = i6
r6 = nil
end
if r6
r0 = r6
else
i12, s12 = index, []
if has_terminal?('\G[aA]', true, index)
r13 = true
@index += 1
else
r13 = nil
end
s12 << r13
if r13
if has_terminal?('\G[uU]', true, index)
r14 = true
@index += 1
else
r14 = nil
end
s12 << r14
if r14
if has_terminal?('\G[dD]', true, index)
r15 = true
@index += 1
else
r15 = nil
end
s12 << r15
if r15
if has_terminal?('\G[iI]', true, index)
r16 = true
@index += 1
else
r16 = nil
end
s12 << r16
if r16
if has_terminal?('\G[oO]', true, index)
r17 = true
@index += 1
else
r17 = nil
end
s12 << r17
end
end
end
end
if s12.last
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
r12.extend(DiscreteType2)
else
@index = i12
r12 = nil
end
if r12
r0 = r12
else
i18, s18 = index, []
if has_terminal?('\G[vV]', true, index)
r19 = true
@index += 1
else
r19 = nil
end
s18 << r19
if r19
if has_terminal?('\G[iI]', true, index)
r20 = true
@index += 1
else
r20 = nil
end
s18 << r20
if r20
if has_terminal?('\G[dD]', true, index)
r21 = true
@index += 1
else
r21 = nil
end
s18 << r21
if r21
if has_terminal?('\G[eE]', true, index)
r22 = true
@index += 1
else
r22 = nil
end
s18 << r22
if r22
if has_terminal?('\G[oO]', true, index)
r23 = true
@index += 1
else
r23 = nil
end
s18 << r23
end
end
end
end
if s18.last
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
r18.extend(DiscreteType3)
else
@index = i18
r18 = nil
end
if r18
r0 = r18
else
i24, s24 = index, []
if has_terminal?('\G[aA]', true, index)
r25 = true
@index += 1
else
r25 = nil
end
s24 << r25
if r25
if has_terminal?('\G[pP]', true, index)
r26 = true
@index += 1
else
r26 = nil
end
s24 << r26
if r26
if has_terminal?('\G[pP]', true, index)
r27 = true
@index += 1
else
r27 = nil
end
s24 << r27
if r27
if has_terminal?('\G[lL]', true, index)
r28 = true
@index += 1
else
r28 = nil
end
s24 << r28
if r28
if has_terminal?('\G[iI]', true, index)
r29 = true
@index += 1
else
r29 = nil
end
s24 << r29
if r29
if has_terminal?('\G[cC]', true, index)
r30 = true
@index += 1
else
r30 = nil
end
s24 << r30
if r30
if has_terminal?('\G[aA]', true, index)
r31 = true
@index += 1
else
r31 = nil
end
s24 << r31
if r31
if has_terminal?('\G[tT]', true, index)
r32 = true
@index += 1
else
r32 = nil
end
s24 << r32
if r32
if has_terminal?('\G[iI]', true, index)
r33 = true
@index += 1
else
r33 = nil
end
s24 << r33
if r33
if has_terminal?('\G[oO]', true, index)
r34 = true
@index += 1
else
r34 = nil
end
s24 << r34
if r34
if has_terminal?('\G[nN]', true, index)
r35 = true
@index += 1
else
r35 = nil
end
s24 << r35
end
end
end
end
end
end
end
end
end
end
if s24.last
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
r24.extend(DiscreteType4)
else
@index = i24
r24 = nil
end
if r24
r0 = r24
else
r36 = _nt_extension_token
if r36
r0 = r36
else
@index = i0
r0 = nil
end
end
end
end
end
end
node_cache[:discrete_type][start_index] = r0
r0
end
|
#_nt_extension_token ⇒ Object
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
# File 'lib/mail/parsers/content_type.rb', line 724
def _nt_extension_token
start_index = index
if node_cache[:extension_token].has_key?(index)
cached = node_cache[:extension_token][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_ietf_token
if r1
r0 = r1
else
r2 = _nt_custom_x_token
if r2
r0 = r2
else
@index = i0
r0 = nil
end
end
node_cache[:extension_token][start_index] = r0
r0
end
|
#_nt_main_type ⇒ Object
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/mail/parsers/content_type.rb', line 139
def _nt_main_type
start_index = index
if node_cache[:main_type].has_key?(index)
cached = node_cache[:main_type][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_discrete_type
if r1
r0 = r1
else
r2 = _nt_composite_type
if r2
r0 = r2
else
@index = i0
r0 = nil
end
end
node_cache[:main_type][start_index] = r0
r0
end
|
#_nt_parameter ⇒ Object
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
|
# File 'lib/mail/parsers/content_type.rb', line 801
def _nt_parameter
start_index = index
if node_cache[:parameter].has_key?(index)
cached = node_cache[:parameter][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
r2 = _nt_CFWS
if r2
r1 = r2
else
r1 = instantiate_node(SyntaxNode,input, index...index)
end
s0 << r1
if r1
r3 = _nt_attribute
s0 << r3
if r3
if has_terminal?("=", false, index)
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("=")
r4 = nil
end
s0 << r4
if r4
r5 = _nt_value
s0 << r5
if r5
r7 = _nt_CFWS
if r7
r6 = r7
else
r6 = instantiate_node(SyntaxNode,input, index...index)
end
s0 << r6
end
end
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Parameter0)
r0.extend(Parameter1)
else
@index = i0
r0 = nil
end
node_cache[:parameter][start_index] = r0
r0
end
|
#_nt_sub_type ⇒ Object
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
|
# File 'lib/mail/parsers/content_type.rb', line 754
def _nt_sub_type
start_index = index
if node_cache[:sub_type].has_key?(index)
cached = node_cache[:sub_type][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_extension_token
if r1
r0 = r1
else
r2 = _nt_iana_token
if r2
r0 = r2
else
@index = i0
r0 = nil
end
end
node_cache[:sub_type][start_index] = r0
r0
end
|
#_nt_value ⇒ Object
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
|
# File 'lib/mail/parsers/content_type.rb', line 899
def _nt_value
start_index = index
if node_cache[:value].has_key?(index)
cached = node_cache[:value][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_quoted_string
r1.extend(Value0)
if r1
r0 = r1
else
s2, i2 = [], index
loop do
i3 = index
r4 = _nt_token
if r4
r3 = r4
else
if has_terminal?('\G[\\x3d]', true, index)
r5 = true
@index += 1
else
r5 = nil
end
if r5
r3 = r5
else
@index = i3
r3 = nil
end
end
if r3
s2 << r3
else
break
end
end
if s2.empty?
@index = i2
r2 = nil
else
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
end
if r2
r0 = r2
else
@index = i0
r0 = nil
end
end
node_cache[:value][start_index] = r0
r0
end
|
#root ⇒ Object
8
9
10
|
# File 'lib/mail/parsers/content_type.rb', line 8
def root
@root ||= :content_type
end
|