Module: Mail::ContentDisposition

Includes:
RFC2045, RFC2822, Treetop::Runtime
Included in:
ContentDispositionParser
Defined in:
lib/mail/parsers/content_disposition.rb

Defined Under Namespace

Modules: ContentDisposition0, ContentDisposition1, ContentDisposition2, Parameter0, Parameter1, Value0

Instance Method Summary collapse

Methods included from RFC2045

#_nt_iana_token, #_nt_ietf_token, #_nt_token, #_nt_tspecials, #_nt_x_token

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

Methods included from RFC2822Obsolete

#_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_attributeObject



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
# File 'lib/mail/parsers/content_disposition.rb', line 269

def _nt_attribute
  start_index = index
  if node_cache[:attribute].has_key?(index)
    cached = node_cache[:attribute][index]
    @index = cached.interval.end if cached
    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_content_dispositionObject



48
49
50
51
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
# File 'lib/mail/parsers/content_disposition.rb', line 48

def _nt_content_disposition
  start_index = index
  if node_cache[:content_disposition].has_key?(index)
    cached = node_cache[:content_disposition][index]
    @index = cached.interval.end if cached
    return cached
  end

  i0, s0 = index, []
  r1 = _nt_disposition_type
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      i3, s3 = index, []
      r4 = _nt_CFWS
      s3 << r4
      if r4
        if has_terminal?(";", false, index)
          r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure(";")
          r5 = nil
        end
        s3 << r5
        if r5
          r6 = _nt_parameter
          s3 << r6
          if r6
            r7 = _nt_CFWS
            s3 << r7
          end
        end
      end
      if s3.last
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        r3.extend(ContentDisposition0)
      else
        @index = i3
        r3 = nil
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(ContentDisposition1)
    r0.extend(ContentDisposition2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:content_disposition][start_index] = r0

  r0
end

#_nt_disposition_typeObject



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
138
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
# File 'lib/mail/parsers/content_disposition.rb', line 113

def _nt_disposition_type
  start_index = index
  if node_cache[:disposition_type].has_key?(index)
    cached = node_cache[:disposition_type][index]
    @index = cached.interval.end if cached
    return cached
  end

  i0 = index
  if has_terminal?("inline", false, index)
    r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
    @index += 6
  else
    terminal_parse_failure("inline")
    r1 = nil
  end
  if r1
    r0 = r1
  else
    if has_terminal?("attachment", false, index)
      r2 = instantiate_node(SyntaxNode,input, index...(index + 10))
      @index += 10
    else
      terminal_parse_failure("attachment")
      r2 = nil
    end
    if r2
      r0 = r2
    else
      r3 = _nt_extension_token
      if r3
        r0 = r3
      else
        if has_terminal?('', false, index)
          r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
          @index += 0
        else
          terminal_parse_failure('')
          r4 = nil
        end
        if r4
          r0 = r4
        else
          @index = i0
          r0 = nil
        end
      end
    end
  end

  node_cache[:disposition_type][start_index] = r0

  r0
end

#_nt_extension_tokenObject



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/mail/parsers/content_disposition.rb', line 168

def _nt_extension_token
  start_index = index
  if node_cache[:extension_token].has_key?(index)
    cached = node_cache[:extension_token][index]
    @index = cached.interval.end if cached
    return cached
  end

  i0 = index
  r1 = _nt_ietf_token
  if r1
    r0 = r1
  else
    r2 = _nt_x_token
    if r2
      r0 = r2
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:extension_token][start_index] = r0

  r0
end

#_nt_parameterObject



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
# File 'lib/mail/parsers/content_disposition.rb', line 212

def _nt_parameter
  start_index = index
  if node_cache[:parameter].has_key?(index)
    cached = node_cache[:parameter][index]
    @index = cached.interval.end if cached
    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_valueObject



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
# File 'lib/mail/parsers/content_disposition.rb', line 304

def _nt_value
  start_index = index
  if node_cache[:value].has_key?(index)
    cached = node_cache[:value][index]
    @index = cached.interval.end if cached
    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

#rootObject



8
9
10
# File 'lib/mail/parsers/content_disposition.rb', line 8

def root
  @root ||= :content_disposition
end