mms2r 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +54 -0
  3. data/README.txt +81 -0
  4. data/Rakefile +30 -0
  5. data/conf/mms2r_cingularmedia_transform.yml +6 -0
  6. data/conf/mms2r_sprintmedia_ignore.yml +10 -0
  7. data/conf/mms2r_tmobilemedia_ignore.yml +17 -0
  8. data/conf/mms2r_verizonmedia_ignore.yml +3 -0
  9. data/lib/mms2r.rb +3 -0
  10. data/lib/mms2r/cingular_media.rb +11 -0
  11. data/lib/mms2r/media.rb +345 -0
  12. data/lib/mms2r/mmode_media.rb +13 -0
  13. data/lib/mms2r/sprint_media.rb +50 -0
  14. data/lib/mms2r/tmobile_media.rb +11 -0
  15. data/lib/mms2r/verizon_media.rb +11 -0
  16. data/lib/mms2r/version.rb +12 -0
  17. data/lib/vendor/text/format.rb +1466 -0
  18. data/lib/vendor/tmail.rb +3 -0
  19. data/lib/vendor/tmail/address.rb +242 -0
  20. data/lib/vendor/tmail/attachments.rb +39 -0
  21. data/lib/vendor/tmail/base64.rb +71 -0
  22. data/lib/vendor/tmail/config.rb +69 -0
  23. data/lib/vendor/tmail/encode.rb +467 -0
  24. data/lib/vendor/tmail/facade.rb +552 -0
  25. data/lib/vendor/tmail/header.rb +914 -0
  26. data/lib/vendor/tmail/info.rb +35 -0
  27. data/lib/vendor/tmail/loader.rb +1 -0
  28. data/lib/vendor/tmail/mail.rb +447 -0
  29. data/lib/vendor/tmail/mailbox.rb +433 -0
  30. data/lib/vendor/tmail/mbox.rb +1 -0
  31. data/lib/vendor/tmail/net.rb +280 -0
  32. data/lib/vendor/tmail/obsolete.rb +135 -0
  33. data/lib/vendor/tmail/parser.rb +1522 -0
  34. data/lib/vendor/tmail/port.rb +377 -0
  35. data/lib/vendor/tmail/quoting.rb +131 -0
  36. data/lib/vendor/tmail/scanner.rb +41 -0
  37. data/lib/vendor/tmail/scanner_r.rb +263 -0
  38. data/lib/vendor/tmail/stringio.rb +277 -0
  39. data/lib/vendor/tmail/tmail.rb +1 -0
  40. data/lib/vendor/tmail/utils.rb +238 -0
  41. data/test/files/dot.jpg +0 -0
  42. data/test/files/sprint-image-01.mail +195 -0
  43. data/test/files/sprint-text-01.mail +8 -0
  44. data/test/files/sprint-video-01.mail +195 -0
  45. data/test/files/sprint.mov +0 -0
  46. data/test/files/verizon-image-01.mail +815 -0
  47. data/test/files/verizon-text-01.mail +11 -0
  48. data/test/files/verizon-video-01.mail +336 -0
  49. data/test/test_mms2r_cingular.rb +52 -0
  50. data/test/test_mms2r_media.rb +311 -0
  51. data/test/test_mms2r_mmode.rb +52 -0
  52. data/test/test_mms2r_sprint.rb +154 -0
  53. data/test/test_mms2r_tmobile.rb +169 -0
  54. data/test/test_mms2r_verizon.rb +74 -0
  55. metadata +130 -0
@@ -0,0 +1,135 @@
1
+ #
2
+ # obsolete.rb
3
+ #
4
+ #--
5
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ #
26
+ # Note: Originally licensed under LGPL v2+. Using MIT license for Rails
27
+ # with permission of Minero Aoki.
28
+ #++
29
+
30
+ module TMail
31
+
32
+ # mail.rb
33
+ class Mail
34
+ alias include? key?
35
+ alias has_key? key?
36
+
37
+ def values
38
+ ret = []
39
+ each_field {|v| ret.push v }
40
+ ret
41
+ end
42
+
43
+ def value?( val )
44
+ HeaderField === val or return false
45
+
46
+ [ @header[val.name.downcase] ].flatten.include? val
47
+ end
48
+
49
+ alias has_value? value?
50
+ end
51
+
52
+
53
+ # facade.rb
54
+ class Mail
55
+ def from_addr( default = nil )
56
+ addr, = from_addrs(nil)
57
+ addr || default
58
+ end
59
+
60
+ def from_address( default = nil )
61
+ if a = from_addr(nil)
62
+ a.spec
63
+ else
64
+ default
65
+ end
66
+ end
67
+
68
+ alias from_address= from_addrs=
69
+
70
+ def from_phrase( default = nil )
71
+ if a = from_addr(nil)
72
+ a.phrase
73
+ else
74
+ default
75
+ end
76
+ end
77
+
78
+ alias msgid message_id
79
+ alias msgid= message_id=
80
+
81
+ alias each_dest each_destination
82
+ end
83
+
84
+
85
+ # address.rb
86
+ class Address
87
+ alias route routes
88
+ alias addr spec
89
+
90
+ def spec=( str )
91
+ @local, @domain = str.split(/@/,2).map {|s| s.split(/\./) }
92
+ end
93
+
94
+ alias addr= spec=
95
+ alias address= spec=
96
+ end
97
+
98
+
99
+ # mbox.rb
100
+ class MhMailbox
101
+ alias new_mail new_port
102
+ alias each_mail each_port
103
+ alias each_newmail each_new_port
104
+ end
105
+ class UNIXMbox
106
+ alias new_mail new_port
107
+ alias each_mail each_port
108
+ alias each_newmail each_new_port
109
+ end
110
+ class Maildir
111
+ alias new_mail new_port
112
+ alias each_mail each_port
113
+ alias each_newmail each_new_port
114
+ end
115
+
116
+
117
+ # utils.rb
118
+ extend TextUtils
119
+
120
+ class << self
121
+ alias msgid? message_id?
122
+ alias boundary new_boundary
123
+ alias msgid new_message_id
124
+ alias new_msgid new_message_id
125
+ end
126
+
127
+ def Mail.boundary
128
+ ::TMail.new_boundary
129
+ end
130
+
131
+ def Mail.msgid
132
+ ::TMail.new_message_id
133
+ end
134
+
135
+ end # module TMail
@@ -0,0 +1,1522 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by racc 1.4.3
4
+ # from racc grammer file "parser.y".
5
+ #
6
+ #
7
+ # parser.rb: generated by racc (runtime embedded)
8
+ #
9
+
10
+ ###### racc/parser.rb
11
+
12
+ unless $".index 'racc/parser.rb'
13
+ $".push 'racc/parser.rb'
14
+
15
+ self.class.module_eval <<'..end /home/aamine/lib/ruby/racc/parser.rb modeval..idb76f2e220d', '/home/aamine/lib/ruby/racc/parser.rb', 1
16
+ #
17
+ # parser.rb
18
+ #
19
+ # Copyright (c) 1999-2003 Minero Aoki <aamine@loveruby.net>
20
+ #
21
+ # This program is free software.
22
+ # You can distribute/modify this program under the same terms of ruby.
23
+ #
24
+ # As a special exception, when this code is copied by Racc
25
+ # into a Racc output file, you may use that output file
26
+ # without restriction.
27
+ #
28
+ # $Id: parser.rb,v 1.1.1.1 2004/10/14 11:59:58 webster132 Exp $
29
+ #
30
+
31
+ unless defined? NotImplementedError
32
+ NotImplementedError = NotImplementError
33
+ end
34
+
35
+
36
+ module Racc
37
+ class ParseError < StandardError; end
38
+ end
39
+ unless defined?(::ParseError)
40
+ ParseError = Racc::ParseError
41
+ end
42
+
43
+
44
+ module Racc
45
+
46
+ unless defined? Racc_No_Extentions
47
+ Racc_No_Extentions = false
48
+ end
49
+
50
+ class Parser
51
+
52
+ Racc_Runtime_Version = '1.4.3'
53
+ Racc_Runtime_Revision = '$Revision: 1.1.1.1 $'.split(/\s+/)[1]
54
+
55
+ Racc_Runtime_Core_Version_R = '1.4.3'
56
+ Racc_Runtime_Core_Revision_R = '$Revision: 1.1.1.1 $'.split(/\s+/)[1]
57
+ begin
58
+ require 'racc/cparse'
59
+ # Racc_Runtime_Core_Version_C = (defined in extention)
60
+ Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split(/\s+/)[2]
61
+ unless new.respond_to?(:_racc_do_parse_c, true)
62
+ raise LoadError, 'old cparse.so'
63
+ end
64
+ if Racc_No_Extentions
65
+ raise LoadError, 'selecting ruby version of racc runtime core'
66
+ end
67
+
68
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c
69
+ Racc_YY_Parse_Method = :_racc_yyparse_c
70
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
71
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
72
+ Racc_Runtime_Type = 'c'
73
+ rescue LoadError
74
+ Racc_Main_Parsing_Routine = :_racc_do_parse_rb
75
+ Racc_YY_Parse_Method = :_racc_yyparse_rb
76
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
77
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
78
+ Racc_Runtime_Type = 'ruby'
79
+ end
80
+
81
+ def self.racc_runtime_type
82
+ Racc_Runtime_Type
83
+ end
84
+
85
+ private
86
+
87
+ def _racc_setup
88
+ @yydebug = false unless self.class::Racc_debug_parser
89
+ @yydebug = false unless defined? @yydebug
90
+ if @yydebug
91
+ @racc_debug_out = $stderr unless defined? @racc_debug_out
92
+ @racc_debug_out ||= $stderr
93
+ end
94
+ arg = self.class::Racc_arg
95
+ arg[13] = true if arg.size < 14
96
+ arg
97
+ end
98
+
99
+ def _racc_init_sysvars
100
+ @racc_state = [0]
101
+ @racc_tstack = []
102
+ @racc_vstack = []
103
+
104
+ @racc_t = nil
105
+ @racc_val = nil
106
+
107
+ @racc_read_next = true
108
+
109
+ @racc_user_yyerror = false
110
+ @racc_error_status = 0
111
+ end
112
+
113
+
114
+ ###
115
+ ### do_parse
116
+ ###
117
+
118
+ def do_parse
119
+ __send__ Racc_Main_Parsing_Routine, _racc_setup(), false
120
+ end
121
+
122
+ def next_token
123
+ raise NotImplementedError, "#{self.class}\#next_token is not defined"
124
+ end
125
+
126
+ def _racc_do_parse_rb( arg, in_debug )
127
+ action_table, action_check, action_default, action_pointer,
128
+ goto_table, goto_check, goto_default, goto_pointer,
129
+ nt_base, reduce_table, token_table, shift_n,
130
+ reduce_n, use_result, * = arg
131
+
132
+ _racc_init_sysvars
133
+ tok = act = i = nil
134
+ nerr = 0
135
+
136
+ catch(:racc_end_parse) {
137
+ while true
138
+ if i = action_pointer[@racc_state[-1]]
139
+ if @racc_read_next
140
+ if @racc_t != 0 # not EOF
141
+ tok, @racc_val = next_token()
142
+ unless tok # EOF
143
+ @racc_t = 0
144
+ else
145
+ @racc_t = (token_table[tok] or 1) # error token
146
+ end
147
+ racc_read_token(@racc_t, tok, @racc_val) if @yydebug
148
+ @racc_read_next = false
149
+ end
150
+ end
151
+ i += @racc_t
152
+ if i >= 0 and
153
+ act = action_table[i] and
154
+ action_check[i] == @racc_state[-1]
155
+ ;
156
+ else
157
+ act = action_default[@racc_state[-1]]
158
+ end
159
+ else
160
+ act = action_default[@racc_state[-1]]
161
+ end
162
+ while act = _racc_evalact(act, arg)
163
+ end
164
+ end
165
+ }
166
+ end
167
+
168
+
169
+ ###
170
+ ### yyparse
171
+ ###
172
+
173
+ def yyparse( recv, mid )
174
+ __send__ Racc_YY_Parse_Method, recv, mid, _racc_setup(), true
175
+ end
176
+
177
+ def _racc_yyparse_rb( recv, mid, arg, c_debug )
178
+ action_table, action_check, action_default, action_pointer,
179
+ goto_table, goto_check, goto_default, goto_pointer,
180
+ nt_base, reduce_table, token_table, shift_n,
181
+ reduce_n, use_result, * = arg
182
+
183
+ _racc_init_sysvars
184
+ tok = nil
185
+ act = nil
186
+ i = nil
187
+ nerr = 0
188
+
189
+
190
+ catch(:racc_end_parse) {
191
+ until i = action_pointer[@racc_state[-1]]
192
+ while act = _racc_evalact(action_default[@racc_state[-1]], arg)
193
+ end
194
+ end
195
+
196
+ recv.__send__(mid) do |tok, val|
197
+ # $stderr.puts "rd: tok=#{tok}, val=#{val}"
198
+ unless tok
199
+ @racc_t = 0
200
+ else
201
+ @racc_t = (token_table[tok] or 1) # error token
202
+ end
203
+ @racc_val = val
204
+ @racc_read_next = false
205
+
206
+ i += @racc_t
207
+ if i >= 0 and
208
+ act = action_table[i] and
209
+ action_check[i] == @racc_state[-1]
210
+ ;
211
+ # $stderr.puts "01: act=#{act}"
212
+ else
213
+ act = action_default[@racc_state[-1]]
214
+ # $stderr.puts "02: act=#{act}"
215
+ # $stderr.puts "curstate=#{@racc_state[-1]}"
216
+ end
217
+
218
+ while act = _racc_evalact(act, arg)
219
+ end
220
+
221
+ while not (i = action_pointer[@racc_state[-1]]) or
222
+ not @racc_read_next or
223
+ @racc_t == 0 # $
224
+ if i and i += @racc_t and
225
+ i >= 0 and
226
+ act = action_table[i] and
227
+ action_check[i] == @racc_state[-1]
228
+ ;
229
+ # $stderr.puts "03: act=#{act}"
230
+ else
231
+ # $stderr.puts "04: act=#{act}"
232
+ act = action_default[@racc_state[-1]]
233
+ end
234
+
235
+ while act = _racc_evalact(act, arg)
236
+ end
237
+ end
238
+ end
239
+ }
240
+ end
241
+
242
+
243
+ ###
244
+ ### common
245
+ ###
246
+
247
+ def _racc_evalact( act, arg )
248
+ # $stderr.puts "ea: act=#{act}"
249
+ action_table, action_check, action_default, action_pointer,
250
+ goto_table, goto_check, goto_default, goto_pointer,
251
+ nt_base, reduce_table, token_table, shift_n,
252
+ reduce_n, use_result, * = arg
253
+ nerr = 0 # tmp
254
+
255
+ if act > 0 and act < shift_n
256
+ #
257
+ # shift
258
+ #
259
+
260
+ if @racc_error_status > 0
261
+ @racc_error_status -= 1 unless @racc_t == 1 # error token
262
+ end
263
+
264
+ @racc_vstack.push @racc_val
265
+ @racc_state.push act
266
+ @racc_read_next = true
267
+
268
+ if @yydebug
269
+ @racc_tstack.push @racc_t
270
+ racc_shift @racc_t, @racc_tstack, @racc_vstack
271
+ end
272
+
273
+ elsif act < 0 and act > -reduce_n
274
+ #
275
+ # reduce
276
+ #
277
+
278
+ code = catch(:racc_jump) {
279
+ @racc_state.push _racc_do_reduce(arg, act)
280
+ false
281
+ }
282
+ if code
283
+ case code
284
+ when 1 # yyerror
285
+ @racc_user_yyerror = true # user_yyerror
286
+ return -reduce_n
287
+ when 2 # yyaccept
288
+ return shift_n
289
+ else
290
+ raise RuntimeError, '[Racc Bug] unknown jump code'
291
+ end
292
+ end
293
+
294
+ elsif act == shift_n
295
+ #
296
+ # accept
297
+ #
298
+
299
+ racc_accept if @yydebug
300
+ throw :racc_end_parse, @racc_vstack[0]
301
+
302
+ elsif act == -reduce_n
303
+ #
304
+ # error
305
+ #
306
+
307
+ case @racc_error_status
308
+ when 0
309
+ unless arg[21] # user_yyerror
310
+ nerr += 1
311
+ on_error @racc_t, @racc_val, @racc_vstack
312
+ end
313
+ when 3
314
+ if @racc_t == 0 # is $
315
+ throw :racc_end_parse, nil
316
+ end
317
+ @racc_read_next = true
318
+ end
319
+ @racc_user_yyerror = false
320
+ @racc_error_status = 3
321
+
322
+ while true
323
+ if i = action_pointer[@racc_state[-1]]
324
+ i += 1 # error token
325
+ if i >= 0 and
326
+ (act = action_table[i]) and
327
+ action_check[i] == @racc_state[-1]
328
+ break
329
+ end
330
+ end
331
+
332
+ throw :racc_end_parse, nil if @racc_state.size < 2
333
+ @racc_state.pop
334
+ @racc_vstack.pop
335
+ if @yydebug
336
+ @racc_tstack.pop
337
+ racc_e_pop @racc_state, @racc_tstack, @racc_vstack
338
+ end
339
+ end
340
+
341
+ return act
342
+
343
+ else
344
+ raise RuntimeError, "[Racc Bug] unknown action #{act.inspect}"
345
+ end
346
+
347
+ racc_next_state(@racc_state[-1], @racc_state) if @yydebug
348
+
349
+ nil
350
+ end
351
+
352
+ def _racc_do_reduce( arg, act )
353
+ action_table, action_check, action_default, action_pointer,
354
+ goto_table, goto_check, goto_default, goto_pointer,
355
+ nt_base, reduce_table, token_table, shift_n,
356
+ reduce_n, use_result, * = arg
357
+ state = @racc_state
358
+ vstack = @racc_vstack
359
+ tstack = @racc_tstack
360
+
361
+ i = act * -3
362
+ len = reduce_table[i]
363
+ reduce_to = reduce_table[i+1]
364
+ method_id = reduce_table[i+2]
365
+ void_array = []
366
+
367
+ tmp_t = tstack[-len, len] if @yydebug
368
+ tmp_v = vstack[-len, len]
369
+ tstack[-len, len] = void_array if @yydebug
370
+ vstack[-len, len] = void_array
371
+ state[-len, len] = void_array
372
+
373
+ # tstack must be updated AFTER method call
374
+ if use_result
375
+ vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
376
+ else
377
+ vstack.push __send__(method_id, tmp_v, vstack)
378
+ end
379
+ tstack.push reduce_to
380
+
381
+ racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
382
+
383
+ k1 = reduce_to - nt_base
384
+ if i = goto_pointer[k1]
385
+ i += state[-1]
386
+ if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
387
+ return curstate
388
+ end
389
+ end
390
+ goto_default[k1]
391
+ end
392
+
393
+ def on_error( t, val, vstack )
394
+ raise ParseError, sprintf("\nparse error on value %s (%s)",
395
+ val.inspect, token_to_str(t) || '?')
396
+ end
397
+
398
+ def yyerror
399
+ throw :racc_jump, 1
400
+ end
401
+
402
+ def yyaccept
403
+ throw :racc_jump, 2
404
+ end
405
+
406
+ def yyerrok
407
+ @racc_error_status = 0
408
+ end
409
+
410
+
411
+ # for debugging output
412
+
413
+ def racc_read_token( t, tok, val )
414
+ @racc_debug_out.print 'read '
415
+ @racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
416
+ @racc_debug_out.puts val.inspect
417
+ @racc_debug_out.puts
418
+ end
419
+
420
+ def racc_shift( tok, tstack, vstack )
421
+ @racc_debug_out.puts "shift #{racc_token2str tok}"
422
+ racc_print_stacks tstack, vstack
423
+ @racc_debug_out.puts
424
+ end
425
+
426
+ def racc_reduce( toks, sim, tstack, vstack )
427
+ out = @racc_debug_out
428
+ out.print 'reduce '
429
+ if toks.empty?
430
+ out.print ' <none>'
431
+ else
432
+ toks.each {|t| out.print ' ', racc_token2str(t) }
433
+ end
434
+ out.puts " --> #{racc_token2str(sim)}"
435
+
436
+ racc_print_stacks tstack, vstack
437
+ @racc_debug_out.puts
438
+ end
439
+
440
+ def racc_accept
441
+ @racc_debug_out.puts 'accept'
442
+ @racc_debug_out.puts
443
+ end
444
+
445
+ def racc_e_pop( state, tstack, vstack )
446
+ @racc_debug_out.puts 'error recovering mode: pop token'
447
+ racc_print_states state
448
+ racc_print_stacks tstack, vstack
449
+ @racc_debug_out.puts
450
+ end
451
+
452
+ def racc_next_state( curstate, state )
453
+ @racc_debug_out.puts "goto #{curstate}"
454
+ racc_print_states state
455
+ @racc_debug_out.puts
456
+ end
457
+
458
+ def racc_print_stacks( t, v )
459
+ out = @racc_debug_out
460
+ out.print ' ['
461
+ t.each_index do |i|
462
+ out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
463
+ end
464
+ out.puts ' ]'
465
+ end
466
+
467
+ def racc_print_states( s )
468
+ out = @racc_debug_out
469
+ out.print ' ['
470
+ s.each {|st| out.print ' ', st }
471
+ out.puts ' ]'
472
+ end
473
+
474
+ def racc_token2str( tok )
475
+ self.class::Racc_token_to_s_table[tok] or
476
+ raise RuntimeError, "[Racc Bug] can't convert token #{tok} to string"
477
+ end
478
+
479
+ def token_to_str( t )
480
+ self.class::Racc_token_to_s_table[t]
481
+ end
482
+
483
+ end
484
+
485
+ end
486
+ ..end /home/aamine/lib/ruby/racc/parser.rb modeval..idb76f2e220d
487
+ end # end of racc/parser.rb
488
+
489
+
490
+ #
491
+ # parser.rb
492
+ #
493
+ #--
494
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
495
+ #
496
+ # Permission is hereby granted, free of charge, to any person obtaining
497
+ # a copy of this software and associated documentation files (the
498
+ # "Software"), to deal in the Software without restriction, including
499
+ # without limitation the rights to use, copy, modify, merge, publish,
500
+ # distribute, sublicense, and/or sell copies of the Software, and to
501
+ # permit persons to whom the Software is furnished to do so, subject to
502
+ # the following conditions:
503
+ #
504
+ # The above copyright notice and this permission notice shall be
505
+ # included in all copies or substantial portions of the Software.
506
+ #
507
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
508
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
509
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
510
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
511
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
512
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
513
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
514
+ #
515
+ # Note: Originally licensed under LGPL v2+. Using MIT license for Rails
516
+ # with permission of Minero Aoki.
517
+ #++
518
+
519
+ require 'tmail/scanner'
520
+ require 'tmail/utils'
521
+
522
+
523
+ module TMail
524
+
525
+ class Parser < Racc::Parser
526
+
527
+ module_eval <<'..end parser.y modeval..id43721faf1c', 'parser.y', 331
528
+
529
+ include TextUtils
530
+
531
+ def self.parse( ident, str, cmt = nil )
532
+ new.parse(ident, str, cmt)
533
+ end
534
+
535
+ MAILP_DEBUG = false
536
+
537
+ def initialize
538
+ self.debug = MAILP_DEBUG
539
+ end
540
+
541
+ def debug=( flag )
542
+ @yydebug = flag && Racc_debug_parser
543
+ @scanner_debug = flag
544
+ end
545
+
546
+ def debug
547
+ @yydebug
548
+ end
549
+
550
+ def parse( ident, str, comments = nil )
551
+ @scanner = Scanner.new(str, ident, comments)
552
+ @scanner.debug = @scanner_debug
553
+ @first = [ident, ident]
554
+ result = yyparse(self, :parse_in)
555
+ comments.map! {|c| to_kcode(c) } if comments
556
+ result
557
+ end
558
+
559
+ private
560
+
561
+ def parse_in( &block )
562
+ yield @first
563
+ @scanner.scan(&block)
564
+ end
565
+
566
+ def on_error( t, val, vstack )
567
+ raise SyntaxError, "parse error on token #{racc_token2str t}"
568
+ end
569
+
570
+ ..end parser.y modeval..id43721faf1c
571
+
572
+ ##### racc 1.4.3 generates ###
573
+
574
+ racc_reduce_table = [
575
+ 0, 0, :racc_error,
576
+ 2, 35, :_reduce_1,
577
+ 2, 35, :_reduce_2,
578
+ 2, 35, :_reduce_3,
579
+ 2, 35, :_reduce_4,
580
+ 2, 35, :_reduce_5,
581
+ 2, 35, :_reduce_6,
582
+ 2, 35, :_reduce_7,
583
+ 2, 35, :_reduce_8,
584
+ 2, 35, :_reduce_9,
585
+ 2, 35, :_reduce_10,
586
+ 2, 35, :_reduce_11,
587
+ 2, 35, :_reduce_12,
588
+ 6, 36, :_reduce_13,
589
+ 0, 48, :_reduce_none,
590
+ 2, 48, :_reduce_none,
591
+ 3, 49, :_reduce_16,
592
+ 5, 49, :_reduce_17,
593
+ 1, 50, :_reduce_18,
594
+ 7, 37, :_reduce_19,
595
+ 0, 51, :_reduce_none,
596
+ 2, 51, :_reduce_21,
597
+ 0, 52, :_reduce_none,
598
+ 2, 52, :_reduce_23,
599
+ 1, 58, :_reduce_24,
600
+ 3, 58, :_reduce_25,
601
+ 2, 58, :_reduce_26,
602
+ 0, 53, :_reduce_none,
603
+ 2, 53, :_reduce_28,
604
+ 0, 54, :_reduce_29,
605
+ 3, 54, :_reduce_30,
606
+ 0, 55, :_reduce_none,
607
+ 2, 55, :_reduce_32,
608
+ 2, 55, :_reduce_33,
609
+ 0, 56, :_reduce_none,
610
+ 2, 56, :_reduce_35,
611
+ 1, 61, :_reduce_36,
612
+ 1, 61, :_reduce_37,
613
+ 0, 57, :_reduce_none,
614
+ 2, 57, :_reduce_39,
615
+ 1, 38, :_reduce_none,
616
+ 1, 38, :_reduce_none,
617
+ 3, 38, :_reduce_none,
618
+ 1, 46, :_reduce_none,
619
+ 1, 46, :_reduce_none,
620
+ 1, 46, :_reduce_none,
621
+ 1, 39, :_reduce_none,
622
+ 2, 39, :_reduce_47,
623
+ 1, 64, :_reduce_48,
624
+ 3, 64, :_reduce_49,
625
+ 1, 68, :_reduce_none,
626
+ 1, 68, :_reduce_none,
627
+ 1, 69, :_reduce_52,
628
+ 3, 69, :_reduce_53,
629
+ 1, 47, :_reduce_none,
630
+ 1, 47, :_reduce_none,
631
+ 2, 47, :_reduce_56,
632
+ 2, 67, :_reduce_none,
633
+ 3, 65, :_reduce_58,
634
+ 2, 65, :_reduce_59,
635
+ 1, 70, :_reduce_60,
636
+ 2, 70, :_reduce_61,
637
+ 4, 62, :_reduce_62,
638
+ 3, 62, :_reduce_63,
639
+ 2, 72, :_reduce_none,
640
+ 2, 73, :_reduce_65,
641
+ 4, 73, :_reduce_66,
642
+ 3, 63, :_reduce_67,
643
+ 1, 63, :_reduce_68,
644
+ 1, 74, :_reduce_none,
645
+ 2, 74, :_reduce_70,
646
+ 1, 71, :_reduce_71,
647
+ 3, 71, :_reduce_72,
648
+ 1, 59, :_reduce_73,
649
+ 3, 59, :_reduce_74,
650
+ 1, 76, :_reduce_75,
651
+ 2, 76, :_reduce_76,
652
+ 1, 75, :_reduce_none,
653
+ 1, 75, :_reduce_none,
654
+ 1, 75, :_reduce_none,
655
+ 1, 77, :_reduce_none,
656
+ 1, 77, :_reduce_none,
657
+ 1, 77, :_reduce_none,
658
+ 1, 66, :_reduce_none,
659
+ 2, 66, :_reduce_none,
660
+ 3, 60, :_reduce_85,
661
+ 1, 40, :_reduce_86,
662
+ 3, 40, :_reduce_87,
663
+ 1, 79, :_reduce_none,
664
+ 2, 79, :_reduce_89,
665
+ 1, 41, :_reduce_90,
666
+ 2, 41, :_reduce_91,
667
+ 3, 42, :_reduce_92,
668
+ 5, 43, :_reduce_93,
669
+ 3, 43, :_reduce_94,
670
+ 0, 80, :_reduce_95,
671
+ 5, 80, :_reduce_96,
672
+ 1, 82, :_reduce_none,
673
+ 1, 82, :_reduce_none,
674
+ 1, 44, :_reduce_99,
675
+ 3, 45, :_reduce_100,
676
+ 0, 81, :_reduce_none,
677
+ 1, 81, :_reduce_none,
678
+ 1, 78, :_reduce_none,
679
+ 1, 78, :_reduce_none,
680
+ 1, 78, :_reduce_none,
681
+ 1, 78, :_reduce_none,
682
+ 1, 78, :_reduce_none,
683
+ 1, 78, :_reduce_none,
684
+ 1, 78, :_reduce_none ]
685
+
686
+ racc_reduce_n = 110
687
+
688
+ racc_shift_n = 168
689
+
690
+ racc_action_table = [
691
+ -70, -69, 23, 25, 146, 147, 29, 31, 105, 106,
692
+ 16, 17, 20, 22, 136, 27, -70, -69, 32, 101,
693
+ -70, -69, 154, 100, 113, 115, -70, -69, -70, 109,
694
+ 75, 23, 25, 101, 155, 29, 31, 142, 143, 16,
695
+ 17, 20, 22, 107, 27, 23, 25, 32, 98, 29,
696
+ 31, 96, 94, 16, 17, 20, 22, 78, 27, 23,
697
+ 25, 32, 112, 29, 31, 74, 91, 16, 17, 20,
698
+ 22, 88, 117, 92, 81, 32, 23, 25, 80, 123,
699
+ 29, 31, 100, 125, 16, 17, 20, 22, 126, 23,
700
+ 25, 109, 32, 29, 31, 91, 128, 16, 17, 20,
701
+ 22, 129, 27, 23, 25, 32, 101, 29, 31, 101,
702
+ 130, 16, 17, 20, 22, 79, 52, 23, 25, 32,
703
+ 78, 29, 31, 133, 78, 16, 17, 20, 22, 77,
704
+ 23, 25, 75, 32, 29, 31, 65, 62, 16, 17,
705
+ 20, 22, 139, 23, 25, 101, 32, 29, 31, 60,
706
+ 100, 16, 17, 20, 22, 44, 27, 101, 148, 32,
707
+ 23, 25, 120, 149, 29, 31, 152, 153, 16, 17,
708
+ 20, 22, 42, 27, 157, 159, 32, 23, 25, 120,
709
+ 40, 29, 31, 15, 164, 16, 17, 20, 22, 40,
710
+ 27, 23, 25, 32, 68, 29, 31, 166, 167, 16,
711
+ 17, 20, 22, nil, 27, 23, 25, 32, nil, 29,
712
+ 31, 74, nil, 16, 17, 20, 22, nil, 23, 25,
713
+ nil, 32, 29, 31, nil, nil, 16, 17, 20, 22,
714
+ nil, 23, 25, nil, 32, 29, 31, nil, nil, 16,
715
+ 17, 20, 22, nil, 23, 25, nil, 32, 29, 31,
716
+ nil, nil, 16, 17, 20, 22, nil, 23, 25, nil,
717
+ 32, 29, 31, nil, nil, 16, 17, 20, 22, nil,
718
+ 27, 23, 25, 32, nil, 29, 31, nil, nil, 16,
719
+ 17, 20, 22, nil, 23, 25, nil, 32, 29, 31,
720
+ nil, nil, 16, 17, 20, 22, nil, 23, 25, nil,
721
+ 32, 29, 31, nil, nil, 16, 17, 20, 22, nil,
722
+ 84, 25, nil, 32, 29, 31, nil, 87, 16, 17,
723
+ 20, 22, 4, 6, 7, 8, 9, 10, 11, 12,
724
+ 13, 1, 2, 3, 84, 25, nil, nil, 29, 31,
725
+ nil, 87, 16, 17, 20, 22, 84, 25, nil, nil,
726
+ 29, 31, nil, 87, 16, 17, 20, 22, 84, 25,
727
+ nil, nil, 29, 31, nil, 87, 16, 17, 20, 22,
728
+ 84, 25, nil, nil, 29, 31, nil, 87, 16, 17,
729
+ 20, 22, 84, 25, nil, nil, 29, 31, nil, 87,
730
+ 16, 17, 20, 22, 84, 25, nil, nil, 29, 31,
731
+ nil, 87, 16, 17, 20, 22 ]
732
+
733
+ racc_action_check = [
734
+ 75, 28, 68, 68, 136, 136, 68, 68, 72, 72,
735
+ 68, 68, 68, 68, 126, 68, 75, 28, 68, 67,
736
+ 75, 28, 143, 66, 86, 86, 75, 28, 75, 75,
737
+ 28, 3, 3, 86, 143, 3, 3, 134, 134, 3,
738
+ 3, 3, 3, 73, 3, 152, 152, 3, 62, 152,
739
+ 152, 60, 56, 152, 152, 152, 152, 51, 152, 52,
740
+ 52, 152, 80, 52, 52, 52, 50, 52, 52, 52,
741
+ 52, 45, 89, 52, 42, 52, 71, 71, 41, 96,
742
+ 71, 71, 97, 98, 71, 71, 71, 71, 100, 7,
743
+ 7, 101, 71, 7, 7, 102, 104, 7, 7, 7,
744
+ 7, 105, 7, 8, 8, 7, 108, 8, 8, 111,
745
+ 112, 8, 8, 8, 8, 40, 8, 9, 9, 8,
746
+ 36, 9, 9, 117, 121, 9, 9, 9, 9, 33,
747
+ 10, 10, 70, 9, 10, 10, 13, 12, 10, 10,
748
+ 10, 10, 130, 2, 2, 131, 10, 2, 2, 11,
749
+ 135, 2, 2, 2, 2, 6, 2, 138, 139, 2,
750
+ 90, 90, 90, 140, 90, 90, 141, 142, 90, 90,
751
+ 90, 90, 5, 90, 148, 151, 90, 127, 127, 127,
752
+ 4, 127, 127, 1, 157, 127, 127, 127, 127, 159,
753
+ 127, 26, 26, 127, 26, 26, 26, 163, 164, 26,
754
+ 26, 26, 26, nil, 26, 27, 27, 26, nil, 27,
755
+ 27, 27, nil, 27, 27, 27, 27, nil, 155, 155,
756
+ nil, 27, 155, 155, nil, nil, 155, 155, 155, 155,
757
+ nil, 122, 122, nil, 155, 122, 122, nil, nil, 122,
758
+ 122, 122, 122, nil, 76, 76, nil, 122, 76, 76,
759
+ nil, nil, 76, 76, 76, 76, nil, 38, 38, nil,
760
+ 76, 38, 38, nil, nil, 38, 38, 38, 38, nil,
761
+ 38, 55, 55, 38, nil, 55, 55, nil, nil, 55,
762
+ 55, 55, 55, nil, 94, 94, nil, 55, 94, 94,
763
+ nil, nil, 94, 94, 94, 94, nil, 59, 59, nil,
764
+ 94, 59, 59, nil, nil, 59, 59, 59, 59, nil,
765
+ 114, 114, nil, 59, 114, 114, nil, 114, 114, 114,
766
+ 114, 114, 0, 0, 0, 0, 0, 0, 0, 0,
767
+ 0, 0, 0, 0, 77, 77, nil, nil, 77, 77,
768
+ nil, 77, 77, 77, 77, 77, 44, 44, nil, nil,
769
+ 44, 44, nil, 44, 44, 44, 44, 44, 113, 113,
770
+ nil, nil, 113, 113, nil, 113, 113, 113, 113, 113,
771
+ 88, 88, nil, nil, 88, 88, nil, 88, 88, 88,
772
+ 88, 88, 74, 74, nil, nil, 74, 74, nil, 74,
773
+ 74, 74, 74, 74, 129, 129, nil, nil, 129, 129,
774
+ nil, 129, 129, 129, 129, 129 ]
775
+
776
+ racc_action_pointer = [
777
+ 320, 152, 129, 17, 165, 172, 137, 75, 89, 103,
778
+ 116, 135, 106, 105, nil, nil, nil, nil, nil, nil,
779
+ nil, nil, nil, nil, nil, nil, 177, 191, 1, nil,
780
+ nil, nil, nil, 109, nil, nil, 94, nil, 243, nil,
781
+ 99, 64, 74, nil, 332, 52, nil, nil, nil, nil,
782
+ 50, 31, 45, nil, nil, 257, 36, nil, nil, 283,
783
+ 22, nil, 16, nil, nil, nil, -3, -10, -12, nil,
784
+ 103, 62, -8, 15, 368, 0, 230, 320, nil, nil,
785
+ 47, nil, nil, nil, nil, nil, 4, nil, 356, 50,
786
+ 146, nil, nil, nil, 270, nil, 65, 56, 52, nil,
787
+ 57, 62, 79, nil, 68, 81, nil, nil, 77, nil,
788
+ nil, 80, 96, 344, 296, nil, nil, 108, nil, nil,
789
+ nil, 98, 217, nil, nil, nil, -19, 163, nil, 380,
790
+ 128, 116, nil, nil, 14, 124, -26, nil, 128, 141,
791
+ 148, 141, 152, 7, nil, nil, nil, nil, 160, nil,
792
+ nil, 149, 31, nil, nil, 204, nil, 167, nil, 174,
793
+ nil, nil, nil, 169, 184, nil, nil, nil ]
794
+
795
+ racc_action_default = [
796
+ -110, -110, -110, -110, -14, -110, -20, -110, -110, -110,
797
+ -110, -110, -110, -110, -10, -95, -106, -107, -77, -44,
798
+ -108, -11, -109, -79, -43, -103, -110, -110, -60, -104,
799
+ -55, -105, -78, -68, -54, -71, -45, -12, -110, -1,
800
+ -110, -110, -110, -2, -110, -22, -51, -48, -50, -3,
801
+ -40, -41, -110, -46, -4, -86, -5, -88, -6, -90,
802
+ -110, -7, -95, -8, -9, -99, -101, -61, -59, -56,
803
+ -69, -110, -110, -110, -110, -75, -110, -110, -57, -15,
804
+ -110, 168, -73, -80, -82, -21, -24, -81, -110, -27,
805
+ -110, -83, -47, -89, -110, -91, -110, -101, -110, -100,
806
+ -102, -75, -58, -52, -110, -110, -64, -63, -65, -76,
807
+ -72, -67, -110, -110, -110, -26, -23, -110, -29, -49,
808
+ -84, -42, -87, -92, -94, -95, -110, -110, -62, -110,
809
+ -110, -25, -74, -28, -31, -101, -110, -53, -66, -110,
810
+ -110, -34, -110, -110, -93, -96, -98, -97, -110, -18,
811
+ -13, -38, -110, -30, -33, -110, -32, -16, -19, -14,
812
+ -35, -36, -37, -110, -110, -39, -85, -17 ]
813
+
814
+ racc_goto_table = [
815
+ 39, 67, 70, 73, 24, 37, 69, 66, 36, 38,
816
+ 57, 59, 55, 67, 108, 83, 90, 111, 69, 99,
817
+ 85, 49, 53, 76, 158, 134, 141, 70, 73, 151,
818
+ 118, 89, 45, 156, 160, 150, 140, 21, 14, 19,
819
+ 119, 102, 64, 63, 61, 83, 70, 104, 83, 58,
820
+ 124, 132, 56, 131, 97, 54, 93, 43, 5, 83,
821
+ 95, 145, 76, nil, 116, 76, nil, nil, 127, 138,
822
+ 103, nil, nil, nil, 38, nil, nil, 110, nil, nil,
823
+ nil, nil, nil, nil, 83, 83, nil, nil, 144, nil,
824
+ nil, nil, nil, nil, nil, 57, 121, 122, nil, nil,
825
+ 83, nil, nil, nil, nil, nil, nil, nil, nil, nil,
826
+ nil, nil, nil, nil, nil, nil, nil, 135, nil, nil,
827
+ nil, nil, nil, 93, nil, nil, nil, 70, 162, 137,
828
+ 70, 163, 161, 38, nil, nil, nil, nil, nil, nil,
829
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
830
+ nil, nil, nil, nil, nil, 165 ]
831
+
832
+ racc_goto_check = [
833
+ 2, 37, 37, 29, 13, 13, 28, 46, 31, 36,
834
+ 41, 41, 45, 37, 25, 44, 32, 25, 28, 47,
835
+ 24, 4, 4, 42, 23, 20, 21, 37, 29, 22,
836
+ 19, 18, 17, 26, 27, 16, 15, 12, 11, 33,
837
+ 34, 35, 10, 9, 8, 44, 37, 29, 44, 7,
838
+ 47, 43, 6, 25, 46, 5, 41, 3, 1, 44,
839
+ 41, 48, 42, nil, 24, 42, nil, nil, 32, 25,
840
+ 13, nil, nil, nil, 36, nil, nil, 41, nil, nil,
841
+ nil, nil, nil, nil, 44, 44, nil, nil, 47, nil,
842
+ nil, nil, nil, nil, nil, 41, 31, 45, nil, nil,
843
+ 44, nil, nil, nil, nil, nil, nil, nil, nil, nil,
844
+ nil, nil, nil, nil, nil, nil, nil, 46, nil, nil,
845
+ nil, nil, nil, 41, nil, nil, nil, 37, 29, 13,
846
+ 37, 29, 28, 36, nil, nil, nil, nil, nil, nil,
847
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
848
+ nil, nil, nil, nil, nil, 2 ]
849
+
850
+ racc_goto_pointer = [
851
+ nil, 58, -4, 51, 14, 47, 43, 39, 33, 31,
852
+ 29, 37, 35, 2, nil, -94, -105, 26, -14, -59,
853
+ -93, -108, -112, -127, -24, -60, -110, -118, -20, -24,
854
+ nil, 6, -34, 37, -50, -27, 6, -25, nil, nil,
855
+ nil, 1, -5, -63, -29, 3, -8, -47, -75 ]
856
+
857
+ racc_goto_default = [
858
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
859
+ nil, nil, nil, 48, 41, nil, nil, nil, nil, nil,
860
+ nil, nil, nil, nil, nil, 86, nil, nil, 30, 34,
861
+ 50, 51, nil, 46, 47, nil, 26, 28, 71, 72,
862
+ 33, 35, 114, 82, 18, nil, nil, nil, nil ]
863
+
864
+ racc_token_table = {
865
+ false => 0,
866
+ Object.new => 1,
867
+ :DATETIME => 2,
868
+ :RECEIVED => 3,
869
+ :MADDRESS => 4,
870
+ :RETPATH => 5,
871
+ :KEYWORDS => 6,
872
+ :ENCRYPTED => 7,
873
+ :MIMEVERSION => 8,
874
+ :CTYPE => 9,
875
+ :CENCODING => 10,
876
+ :CDISPOSITION => 11,
877
+ :ADDRESS => 12,
878
+ :MAILBOX => 13,
879
+ :DIGIT => 14,
880
+ :ATOM => 15,
881
+ "," => 16,
882
+ ":" => 17,
883
+ :FROM => 18,
884
+ :BY => 19,
885
+ "@" => 20,
886
+ :DOMLIT => 21,
887
+ :VIA => 22,
888
+ :WITH => 23,
889
+ :ID => 24,
890
+ :FOR => 25,
891
+ ";" => 26,
892
+ "<" => 27,
893
+ ">" => 28,
894
+ "." => 29,
895
+ :QUOTED => 30,
896
+ :TOKEN => 31,
897
+ "/" => 32,
898
+ "=" => 33 }
899
+
900
+ racc_use_result_var = false
901
+
902
+ racc_nt_base = 34
903
+
904
+ Racc_arg = [
905
+ racc_action_table,
906
+ racc_action_check,
907
+ racc_action_default,
908
+ racc_action_pointer,
909
+ racc_goto_table,
910
+ racc_goto_check,
911
+ racc_goto_default,
912
+ racc_goto_pointer,
913
+ racc_nt_base,
914
+ racc_reduce_table,
915
+ racc_token_table,
916
+ racc_shift_n,
917
+ racc_reduce_n,
918
+ racc_use_result_var ]
919
+
920
+ Racc_token_to_s_table = [
921
+ '$end',
922
+ 'error',
923
+ 'DATETIME',
924
+ 'RECEIVED',
925
+ 'MADDRESS',
926
+ 'RETPATH',
927
+ 'KEYWORDS',
928
+ 'ENCRYPTED',
929
+ 'MIMEVERSION',
930
+ 'CTYPE',
931
+ 'CENCODING',
932
+ 'CDISPOSITION',
933
+ 'ADDRESS',
934
+ 'MAILBOX',
935
+ 'DIGIT',
936
+ 'ATOM',
937
+ '","',
938
+ '":"',
939
+ 'FROM',
940
+ 'BY',
941
+ '"@"',
942
+ 'DOMLIT',
943
+ 'VIA',
944
+ 'WITH',
945
+ 'ID',
946
+ 'FOR',
947
+ '";"',
948
+ '"<"',
949
+ '">"',
950
+ '"."',
951
+ 'QUOTED',
952
+ 'TOKEN',
953
+ '"/"',
954
+ '"="',
955
+ '$start',
956
+ 'content',
957
+ 'datetime',
958
+ 'received',
959
+ 'addrs_TOP',
960
+ 'retpath',
961
+ 'keys',
962
+ 'enc',
963
+ 'version',
964
+ 'ctype',
965
+ 'cencode',
966
+ 'cdisp',
967
+ 'addr_TOP',
968
+ 'mbox',
969
+ 'day',
970
+ 'hour',
971
+ 'zone',
972
+ 'from',
973
+ 'by',
974
+ 'via',
975
+ 'with',
976
+ 'id',
977
+ 'for',
978
+ 'received_datetime',
979
+ 'received_domain',
980
+ 'domain',
981
+ 'msgid',
982
+ 'received_addrspec',
983
+ 'routeaddr',
984
+ 'spec',
985
+ 'addrs',
986
+ 'group_bare',
987
+ 'commas',
988
+ 'group',
989
+ 'addr',
990
+ 'mboxes',
991
+ 'addr_phrase',
992
+ 'local_head',
993
+ 'routes',
994
+ 'at_domains',
995
+ 'local',
996
+ 'word',
997
+ 'dots',
998
+ 'domword',
999
+ 'atom',
1000
+ 'phrase',
1001
+ 'params',
1002
+ 'opt_semicolon',
1003
+ 'value']
1004
+
1005
+ Racc_debug_parser = false
1006
+
1007
+ ##### racc system variables end #####
1008
+
1009
+ # reduce 0 omitted
1010
+
1011
+ module_eval <<'.,.,', 'parser.y', 16
1012
+ def _reduce_1( val, _values)
1013
+ val[1]
1014
+ end
1015
+ .,.,
1016
+
1017
+ module_eval <<'.,.,', 'parser.y', 17
1018
+ def _reduce_2( val, _values)
1019
+ val[1]
1020
+ end
1021
+ .,.,
1022
+
1023
+ module_eval <<'.,.,', 'parser.y', 18
1024
+ def _reduce_3( val, _values)
1025
+ val[1]
1026
+ end
1027
+ .,.,
1028
+
1029
+ module_eval <<'.,.,', 'parser.y', 19
1030
+ def _reduce_4( val, _values)
1031
+ val[1]
1032
+ end
1033
+ .,.,
1034
+
1035
+ module_eval <<'.,.,', 'parser.y', 20
1036
+ def _reduce_5( val, _values)
1037
+ val[1]
1038
+ end
1039
+ .,.,
1040
+
1041
+ module_eval <<'.,.,', 'parser.y', 21
1042
+ def _reduce_6( val, _values)
1043
+ val[1]
1044
+ end
1045
+ .,.,
1046
+
1047
+ module_eval <<'.,.,', 'parser.y', 22
1048
+ def _reduce_7( val, _values)
1049
+ val[1]
1050
+ end
1051
+ .,.,
1052
+
1053
+ module_eval <<'.,.,', 'parser.y', 23
1054
+ def _reduce_8( val, _values)
1055
+ val[1]
1056
+ end
1057
+ .,.,
1058
+
1059
+ module_eval <<'.,.,', 'parser.y', 24
1060
+ def _reduce_9( val, _values)
1061
+ val[1]
1062
+ end
1063
+ .,.,
1064
+
1065
+ module_eval <<'.,.,', 'parser.y', 25
1066
+ def _reduce_10( val, _values)
1067
+ val[1]
1068
+ end
1069
+ .,.,
1070
+
1071
+ module_eval <<'.,.,', 'parser.y', 26
1072
+ def _reduce_11( val, _values)
1073
+ val[1]
1074
+ end
1075
+ .,.,
1076
+
1077
+ module_eval <<'.,.,', 'parser.y', 27
1078
+ def _reduce_12( val, _values)
1079
+ val[1]
1080
+ end
1081
+ .,.,
1082
+
1083
+ module_eval <<'.,.,', 'parser.y', 33
1084
+ def _reduce_13( val, _values)
1085
+ t = Time.gm(val[3].to_i, val[2], val[1].to_i, 0, 0, 0)
1086
+ (t + val[4] - val[5]).localtime
1087
+ end
1088
+ .,.,
1089
+
1090
+ # reduce 14 omitted
1091
+
1092
+ # reduce 15 omitted
1093
+
1094
+ module_eval <<'.,.,', 'parser.y', 42
1095
+ def _reduce_16( val, _values)
1096
+ (val[0].to_i * 60 * 60) +
1097
+ (val[2].to_i * 60)
1098
+ end
1099
+ .,.,
1100
+
1101
+ module_eval <<'.,.,', 'parser.y', 47
1102
+ def _reduce_17( val, _values)
1103
+ (val[0].to_i * 60 * 60) +
1104
+ (val[2].to_i * 60) +
1105
+ (val[4].to_i)
1106
+ end
1107
+ .,.,
1108
+
1109
+ module_eval <<'.,.,', 'parser.y', 54
1110
+ def _reduce_18( val, _values)
1111
+ timezone_string_to_unixtime(val[0])
1112
+ end
1113
+ .,.,
1114
+
1115
+ module_eval <<'.,.,', 'parser.y', 59
1116
+ def _reduce_19( val, _values)
1117
+ val
1118
+ end
1119
+ .,.,
1120
+
1121
+ # reduce 20 omitted
1122
+
1123
+ module_eval <<'.,.,', 'parser.y', 65
1124
+ def _reduce_21( val, _values)
1125
+ val[1]
1126
+ end
1127
+ .,.,
1128
+
1129
+ # reduce 22 omitted
1130
+
1131
+ module_eval <<'.,.,', 'parser.y', 71
1132
+ def _reduce_23( val, _values)
1133
+ val[1]
1134
+ end
1135
+ .,.,
1136
+
1137
+ module_eval <<'.,.,', 'parser.y', 77
1138
+ def _reduce_24( val, _values)
1139
+ join_domain(val[0])
1140
+ end
1141
+ .,.,
1142
+
1143
+ module_eval <<'.,.,', 'parser.y', 81
1144
+ def _reduce_25( val, _values)
1145
+ join_domain(val[2])
1146
+ end
1147
+ .,.,
1148
+
1149
+ module_eval <<'.,.,', 'parser.y', 85
1150
+ def _reduce_26( val, _values)
1151
+ join_domain(val[0])
1152
+ end
1153
+ .,.,
1154
+
1155
+ # reduce 27 omitted
1156
+
1157
+ module_eval <<'.,.,', 'parser.y', 91
1158
+ def _reduce_28( val, _values)
1159
+ val[1]
1160
+ end
1161
+ .,.,
1162
+
1163
+ module_eval <<'.,.,', 'parser.y', 96
1164
+ def _reduce_29( val, _values)
1165
+ []
1166
+ end
1167
+ .,.,
1168
+
1169
+ module_eval <<'.,.,', 'parser.y', 100
1170
+ def _reduce_30( val, _values)
1171
+ val[0].push val[2]
1172
+ val[0]
1173
+ end
1174
+ .,.,
1175
+
1176
+ # reduce 31 omitted
1177
+
1178
+ module_eval <<'.,.,', 'parser.y', 107
1179
+ def _reduce_32( val, _values)
1180
+ val[1]
1181
+ end
1182
+ .,.,
1183
+
1184
+ module_eval <<'.,.,', 'parser.y', 111
1185
+ def _reduce_33( val, _values)
1186
+ val[1]
1187
+ end
1188
+ .,.,
1189
+
1190
+ # reduce 34 omitted
1191
+
1192
+ module_eval <<'.,.,', 'parser.y', 117
1193
+ def _reduce_35( val, _values)
1194
+ val[1]
1195
+ end
1196
+ .,.,
1197
+
1198
+ module_eval <<'.,.,', 'parser.y', 123
1199
+ def _reduce_36( val, _values)
1200
+ val[0].spec
1201
+ end
1202
+ .,.,
1203
+
1204
+ module_eval <<'.,.,', 'parser.y', 127
1205
+ def _reduce_37( val, _values)
1206
+ val[0].spec
1207
+ end
1208
+ .,.,
1209
+
1210
+ # reduce 38 omitted
1211
+
1212
+ module_eval <<'.,.,', 'parser.y', 134
1213
+ def _reduce_39( val, _values)
1214
+ val[1]
1215
+ end
1216
+ .,.,
1217
+
1218
+ # reduce 40 omitted
1219
+
1220
+ # reduce 41 omitted
1221
+
1222
+ # reduce 42 omitted
1223
+
1224
+ # reduce 43 omitted
1225
+
1226
+ # reduce 44 omitted
1227
+
1228
+ # reduce 45 omitted
1229
+
1230
+ # reduce 46 omitted
1231
+
1232
+ module_eval <<'.,.,', 'parser.y', 146
1233
+ def _reduce_47( val, _values)
1234
+ [ Address.new(nil, nil) ]
1235
+ end
1236
+ .,.,
1237
+
1238
+ module_eval <<'.,.,', 'parser.y', 148
1239
+ def _reduce_48( val, _values)
1240
+ val
1241
+ end
1242
+ .,.,
1243
+
1244
+ module_eval <<'.,.,', 'parser.y', 149
1245
+ def _reduce_49( val, _values)
1246
+ val[0].push val[2]; val[0]
1247
+ end
1248
+ .,.,
1249
+
1250
+ # reduce 50 omitted
1251
+
1252
+ # reduce 51 omitted
1253
+
1254
+ module_eval <<'.,.,', 'parser.y', 156
1255
+ def _reduce_52( val, _values)
1256
+ val
1257
+ end
1258
+ .,.,
1259
+
1260
+ module_eval <<'.,.,', 'parser.y', 160
1261
+ def _reduce_53( val, _values)
1262
+ val[0].push val[2]
1263
+ val[0]
1264
+ end
1265
+ .,.,
1266
+
1267
+ # reduce 54 omitted
1268
+
1269
+ # reduce 55 omitted
1270
+
1271
+ module_eval <<'.,.,', 'parser.y', 168
1272
+ def _reduce_56( val, _values)
1273
+ val[1].phrase = Decoder.decode(val[0])
1274
+ val[1]
1275
+ end
1276
+ .,.,
1277
+
1278
+ # reduce 57 omitted
1279
+
1280
+ module_eval <<'.,.,', 'parser.y', 176
1281
+ def _reduce_58( val, _values)
1282
+ AddressGroup.new(val[0], val[2])
1283
+ end
1284
+ .,.,
1285
+
1286
+ module_eval <<'.,.,', 'parser.y', 178
1287
+ def _reduce_59( val, _values)
1288
+ AddressGroup.new(val[0], [])
1289
+ end
1290
+ .,.,
1291
+
1292
+ module_eval <<'.,.,', 'parser.y', 181
1293
+ def _reduce_60( val, _values)
1294
+ val[0].join('.')
1295
+ end
1296
+ .,.,
1297
+
1298
+ module_eval <<'.,.,', 'parser.y', 182
1299
+ def _reduce_61( val, _values)
1300
+ val[0] << ' ' << val[1].join('.')
1301
+ end
1302
+ .,.,
1303
+
1304
+ module_eval <<'.,.,', 'parser.y', 186
1305
+ def _reduce_62( val, _values)
1306
+ val[2].routes.replace val[1]
1307
+ val[2]
1308
+ end
1309
+ .,.,
1310
+
1311
+ module_eval <<'.,.,', 'parser.y', 191
1312
+ def _reduce_63( val, _values)
1313
+ val[1]
1314
+ end
1315
+ .,.,
1316
+
1317
+ # reduce 64 omitted
1318
+
1319
+ module_eval <<'.,.,', 'parser.y', 196
1320
+ def _reduce_65( val, _values)
1321
+ [ val[1].join('.') ]
1322
+ end
1323
+ .,.,
1324
+
1325
+ module_eval <<'.,.,', 'parser.y', 197
1326
+ def _reduce_66( val, _values)
1327
+ val[0].push val[3].join('.'); val[0]
1328
+ end
1329
+ .,.,
1330
+
1331
+ module_eval <<'.,.,', 'parser.y', 199
1332
+ def _reduce_67( val, _values)
1333
+ Address.new( val[0], val[2] )
1334
+ end
1335
+ .,.,
1336
+
1337
+ module_eval <<'.,.,', 'parser.y', 200
1338
+ def _reduce_68( val, _values)
1339
+ Address.new( val[0], nil )
1340
+ end
1341
+ .,.,
1342
+
1343
+ # reduce 69 omitted
1344
+
1345
+ module_eval <<'.,.,', 'parser.y', 203
1346
+ def _reduce_70( val, _values)
1347
+ val[0].push ''; val[0]
1348
+ end
1349
+ .,.,
1350
+
1351
+ module_eval <<'.,.,', 'parser.y', 206
1352
+ def _reduce_71( val, _values)
1353
+ val
1354
+ end
1355
+ .,.,
1356
+
1357
+ module_eval <<'.,.,', 'parser.y', 209
1358
+ def _reduce_72( val, _values)
1359
+ val[1].times do
1360
+ val[0].push ''
1361
+ end
1362
+ val[0].push val[2]
1363
+ val[0]
1364
+ end
1365
+ .,.,
1366
+
1367
+ module_eval <<'.,.,', 'parser.y', 217
1368
+ def _reduce_73( val, _values)
1369
+ val
1370
+ end
1371
+ .,.,
1372
+
1373
+ module_eval <<'.,.,', 'parser.y', 220
1374
+ def _reduce_74( val, _values)
1375
+ val[1].times do
1376
+ val[0].push ''
1377
+ end
1378
+ val[0].push val[2]
1379
+ val[0]
1380
+ end
1381
+ .,.,
1382
+
1383
+ module_eval <<'.,.,', 'parser.y', 227
1384
+ def _reduce_75( val, _values)
1385
+ 0
1386
+ end
1387
+ .,.,
1388
+
1389
+ module_eval <<'.,.,', 'parser.y', 228
1390
+ def _reduce_76( val, _values)
1391
+ 1
1392
+ end
1393
+ .,.,
1394
+
1395
+ # reduce 77 omitted
1396
+
1397
+ # reduce 78 omitted
1398
+
1399
+ # reduce 79 omitted
1400
+
1401
+ # reduce 80 omitted
1402
+
1403
+ # reduce 81 omitted
1404
+
1405
+ # reduce 82 omitted
1406
+
1407
+ # reduce 83 omitted
1408
+
1409
+ # reduce 84 omitted
1410
+
1411
+ module_eval <<'.,.,', 'parser.y', 243
1412
+ def _reduce_85( val, _values)
1413
+ val[1] = val[1].spec
1414
+ val.join('')
1415
+ end
1416
+ .,.,
1417
+
1418
+ module_eval <<'.,.,', 'parser.y', 247
1419
+ def _reduce_86( val, _values)
1420
+ val
1421
+ end
1422
+ .,.,
1423
+
1424
+ module_eval <<'.,.,', 'parser.y', 248
1425
+ def _reduce_87( val, _values)
1426
+ val[0].push val[2]; val[0]
1427
+ end
1428
+ .,.,
1429
+
1430
+ # reduce 88 omitted
1431
+
1432
+ module_eval <<'.,.,', 'parser.y', 251
1433
+ def _reduce_89( val, _values)
1434
+ val[0] << ' ' << val[1]
1435
+ end
1436
+ .,.,
1437
+
1438
+ module_eval <<'.,.,', 'parser.y', 255
1439
+ def _reduce_90( val, _values)
1440
+ val.push nil
1441
+ val
1442
+ end
1443
+ .,.,
1444
+
1445
+ module_eval <<'.,.,', 'parser.y', 260
1446
+ def _reduce_91( val, _values)
1447
+ val
1448
+ end
1449
+ .,.,
1450
+
1451
+ module_eval <<'.,.,', 'parser.y', 265
1452
+ def _reduce_92( val, _values)
1453
+ [ val[0].to_i, val[2].to_i ]
1454
+ end
1455
+ .,.,
1456
+
1457
+ module_eval <<'.,.,', 'parser.y', 270
1458
+ def _reduce_93( val, _values)
1459
+ [ val[0].downcase, val[2].downcase, decode_params(val[3]) ]
1460
+ end
1461
+ .,.,
1462
+
1463
+ module_eval <<'.,.,', 'parser.y', 274
1464
+ def _reduce_94( val, _values)
1465
+ [ val[0].downcase, nil, decode_params(val[1]) ]
1466
+ end
1467
+ .,.,
1468
+
1469
+ module_eval <<'.,.,', 'parser.y', 279
1470
+ def _reduce_95( val, _values)
1471
+ {}
1472
+ end
1473
+ .,.,
1474
+
1475
+ module_eval <<'.,.,', 'parser.y', 283
1476
+ def _reduce_96( val, _values)
1477
+ val[0][ val[2].downcase ] = val[4]
1478
+ val[0]
1479
+ end
1480
+ .,.,
1481
+
1482
+ # reduce 97 omitted
1483
+
1484
+ # reduce 98 omitted
1485
+
1486
+ module_eval <<'.,.,', 'parser.y', 292
1487
+ def _reduce_99( val, _values)
1488
+ val[0].downcase
1489
+ end
1490
+ .,.,
1491
+
1492
+ module_eval <<'.,.,', 'parser.y', 297
1493
+ def _reduce_100( val, _values)
1494
+ [ val[0].downcase, decode_params(val[1]) ]
1495
+ end
1496
+ .,.,
1497
+
1498
+ # reduce 101 omitted
1499
+
1500
+ # reduce 102 omitted
1501
+
1502
+ # reduce 103 omitted
1503
+
1504
+ # reduce 104 omitted
1505
+
1506
+ # reduce 105 omitted
1507
+
1508
+ # reduce 106 omitted
1509
+
1510
+ # reduce 107 omitted
1511
+
1512
+ # reduce 108 omitted
1513
+
1514
+ # reduce 109 omitted
1515
+
1516
+ def _reduce_none( val, _values)
1517
+ val[0]
1518
+ end
1519
+
1520
+ end # class Parser
1521
+
1522
+ end # module TMail