mail 2.5.5 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +8 -9
  3. data/CONTRIBUTING.md +13 -0
  4. data/Dependencies.txt +0 -1
  5. data/Gemfile +7 -24
  6. data/README.md +36 -15
  7. data/Rakefile +10 -2
  8. data/VERSION +4 -0
  9. data/lib/mail.rb +1 -1
  10. data/lib/mail/body.rb +2 -2
  11. data/lib/mail/check_delivery_params.rb +10 -47
  12. data/lib/mail/core_extensions/string.rb +12 -2
  13. data/lib/mail/elements/address.rb +38 -82
  14. data/lib/mail/elements/address_list.rb +19 -42
  15. data/lib/mail/elements/content_disposition_element.rb +3 -7
  16. data/lib/mail/elements/content_location_element.rb +2 -6
  17. data/lib/mail/elements/content_transfer_encoding_element.rb +3 -10
  18. data/lib/mail/elements/content_type_element.rb +4 -8
  19. data/lib/mail/elements/date_time_element.rb +3 -7
  20. data/lib/mail/elements/envelope_from_element.rb +3 -11
  21. data/lib/mail/elements/message_ids_element.rb +1 -6
  22. data/lib/mail/elements/mime_version_element.rb +3 -7
  23. data/lib/mail/elements/phrase_list.rb +2 -7
  24. data/lib/mail/elements/received_element.rb +3 -7
  25. data/lib/mail/encodings.rb +0 -1
  26. data/lib/mail/envelope.rb +0 -5
  27. data/lib/mail/field.rb +53 -17
  28. data/lib/mail/field_list.rb +18 -18
  29. data/lib/mail/fields/common/common_address.rb +15 -20
  30. data/lib/mail/fields/common/common_date.rb +0 -7
  31. data/lib/mail/fields/common/common_field.rb +1 -1
  32. data/lib/mail/fields/content_transfer_encoding_field.rb +0 -6
  33. data/lib/mail/fields/resent_sender_field.rb +1 -1
  34. data/lib/mail/fields/sender_field.rb +1 -1
  35. data/lib/mail/fields/unstructured_field.rb +7 -1
  36. data/lib/mail/header.rb +8 -22
  37. data/lib/mail/mail.rb +12 -0
  38. data/lib/mail/matchers/has_sent_mail.rb +34 -1
  39. data/lib/mail/message.rb +18 -11
  40. data/lib/mail/multibyte/unicode.rb +1 -1
  41. data/lib/mail/network/delivery_methods/exim.rb +10 -6
  42. data/lib/mail/network/delivery_methods/file_delivery.rb +8 -4
  43. data/lib/mail/network/delivery_methods/sendmail.rb +7 -9
  44. data/lib/mail/network/delivery_methods/smtp.rb +5 -2
  45. data/lib/mail/network/delivery_methods/smtp_connection.rb +6 -2
  46. data/lib/mail/network/delivery_methods/test_mailer.rb +8 -5
  47. data/lib/mail/network/retriever_methods/imap.rb +18 -13
  48. data/lib/mail/parsers.rb +26 -0
  49. data/lib/mail/parsers/address_lists_parser.rb +132 -0
  50. data/lib/mail/parsers/content_disposition_parser.rb +67 -0
  51. data/lib/mail/parsers/content_location_parser.rb +35 -0
  52. data/lib/mail/parsers/content_transfer_encoding_parser.rb +33 -0
  53. data/lib/mail/parsers/content_type_parser.rb +64 -0
  54. data/lib/mail/parsers/date_time_parser.rb +36 -0
  55. data/lib/mail/parsers/envelope_from_parser.rb +45 -0
  56. data/lib/mail/parsers/message_ids_parser.rb +39 -0
  57. data/lib/mail/parsers/mime_version_parser.rb +41 -0
  58. data/lib/mail/parsers/phrase_lists_parser.rb +33 -0
  59. data/lib/mail/parsers/ragel.rb +17 -0
  60. data/lib/mail/parsers/ragel/common.rl +184 -0
  61. data/lib/mail/parsers/ragel/date_time.rl +30 -0
  62. data/lib/mail/parsers/ragel/parser_info.rb +61 -0
  63. data/lib/mail/parsers/ragel/ruby.rb +29 -0
  64. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb +14864 -0
  65. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb.rl +37 -0
  66. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb +751 -0
  67. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb.rl +37 -0
  68. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb +614 -0
  69. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb.rl +37 -0
  70. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb +447 -0
  71. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl +37 -0
  72. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb +825 -0
  73. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb.rl +37 -0
  74. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb +817 -0
  75. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb.rl +37 -0
  76. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb +2129 -0
  77. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb.rl +37 -0
  78. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb +1570 -0
  79. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb.rl +37 -0
  80. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb +440 -0
  81. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb.rl +37 -0
  82. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb +564 -0
  83. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb.rl +37 -0
  84. data/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl +51 -0
  85. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb +5144 -0
  86. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb.rl +37 -0
  87. data/lib/mail/parsers/ragel/ruby/parser.rb.rl.erb +37 -0
  88. data/lib/mail/parsers/received_parser.rb +47 -0
  89. data/lib/mail/parts_list.rb +4 -2
  90. data/lib/mail/patterns.rb +3 -1
  91. data/lib/mail/utilities.rb +3 -1
  92. data/lib/mail/version.rb +1 -1
  93. data/lib/mail/version_specific/ruby_1_8.rb +1 -1
  94. data/lib/mail/version_specific/ruby_1_9.rb +13 -1
  95. metadata +55 -51
  96. data/lib/VERSION +0 -4
  97. data/lib/load_parsers.rb +0 -35
  98. data/lib/mail/parsers/address_lists.rb +0 -64
  99. data/lib/mail/parsers/address_lists.treetop +0 -19
  100. data/lib/mail/parsers/content_disposition.rb +0 -535
  101. data/lib/mail/parsers/content_disposition.treetop +0 -46
  102. data/lib/mail/parsers/content_location.rb +0 -139
  103. data/lib/mail/parsers/content_location.treetop +0 -20
  104. data/lib/mail/parsers/content_transfer_encoding.rb +0 -201
  105. data/lib/mail/parsers/content_transfer_encoding.treetop +0 -18
  106. data/lib/mail/parsers/content_type.rb +0 -971
  107. data/lib/mail/parsers/content_type.treetop +0 -68
  108. data/lib/mail/parsers/date_time.rb +0 -114
  109. data/lib/mail/parsers/date_time.treetop +0 -11
  110. data/lib/mail/parsers/envelope_from.rb +0 -194
  111. data/lib/mail/parsers/envelope_from.treetop +0 -32
  112. data/lib/mail/parsers/message_ids.rb +0 -45
  113. data/lib/mail/parsers/message_ids.treetop +0 -15
  114. data/lib/mail/parsers/mime_version.rb +0 -144
  115. data/lib/mail/parsers/mime_version.treetop +0 -19
  116. data/lib/mail/parsers/phrase_lists.rb +0 -45
  117. data/lib/mail/parsers/phrase_lists.treetop +0 -15
  118. data/lib/mail/parsers/received.rb +0 -71
  119. data/lib/mail/parsers/received.treetop +0 -11
  120. data/lib/mail/parsers/rfc2045.rb +0 -421
  121. data/lib/mail/parsers/rfc2045.treetop +0 -35
  122. data/lib/mail/parsers/rfc2822.rb +0 -5397
  123. data/lib/mail/parsers/rfc2822.treetop +0 -408
  124. data/lib/mail/parsers/rfc2822_obsolete.rb +0 -3768
  125. data/lib/mail/parsers/rfc2822_obsolete.treetop +0 -241
  126. data/lib/tasks/corpus.rake +0 -125
  127. data/lib/tasks/treetop.rake +0 -10
@@ -1,15 +0,0 @@
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
@@ -1,144 +0,0 @@
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
@@ -1,19 +0,0 @@
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
@@ -1,45 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -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
@@ -1,11 +0,0 @@
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
@@ -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