actionmailer 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionmailer might be problematic. Click here for more details.

Files changed (34) hide show
  1. data/CHANGELOG +3 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +102 -0
  4. data/install.rb +61 -0
  5. data/lib/action_mailer.rb +44 -0
  6. data/lib/action_mailer/base.rb +111 -0
  7. data/lib/action_mailer/mail_helper.rb +17 -0
  8. data/lib/action_mailer/vendor/text/format.rb +1447 -0
  9. data/lib/action_mailer/vendor/tmail.rb +4 -0
  10. data/lib/action_mailer/vendor/tmail/address.rb +223 -0
  11. data/lib/action_mailer/vendor/tmail/base64.rb +52 -0
  12. data/lib/action_mailer/vendor/tmail/config.rb +50 -0
  13. data/lib/action_mailer/vendor/tmail/encode.rb +447 -0
  14. data/lib/action_mailer/vendor/tmail/facade.rb +531 -0
  15. data/lib/action_mailer/vendor/tmail/header.rb +893 -0
  16. data/lib/action_mailer/vendor/tmail/info.rb +16 -0
  17. data/lib/action_mailer/vendor/tmail/loader.rb +1 -0
  18. data/lib/action_mailer/vendor/tmail/mail.rb +420 -0
  19. data/lib/action_mailer/vendor/tmail/mailbox.rb +414 -0
  20. data/lib/action_mailer/vendor/tmail/mbox.rb +1 -0
  21. data/lib/action_mailer/vendor/tmail/net.rb +261 -0
  22. data/lib/action_mailer/vendor/tmail/obsolete.rb +116 -0
  23. data/lib/action_mailer/vendor/tmail/parser.rb +1503 -0
  24. data/lib/action_mailer/vendor/tmail/port.rb +358 -0
  25. data/lib/action_mailer/vendor/tmail/scanner.rb +22 -0
  26. data/lib/action_mailer/vendor/tmail/scanner_r.rb +244 -0
  27. data/lib/action_mailer/vendor/tmail/stringio.rb +260 -0
  28. data/lib/action_mailer/vendor/tmail/tmail.rb +1 -0
  29. data/lib/action_mailer/vendor/tmail/utils.rb +215 -0
  30. data/rakefile +99 -0
  31. data/test/fixtures/templates/signed_up.rhtml +3 -0
  32. data/test/fixtures/test_mailer/signed_up.rhtml +3 -0
  33. data/test/mail_service_test.rb +53 -0
  34. metadata +86 -0
@@ -0,0 +1 @@
1
+ require 'tmail/mailbox'
@@ -0,0 +1,261 @@
1
+ #
2
+ # net.rb
3
+ #
4
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
5
+ #
6
+ # This program is free software.
7
+ # You can distribute/modify this program under the terms of
8
+ # the GNU Lesser General Public License version 2 or later.
9
+ #
10
+
11
+ require 'nkf'
12
+
13
+
14
+ module TMail
15
+
16
+ class Mail
17
+
18
+ def send_to( smtp )
19
+ do_send_to(smtp) do
20
+ ready_to_send
21
+ end
22
+ end
23
+
24
+ def send_text_to( smtp )
25
+ do_send_to(smtp) do
26
+ ready_to_send
27
+ mime_encode
28
+ end
29
+ end
30
+
31
+ def do_send_to( smtp )
32
+ from = from_address or raise ArgumentError, 'no from address'
33
+ (dests = destinations).empty? and raise ArgumentError, 'no receipient'
34
+ yield
35
+ send_to_0 smtp, from, dests
36
+ end
37
+ private :do_send_to
38
+
39
+ def send_to_0( smtp, from, to )
40
+ smtp.ready(from, to) do |f|
41
+ encoded "\r\n", 'j', f, ''
42
+ end
43
+ end
44
+
45
+ def ready_to_send
46
+ delete_no_send_fields
47
+ add_message_id
48
+ add_date
49
+ end
50
+
51
+ NOSEND_FIELDS = %w(
52
+ received
53
+ bcc
54
+ )
55
+
56
+ def delete_no_send_fields
57
+ NOSEND_FIELDS.each do |nm|
58
+ delete nm
59
+ end
60
+ delete_if {|n,v| v.empty? }
61
+ end
62
+
63
+ def add_message_id( fqdn = nil )
64
+ self.message_id = ::TMail::new_msgid(fqdn)
65
+ end
66
+
67
+ def add_date
68
+ self.date = Time.now
69
+ end
70
+
71
+ def mime_encode
72
+ if parts.empty?
73
+ mime_encode_singlepart
74
+ else
75
+ mime_encode_multipart true
76
+ end
77
+ end
78
+
79
+ def mime_encode_singlepart
80
+ self.mime_version = '1.0'
81
+ b = body
82
+ if NKF.guess(b) != NKF::BINARY
83
+ mime_encode_text b
84
+ else
85
+ mime_encode_binary b
86
+ end
87
+ end
88
+
89
+ def mime_encode_text( body )
90
+ self.body = NKF.nkf('-j -m0', body)
91
+ self.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
92
+ self.encoding = '7bit'
93
+ end
94
+
95
+ def mime_encode_binary( body )
96
+ self.body = [body].pack('m')
97
+ self.set_content_type 'application', 'octet-stream'
98
+ self.encoding = 'Base64'
99
+ end
100
+
101
+ def mime_encode_multipart( top = true )
102
+ self.mime_version = '1.0' if top
103
+ self.set_content_type 'multipart', 'mixed'
104
+ e = encoding(nil)
105
+ if e and not /\A(?:7bit|8bit|binary)\z/i === e
106
+ raise ArgumentError,
107
+ 'using C.T.Encoding with multipart mail is not permitted'
108
+ end
109
+ end
110
+
111
+ def create_empty_mail
112
+ self.class.new(StringPort.new(''), @config)
113
+ end
114
+
115
+ def create_reply
116
+ setup_reply create_empty_mail()
117
+ end
118
+
119
+ def setup_reply( m )
120
+ if tmp = reply_addresses(nil)
121
+ m.to_addrs = tmp
122
+ end
123
+
124
+ mid = message_id(nil)
125
+ tmp = references(nil) || []
126
+ tmp.push mid if mid
127
+ m.in_reply_to = [mid] if mid
128
+ m.references = tmp unless tmp.empty?
129
+ m.subject = 'Re: ' + subject('').sub(/\A(?:\s*re:)+/i, '')
130
+
131
+ m
132
+ end
133
+
134
+ def create_forward
135
+ setup_forward create_empty_mail()
136
+ end
137
+
138
+ def setup_forward( mail )
139
+ m = Mail.new(StringPort.new(''))
140
+ m.body = decoded
141
+ m.set_content_type 'message', 'rfc822'
142
+ m.encoding = encoding('7bit')
143
+ mail.parts.push m
144
+ end
145
+
146
+ end
147
+
148
+
149
+ class DeleteFields
150
+
151
+ NOSEND_FIELDS = %w(
152
+ received
153
+ bcc
154
+ )
155
+
156
+ def initialize( nosend = nil, delempty = true )
157
+ @no_send_fields = nosend || NOSEND_FIELDS.dup
158
+ @delete_empty_fields = delempty
159
+ end
160
+
161
+ attr :no_send_fields
162
+ attr :delete_empty_fields, true
163
+
164
+ def exec( mail )
165
+ @no_send_fields.each do |nm|
166
+ delete nm
167
+ end
168
+ delete_if {|n,v| v.empty? } if @delete_empty_fields
169
+ end
170
+
171
+ end
172
+
173
+
174
+ class AddMessageId
175
+
176
+ def initialize( fqdn = nil )
177
+ @fqdn = fqdn
178
+ end
179
+
180
+ attr :fqdn, true
181
+
182
+ def exec( mail )
183
+ mail.message_id = ::TMail::new_msgid(@fqdn)
184
+ end
185
+
186
+ end
187
+
188
+
189
+ class AddDate
190
+
191
+ def exec( mail )
192
+ mail.date = Time.now
193
+ end
194
+
195
+ end
196
+
197
+
198
+ class MimeEncodeAuto
199
+
200
+ def initialize( s = nil, m = nil )
201
+ @singlepart_composer = s || MimeEncodeSingle.new
202
+ @multipart_composer = m || MimeEncodeMulti.new
203
+ end
204
+
205
+ attr :singlepart_composer
206
+ attr :multipart_composer
207
+
208
+ def exec( mail )
209
+ if mail._builtin_multipart?
210
+ then @multipart_composer
211
+ else @singlepart_composer end.exec mail
212
+ end
213
+
214
+ end
215
+
216
+
217
+ class MimeEncodeSingle
218
+
219
+ def exec( mail )
220
+ mail.mime_version = '1.0'
221
+ b = mail.body
222
+ if NKF.guess(b) != NKF::BINARY
223
+ on_text b
224
+ else
225
+ on_binary b
226
+ end
227
+ end
228
+
229
+ def on_text( body )
230
+ mail.body = NKF.nkf('-j -m0', body)
231
+ mail.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
232
+ mail.encoding = '7bit'
233
+ end
234
+
235
+ def on_binary( body )
236
+ mail.body = [body].pack('m')
237
+ mail.set_content_type 'application', 'octet-stream'
238
+ mail.encoding = 'Base64'
239
+ end
240
+
241
+ end
242
+
243
+
244
+ class MimeEncodeMulti
245
+
246
+ def exec( mail, top = true )
247
+ mail.mime_version = '1.0' if top
248
+ mail.set_content_type 'multipart', 'mixed'
249
+ e = encoding(nil)
250
+ if e and not /\A(?:7bit|8bit|binary)\z/i === e
251
+ raise ArgumentError,
252
+ 'using C.T.Encoding with multipart mail is not permitted'
253
+ end
254
+ mail.parts.each do |m|
255
+ exec m, false if m._builtin_multipart?
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end # module TMail
@@ -0,0 +1,116 @@
1
+ #
2
+ # obsolete.rb
3
+ #
4
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
5
+ #
6
+ # This program is free software.
7
+ # You can distribute/modify this program under the terms of
8
+ # the GNU Lesser General Public License version 2 or later.
9
+ #
10
+
11
+ module TMail
12
+
13
+ # mail.rb
14
+ class Mail
15
+ alias include? key?
16
+ alias has_key? key?
17
+
18
+ def values
19
+ ret = []
20
+ each_field {|v| ret.push v }
21
+ ret
22
+ end
23
+
24
+ def value?( val )
25
+ HeaderField === val or return false
26
+
27
+ [ @header[val.name.downcase] ].flatten.include? val
28
+ end
29
+
30
+ alias has_value? value?
31
+ end
32
+
33
+
34
+ # facade.rb
35
+ class Mail
36
+ def from_addr( default = nil )
37
+ addr, = from_addrs(nil)
38
+ addr || default
39
+ end
40
+
41
+ def from_address( default = nil )
42
+ if a = from_addr(nil)
43
+ a.spec
44
+ else
45
+ default
46
+ end
47
+ end
48
+
49
+ alias from_address= from_addrs=
50
+
51
+ def from_phrase( default = nil )
52
+ if a = from_addr(nil)
53
+ a.phrase
54
+ else
55
+ default
56
+ end
57
+ end
58
+
59
+ alias msgid message_id
60
+ alias msgid= message_id=
61
+
62
+ alias each_dest each_destination
63
+ end
64
+
65
+
66
+ # address.rb
67
+ class Address
68
+ alias route routes
69
+ alias addr spec
70
+
71
+ def spec=( str )
72
+ @local, @domain = str.split(/@/,2).map {|s| s.split(/\./) }
73
+ end
74
+
75
+ alias addr= spec=
76
+ alias address= spec=
77
+ end
78
+
79
+
80
+ # mbox.rb
81
+ class MhMailbox
82
+ alias new_mail new_port
83
+ alias each_mail each_port
84
+ alias each_newmail each_new_port
85
+ end
86
+ class UNIXMbox
87
+ alias new_mail new_port
88
+ alias each_mail each_port
89
+ alias each_newmail each_new_port
90
+ end
91
+ class Maildir
92
+ alias new_mail new_port
93
+ alias each_mail each_port
94
+ alias each_newmail each_new_port
95
+ end
96
+
97
+
98
+ # utils.rb
99
+ extend TextUtils
100
+
101
+ class << self
102
+ alias msgid? message_id?
103
+ alias boundary new_boundary
104
+ alias msgid new_message_id
105
+ alias new_msgid new_message_id
106
+ end
107
+
108
+ def Mail.boundary
109
+ ::TMail.new_boundary
110
+ end
111
+
112
+ def Mail.msgid
113
+ ::TMail.new_message_id
114
+ end
115
+
116
+ end # module TMail
@@ -0,0 +1,1503 @@
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
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
494
+ #
495
+ # This program is free software.
496
+ # You can distribute/modify this program under the terms of
497
+ # the GNU Lesser General Public License version 2 or later.
498
+ #
499
+
500
+ require 'tmail/scanner'
501
+ require 'tmail/utils'
502
+
503
+
504
+ module TMail
505
+
506
+ class Parser < Racc::Parser
507
+
508
+ module_eval <<'..end parser.y modeval..id43721faf1c', 'parser.y', 331
509
+
510
+ include TextUtils
511
+
512
+ def self.parse( ident, str, cmt = nil )
513
+ new.parse(ident, str, cmt)
514
+ end
515
+
516
+ MAILP_DEBUG = false
517
+
518
+ def initialize
519
+ self.debug = MAILP_DEBUG
520
+ end
521
+
522
+ def debug=( flag )
523
+ @yydebug = flag && Racc_debug_parser
524
+ @scanner_debug = flag
525
+ end
526
+
527
+ def debug
528
+ @yydebug
529
+ end
530
+
531
+ def parse( ident, str, comments = nil )
532
+ @scanner = Scanner.new(str, ident, comments)
533
+ @scanner.debug = @scanner_debug
534
+ @first = [ident, ident]
535
+ result = yyparse(self, :parse_in)
536
+ comments.map! {|c| to_kcode(c) } if comments
537
+ result
538
+ end
539
+
540
+ private
541
+
542
+ def parse_in( &block )
543
+ yield @first
544
+ @scanner.scan(&block)
545
+ end
546
+
547
+ def on_error( t, val, vstack )
548
+ raise SyntaxError, "parse error on token #{racc_token2str t}"
549
+ end
550
+
551
+ ..end parser.y modeval..id43721faf1c
552
+
553
+ ##### racc 1.4.3 generates ###
554
+
555
+ racc_reduce_table = [
556
+ 0, 0, :racc_error,
557
+ 2, 35, :_reduce_1,
558
+ 2, 35, :_reduce_2,
559
+ 2, 35, :_reduce_3,
560
+ 2, 35, :_reduce_4,
561
+ 2, 35, :_reduce_5,
562
+ 2, 35, :_reduce_6,
563
+ 2, 35, :_reduce_7,
564
+ 2, 35, :_reduce_8,
565
+ 2, 35, :_reduce_9,
566
+ 2, 35, :_reduce_10,
567
+ 2, 35, :_reduce_11,
568
+ 2, 35, :_reduce_12,
569
+ 6, 36, :_reduce_13,
570
+ 0, 48, :_reduce_none,
571
+ 2, 48, :_reduce_none,
572
+ 3, 49, :_reduce_16,
573
+ 5, 49, :_reduce_17,
574
+ 1, 50, :_reduce_18,
575
+ 7, 37, :_reduce_19,
576
+ 0, 51, :_reduce_none,
577
+ 2, 51, :_reduce_21,
578
+ 0, 52, :_reduce_none,
579
+ 2, 52, :_reduce_23,
580
+ 1, 58, :_reduce_24,
581
+ 3, 58, :_reduce_25,
582
+ 2, 58, :_reduce_26,
583
+ 0, 53, :_reduce_none,
584
+ 2, 53, :_reduce_28,
585
+ 0, 54, :_reduce_29,
586
+ 3, 54, :_reduce_30,
587
+ 0, 55, :_reduce_none,
588
+ 2, 55, :_reduce_32,
589
+ 2, 55, :_reduce_33,
590
+ 0, 56, :_reduce_none,
591
+ 2, 56, :_reduce_35,
592
+ 1, 61, :_reduce_36,
593
+ 1, 61, :_reduce_37,
594
+ 0, 57, :_reduce_none,
595
+ 2, 57, :_reduce_39,
596
+ 1, 38, :_reduce_none,
597
+ 1, 38, :_reduce_none,
598
+ 3, 38, :_reduce_none,
599
+ 1, 46, :_reduce_none,
600
+ 1, 46, :_reduce_none,
601
+ 1, 46, :_reduce_none,
602
+ 1, 39, :_reduce_none,
603
+ 2, 39, :_reduce_47,
604
+ 1, 64, :_reduce_48,
605
+ 3, 64, :_reduce_49,
606
+ 1, 68, :_reduce_none,
607
+ 1, 68, :_reduce_none,
608
+ 1, 69, :_reduce_52,
609
+ 3, 69, :_reduce_53,
610
+ 1, 47, :_reduce_none,
611
+ 1, 47, :_reduce_none,
612
+ 2, 47, :_reduce_56,
613
+ 2, 67, :_reduce_none,
614
+ 3, 65, :_reduce_58,
615
+ 2, 65, :_reduce_59,
616
+ 1, 70, :_reduce_60,
617
+ 2, 70, :_reduce_61,
618
+ 4, 62, :_reduce_62,
619
+ 3, 62, :_reduce_63,
620
+ 2, 72, :_reduce_none,
621
+ 2, 73, :_reduce_65,
622
+ 4, 73, :_reduce_66,
623
+ 3, 63, :_reduce_67,
624
+ 1, 63, :_reduce_68,
625
+ 1, 74, :_reduce_none,
626
+ 2, 74, :_reduce_70,
627
+ 1, 71, :_reduce_71,
628
+ 3, 71, :_reduce_72,
629
+ 1, 59, :_reduce_73,
630
+ 3, 59, :_reduce_74,
631
+ 1, 76, :_reduce_75,
632
+ 2, 76, :_reduce_76,
633
+ 1, 75, :_reduce_none,
634
+ 1, 75, :_reduce_none,
635
+ 1, 75, :_reduce_none,
636
+ 1, 77, :_reduce_none,
637
+ 1, 77, :_reduce_none,
638
+ 1, 77, :_reduce_none,
639
+ 1, 66, :_reduce_none,
640
+ 2, 66, :_reduce_none,
641
+ 3, 60, :_reduce_85,
642
+ 1, 40, :_reduce_86,
643
+ 3, 40, :_reduce_87,
644
+ 1, 79, :_reduce_none,
645
+ 2, 79, :_reduce_89,
646
+ 1, 41, :_reduce_90,
647
+ 2, 41, :_reduce_91,
648
+ 3, 42, :_reduce_92,
649
+ 5, 43, :_reduce_93,
650
+ 3, 43, :_reduce_94,
651
+ 0, 80, :_reduce_95,
652
+ 5, 80, :_reduce_96,
653
+ 1, 82, :_reduce_none,
654
+ 1, 82, :_reduce_none,
655
+ 1, 44, :_reduce_99,
656
+ 3, 45, :_reduce_100,
657
+ 0, 81, :_reduce_none,
658
+ 1, 81, :_reduce_none,
659
+ 1, 78, :_reduce_none,
660
+ 1, 78, :_reduce_none,
661
+ 1, 78, :_reduce_none,
662
+ 1, 78, :_reduce_none,
663
+ 1, 78, :_reduce_none,
664
+ 1, 78, :_reduce_none,
665
+ 1, 78, :_reduce_none ]
666
+
667
+ racc_reduce_n = 110
668
+
669
+ racc_shift_n = 168
670
+
671
+ racc_action_table = [
672
+ -70, -69, 23, 25, 146, 147, 29, 31, 105, 106,
673
+ 16, 17, 20, 22, 136, 27, -70, -69, 32, 101,
674
+ -70, -69, 154, 100, 113, 115, -70, -69, -70, 109,
675
+ 75, 23, 25, 101, 155, 29, 31, 142, 143, 16,
676
+ 17, 20, 22, 107, 27, 23, 25, 32, 98, 29,
677
+ 31, 96, 94, 16, 17, 20, 22, 78, 27, 23,
678
+ 25, 32, 112, 29, 31, 74, 91, 16, 17, 20,
679
+ 22, 88, 117, 92, 81, 32, 23, 25, 80, 123,
680
+ 29, 31, 100, 125, 16, 17, 20, 22, 126, 23,
681
+ 25, 109, 32, 29, 31, 91, 128, 16, 17, 20,
682
+ 22, 129, 27, 23, 25, 32, 101, 29, 31, 101,
683
+ 130, 16, 17, 20, 22, 79, 52, 23, 25, 32,
684
+ 78, 29, 31, 133, 78, 16, 17, 20, 22, 77,
685
+ 23, 25, 75, 32, 29, 31, 65, 62, 16, 17,
686
+ 20, 22, 139, 23, 25, 101, 32, 29, 31, 60,
687
+ 100, 16, 17, 20, 22, 44, 27, 101, 148, 32,
688
+ 23, 25, 120, 149, 29, 31, 152, 153, 16, 17,
689
+ 20, 22, 42, 27, 157, 159, 32, 23, 25, 120,
690
+ 40, 29, 31, 15, 164, 16, 17, 20, 22, 40,
691
+ 27, 23, 25, 32, 68, 29, 31, 166, 167, 16,
692
+ 17, 20, 22, nil, 27, 23, 25, 32, nil, 29,
693
+ 31, 74, nil, 16, 17, 20, 22, nil, 23, 25,
694
+ nil, 32, 29, 31, nil, nil, 16, 17, 20, 22,
695
+ nil, 23, 25, nil, 32, 29, 31, nil, nil, 16,
696
+ 17, 20, 22, nil, 23, 25, nil, 32, 29, 31,
697
+ nil, nil, 16, 17, 20, 22, nil, 23, 25, nil,
698
+ 32, 29, 31, nil, nil, 16, 17, 20, 22, nil,
699
+ 27, 23, 25, 32, nil, 29, 31, nil, nil, 16,
700
+ 17, 20, 22, nil, 23, 25, nil, 32, 29, 31,
701
+ nil, nil, 16, 17, 20, 22, nil, 23, 25, nil,
702
+ 32, 29, 31, nil, nil, 16, 17, 20, 22, nil,
703
+ 84, 25, nil, 32, 29, 31, nil, 87, 16, 17,
704
+ 20, 22, 4, 6, 7, 8, 9, 10, 11, 12,
705
+ 13, 1, 2, 3, 84, 25, nil, nil, 29, 31,
706
+ nil, 87, 16, 17, 20, 22, 84, 25, nil, nil,
707
+ 29, 31, nil, 87, 16, 17, 20, 22, 84, 25,
708
+ nil, nil, 29, 31, nil, 87, 16, 17, 20, 22,
709
+ 84, 25, nil, nil, 29, 31, nil, 87, 16, 17,
710
+ 20, 22, 84, 25, nil, nil, 29, 31, nil, 87,
711
+ 16, 17, 20, 22, 84, 25, nil, nil, 29, 31,
712
+ nil, 87, 16, 17, 20, 22 ]
713
+
714
+ racc_action_check = [
715
+ 75, 28, 68, 68, 136, 136, 68, 68, 72, 72,
716
+ 68, 68, 68, 68, 126, 68, 75, 28, 68, 67,
717
+ 75, 28, 143, 66, 86, 86, 75, 28, 75, 75,
718
+ 28, 3, 3, 86, 143, 3, 3, 134, 134, 3,
719
+ 3, 3, 3, 73, 3, 152, 152, 3, 62, 152,
720
+ 152, 60, 56, 152, 152, 152, 152, 51, 152, 52,
721
+ 52, 152, 80, 52, 52, 52, 50, 52, 52, 52,
722
+ 52, 45, 89, 52, 42, 52, 71, 71, 41, 96,
723
+ 71, 71, 97, 98, 71, 71, 71, 71, 100, 7,
724
+ 7, 101, 71, 7, 7, 102, 104, 7, 7, 7,
725
+ 7, 105, 7, 8, 8, 7, 108, 8, 8, 111,
726
+ 112, 8, 8, 8, 8, 40, 8, 9, 9, 8,
727
+ 36, 9, 9, 117, 121, 9, 9, 9, 9, 33,
728
+ 10, 10, 70, 9, 10, 10, 13, 12, 10, 10,
729
+ 10, 10, 130, 2, 2, 131, 10, 2, 2, 11,
730
+ 135, 2, 2, 2, 2, 6, 2, 138, 139, 2,
731
+ 90, 90, 90, 140, 90, 90, 141, 142, 90, 90,
732
+ 90, 90, 5, 90, 148, 151, 90, 127, 127, 127,
733
+ 4, 127, 127, 1, 157, 127, 127, 127, 127, 159,
734
+ 127, 26, 26, 127, 26, 26, 26, 163, 164, 26,
735
+ 26, 26, 26, nil, 26, 27, 27, 26, nil, 27,
736
+ 27, 27, nil, 27, 27, 27, 27, nil, 155, 155,
737
+ nil, 27, 155, 155, nil, nil, 155, 155, 155, 155,
738
+ nil, 122, 122, nil, 155, 122, 122, nil, nil, 122,
739
+ 122, 122, 122, nil, 76, 76, nil, 122, 76, 76,
740
+ nil, nil, 76, 76, 76, 76, nil, 38, 38, nil,
741
+ 76, 38, 38, nil, nil, 38, 38, 38, 38, nil,
742
+ 38, 55, 55, 38, nil, 55, 55, nil, nil, 55,
743
+ 55, 55, 55, nil, 94, 94, nil, 55, 94, 94,
744
+ nil, nil, 94, 94, 94, 94, nil, 59, 59, nil,
745
+ 94, 59, 59, nil, nil, 59, 59, 59, 59, nil,
746
+ 114, 114, nil, 59, 114, 114, nil, 114, 114, 114,
747
+ 114, 114, 0, 0, 0, 0, 0, 0, 0, 0,
748
+ 0, 0, 0, 0, 77, 77, nil, nil, 77, 77,
749
+ nil, 77, 77, 77, 77, 77, 44, 44, nil, nil,
750
+ 44, 44, nil, 44, 44, 44, 44, 44, 113, 113,
751
+ nil, nil, 113, 113, nil, 113, 113, 113, 113, 113,
752
+ 88, 88, nil, nil, 88, 88, nil, 88, 88, 88,
753
+ 88, 88, 74, 74, nil, nil, 74, 74, nil, 74,
754
+ 74, 74, 74, 74, 129, 129, nil, nil, 129, 129,
755
+ nil, 129, 129, 129, 129, 129 ]
756
+
757
+ racc_action_pointer = [
758
+ 320, 152, 129, 17, 165, 172, 137, 75, 89, 103,
759
+ 116, 135, 106, 105, nil, nil, nil, nil, nil, nil,
760
+ nil, nil, nil, nil, nil, nil, 177, 191, 1, nil,
761
+ nil, nil, nil, 109, nil, nil, 94, nil, 243, nil,
762
+ 99, 64, 74, nil, 332, 52, nil, nil, nil, nil,
763
+ 50, 31, 45, nil, nil, 257, 36, nil, nil, 283,
764
+ 22, nil, 16, nil, nil, nil, -3, -10, -12, nil,
765
+ 103, 62, -8, 15, 368, 0, 230, 320, nil, nil,
766
+ 47, nil, nil, nil, nil, nil, 4, nil, 356, 50,
767
+ 146, nil, nil, nil, 270, nil, 65, 56, 52, nil,
768
+ 57, 62, 79, nil, 68, 81, nil, nil, 77, nil,
769
+ nil, 80, 96, 344, 296, nil, nil, 108, nil, nil,
770
+ nil, 98, 217, nil, nil, nil, -19, 163, nil, 380,
771
+ 128, 116, nil, nil, 14, 124, -26, nil, 128, 141,
772
+ 148, 141, 152, 7, nil, nil, nil, nil, 160, nil,
773
+ nil, 149, 31, nil, nil, 204, nil, 167, nil, 174,
774
+ nil, nil, nil, 169, 184, nil, nil, nil ]
775
+
776
+ racc_action_default = [
777
+ -110, -110, -110, -110, -14, -110, -20, -110, -110, -110,
778
+ -110, -110, -110, -110, -10, -95, -106, -107, -77, -44,
779
+ -108, -11, -109, -79, -43, -103, -110, -110, -60, -104,
780
+ -55, -105, -78, -68, -54, -71, -45, -12, -110, -1,
781
+ -110, -110, -110, -2, -110, -22, -51, -48, -50, -3,
782
+ -40, -41, -110, -46, -4, -86, -5, -88, -6, -90,
783
+ -110, -7, -95, -8, -9, -99, -101, -61, -59, -56,
784
+ -69, -110, -110, -110, -110, -75, -110, -110, -57, -15,
785
+ -110, 168, -73, -80, -82, -21, -24, -81, -110, -27,
786
+ -110, -83, -47, -89, -110, -91, -110, -101, -110, -100,
787
+ -102, -75, -58, -52, -110, -110, -64, -63, -65, -76,
788
+ -72, -67, -110, -110, -110, -26, -23, -110, -29, -49,
789
+ -84, -42, -87, -92, -94, -95, -110, -110, -62, -110,
790
+ -110, -25, -74, -28, -31, -101, -110, -53, -66, -110,
791
+ -110, -34, -110, -110, -93, -96, -98, -97, -110, -18,
792
+ -13, -38, -110, -30, -33, -110, -32, -16, -19, -14,
793
+ -35, -36, -37, -110, -110, -39, -85, -17 ]
794
+
795
+ racc_goto_table = [
796
+ 39, 67, 70, 73, 24, 37, 69, 66, 36, 38,
797
+ 57, 59, 55, 67, 108, 83, 90, 111, 69, 99,
798
+ 85, 49, 53, 76, 158, 134, 141, 70, 73, 151,
799
+ 118, 89, 45, 156, 160, 150, 140, 21, 14, 19,
800
+ 119, 102, 64, 63, 61, 83, 70, 104, 83, 58,
801
+ 124, 132, 56, 131, 97, 54, 93, 43, 5, 83,
802
+ 95, 145, 76, nil, 116, 76, nil, nil, 127, 138,
803
+ 103, nil, nil, nil, 38, nil, nil, 110, nil, nil,
804
+ nil, nil, nil, nil, 83, 83, nil, nil, 144, nil,
805
+ nil, nil, nil, nil, nil, 57, 121, 122, nil, nil,
806
+ 83, nil, nil, nil, nil, nil, nil, nil, nil, nil,
807
+ nil, nil, nil, nil, nil, nil, nil, 135, nil, nil,
808
+ nil, nil, nil, 93, nil, nil, nil, 70, 162, 137,
809
+ 70, 163, 161, 38, nil, nil, nil, nil, nil, nil,
810
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
811
+ nil, nil, nil, nil, nil, 165 ]
812
+
813
+ racc_goto_check = [
814
+ 2, 37, 37, 29, 13, 13, 28, 46, 31, 36,
815
+ 41, 41, 45, 37, 25, 44, 32, 25, 28, 47,
816
+ 24, 4, 4, 42, 23, 20, 21, 37, 29, 22,
817
+ 19, 18, 17, 26, 27, 16, 15, 12, 11, 33,
818
+ 34, 35, 10, 9, 8, 44, 37, 29, 44, 7,
819
+ 47, 43, 6, 25, 46, 5, 41, 3, 1, 44,
820
+ 41, 48, 42, nil, 24, 42, nil, nil, 32, 25,
821
+ 13, nil, nil, nil, 36, nil, nil, 41, nil, nil,
822
+ nil, nil, nil, nil, 44, 44, nil, nil, 47, nil,
823
+ nil, nil, nil, nil, nil, 41, 31, 45, nil, nil,
824
+ 44, nil, nil, nil, nil, nil, nil, nil, nil, nil,
825
+ nil, nil, nil, nil, nil, nil, nil, 46, nil, nil,
826
+ nil, nil, nil, 41, nil, nil, nil, 37, 29, 13,
827
+ 37, 29, 28, 36, nil, nil, nil, nil, nil, nil,
828
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
829
+ nil, nil, nil, nil, nil, 2 ]
830
+
831
+ racc_goto_pointer = [
832
+ nil, 58, -4, 51, 14, 47, 43, 39, 33, 31,
833
+ 29, 37, 35, 2, nil, -94, -105, 26, -14, -59,
834
+ -93, -108, -112, -127, -24, -60, -110, -118, -20, -24,
835
+ nil, 6, -34, 37, -50, -27, 6, -25, nil, nil,
836
+ nil, 1, -5, -63, -29, 3, -8, -47, -75 ]
837
+
838
+ racc_goto_default = [
839
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
840
+ nil, nil, nil, 48, 41, nil, nil, nil, nil, nil,
841
+ nil, nil, nil, nil, nil, 86, nil, nil, 30, 34,
842
+ 50, 51, nil, 46, 47, nil, 26, 28, 71, 72,
843
+ 33, 35, 114, 82, 18, nil, nil, nil, nil ]
844
+
845
+ racc_token_table = {
846
+ false => 0,
847
+ Object.new => 1,
848
+ :DATETIME => 2,
849
+ :RECEIVED => 3,
850
+ :MADDRESS => 4,
851
+ :RETPATH => 5,
852
+ :KEYWORDS => 6,
853
+ :ENCRYPTED => 7,
854
+ :MIMEVERSION => 8,
855
+ :CTYPE => 9,
856
+ :CENCODING => 10,
857
+ :CDISPOSITION => 11,
858
+ :ADDRESS => 12,
859
+ :MAILBOX => 13,
860
+ :DIGIT => 14,
861
+ :ATOM => 15,
862
+ "," => 16,
863
+ ":" => 17,
864
+ :FROM => 18,
865
+ :BY => 19,
866
+ "@" => 20,
867
+ :DOMLIT => 21,
868
+ :VIA => 22,
869
+ :WITH => 23,
870
+ :ID => 24,
871
+ :FOR => 25,
872
+ ";" => 26,
873
+ "<" => 27,
874
+ ">" => 28,
875
+ "." => 29,
876
+ :QUOTED => 30,
877
+ :TOKEN => 31,
878
+ "/" => 32,
879
+ "=" => 33 }
880
+
881
+ racc_use_result_var = false
882
+
883
+ racc_nt_base = 34
884
+
885
+ Racc_arg = [
886
+ racc_action_table,
887
+ racc_action_check,
888
+ racc_action_default,
889
+ racc_action_pointer,
890
+ racc_goto_table,
891
+ racc_goto_check,
892
+ racc_goto_default,
893
+ racc_goto_pointer,
894
+ racc_nt_base,
895
+ racc_reduce_table,
896
+ racc_token_table,
897
+ racc_shift_n,
898
+ racc_reduce_n,
899
+ racc_use_result_var ]
900
+
901
+ Racc_token_to_s_table = [
902
+ '$end',
903
+ 'error',
904
+ 'DATETIME',
905
+ 'RECEIVED',
906
+ 'MADDRESS',
907
+ 'RETPATH',
908
+ 'KEYWORDS',
909
+ 'ENCRYPTED',
910
+ 'MIMEVERSION',
911
+ 'CTYPE',
912
+ 'CENCODING',
913
+ 'CDISPOSITION',
914
+ 'ADDRESS',
915
+ 'MAILBOX',
916
+ 'DIGIT',
917
+ 'ATOM',
918
+ '","',
919
+ '":"',
920
+ 'FROM',
921
+ 'BY',
922
+ '"@"',
923
+ 'DOMLIT',
924
+ 'VIA',
925
+ 'WITH',
926
+ 'ID',
927
+ 'FOR',
928
+ '";"',
929
+ '"<"',
930
+ '">"',
931
+ '"."',
932
+ 'QUOTED',
933
+ 'TOKEN',
934
+ '"/"',
935
+ '"="',
936
+ '$start',
937
+ 'content',
938
+ 'datetime',
939
+ 'received',
940
+ 'addrs_TOP',
941
+ 'retpath',
942
+ 'keys',
943
+ 'enc',
944
+ 'version',
945
+ 'ctype',
946
+ 'cencode',
947
+ 'cdisp',
948
+ 'addr_TOP',
949
+ 'mbox',
950
+ 'day',
951
+ 'hour',
952
+ 'zone',
953
+ 'from',
954
+ 'by',
955
+ 'via',
956
+ 'with',
957
+ 'id',
958
+ 'for',
959
+ 'received_datetime',
960
+ 'received_domain',
961
+ 'domain',
962
+ 'msgid',
963
+ 'received_addrspec',
964
+ 'routeaddr',
965
+ 'spec',
966
+ 'addrs',
967
+ 'group_bare',
968
+ 'commas',
969
+ 'group',
970
+ 'addr',
971
+ 'mboxes',
972
+ 'addr_phrase',
973
+ 'local_head',
974
+ 'routes',
975
+ 'at_domains',
976
+ 'local',
977
+ 'word',
978
+ 'dots',
979
+ 'domword',
980
+ 'atom',
981
+ 'phrase',
982
+ 'params',
983
+ 'opt_semicolon',
984
+ 'value']
985
+
986
+ Racc_debug_parser = false
987
+
988
+ ##### racc system variables end #####
989
+
990
+ # reduce 0 omitted
991
+
992
+ module_eval <<'.,.,', 'parser.y', 16
993
+ def _reduce_1( val, _values)
994
+ val[1]
995
+ end
996
+ .,.,
997
+
998
+ module_eval <<'.,.,', 'parser.y', 17
999
+ def _reduce_2( val, _values)
1000
+ val[1]
1001
+ end
1002
+ .,.,
1003
+
1004
+ module_eval <<'.,.,', 'parser.y', 18
1005
+ def _reduce_3( val, _values)
1006
+ val[1]
1007
+ end
1008
+ .,.,
1009
+
1010
+ module_eval <<'.,.,', 'parser.y', 19
1011
+ def _reduce_4( val, _values)
1012
+ val[1]
1013
+ end
1014
+ .,.,
1015
+
1016
+ module_eval <<'.,.,', 'parser.y', 20
1017
+ def _reduce_5( val, _values)
1018
+ val[1]
1019
+ end
1020
+ .,.,
1021
+
1022
+ module_eval <<'.,.,', 'parser.y', 21
1023
+ def _reduce_6( val, _values)
1024
+ val[1]
1025
+ end
1026
+ .,.,
1027
+
1028
+ module_eval <<'.,.,', 'parser.y', 22
1029
+ def _reduce_7( val, _values)
1030
+ val[1]
1031
+ end
1032
+ .,.,
1033
+
1034
+ module_eval <<'.,.,', 'parser.y', 23
1035
+ def _reduce_8( val, _values)
1036
+ val[1]
1037
+ end
1038
+ .,.,
1039
+
1040
+ module_eval <<'.,.,', 'parser.y', 24
1041
+ def _reduce_9( val, _values)
1042
+ val[1]
1043
+ end
1044
+ .,.,
1045
+
1046
+ module_eval <<'.,.,', 'parser.y', 25
1047
+ def _reduce_10( val, _values)
1048
+ val[1]
1049
+ end
1050
+ .,.,
1051
+
1052
+ module_eval <<'.,.,', 'parser.y', 26
1053
+ def _reduce_11( val, _values)
1054
+ val[1]
1055
+ end
1056
+ .,.,
1057
+
1058
+ module_eval <<'.,.,', 'parser.y', 27
1059
+ def _reduce_12( val, _values)
1060
+ val[1]
1061
+ end
1062
+ .,.,
1063
+
1064
+ module_eval <<'.,.,', 'parser.y', 33
1065
+ def _reduce_13( val, _values)
1066
+ t = Time.gm(val[3].to_i, val[2], val[1].to_i, 0, 0, 0)
1067
+ (t + val[4] - val[5]).localtime
1068
+ end
1069
+ .,.,
1070
+
1071
+ # reduce 14 omitted
1072
+
1073
+ # reduce 15 omitted
1074
+
1075
+ module_eval <<'.,.,', 'parser.y', 42
1076
+ def _reduce_16( val, _values)
1077
+ (val[0].to_i * 60 * 60) +
1078
+ (val[2].to_i * 60)
1079
+ end
1080
+ .,.,
1081
+
1082
+ module_eval <<'.,.,', 'parser.y', 47
1083
+ def _reduce_17( val, _values)
1084
+ (val[0].to_i * 60 * 60) +
1085
+ (val[2].to_i * 60) +
1086
+ (val[4].to_i)
1087
+ end
1088
+ .,.,
1089
+
1090
+ module_eval <<'.,.,', 'parser.y', 54
1091
+ def _reduce_18( val, _values)
1092
+ timezone_string_to_unixtime(val[0])
1093
+ end
1094
+ .,.,
1095
+
1096
+ module_eval <<'.,.,', 'parser.y', 59
1097
+ def _reduce_19( val, _values)
1098
+ val
1099
+ end
1100
+ .,.,
1101
+
1102
+ # reduce 20 omitted
1103
+
1104
+ module_eval <<'.,.,', 'parser.y', 65
1105
+ def _reduce_21( val, _values)
1106
+ val[1]
1107
+ end
1108
+ .,.,
1109
+
1110
+ # reduce 22 omitted
1111
+
1112
+ module_eval <<'.,.,', 'parser.y', 71
1113
+ def _reduce_23( val, _values)
1114
+ val[1]
1115
+ end
1116
+ .,.,
1117
+
1118
+ module_eval <<'.,.,', 'parser.y', 77
1119
+ def _reduce_24( val, _values)
1120
+ join_domain(val[0])
1121
+ end
1122
+ .,.,
1123
+
1124
+ module_eval <<'.,.,', 'parser.y', 81
1125
+ def _reduce_25( val, _values)
1126
+ join_domain(val[2])
1127
+ end
1128
+ .,.,
1129
+
1130
+ module_eval <<'.,.,', 'parser.y', 85
1131
+ def _reduce_26( val, _values)
1132
+ join_domain(val[0])
1133
+ end
1134
+ .,.,
1135
+
1136
+ # reduce 27 omitted
1137
+
1138
+ module_eval <<'.,.,', 'parser.y', 91
1139
+ def _reduce_28( val, _values)
1140
+ val[1]
1141
+ end
1142
+ .,.,
1143
+
1144
+ module_eval <<'.,.,', 'parser.y', 96
1145
+ def _reduce_29( val, _values)
1146
+ []
1147
+ end
1148
+ .,.,
1149
+
1150
+ module_eval <<'.,.,', 'parser.y', 100
1151
+ def _reduce_30( val, _values)
1152
+ val[0].push val[2]
1153
+ val[0]
1154
+ end
1155
+ .,.,
1156
+
1157
+ # reduce 31 omitted
1158
+
1159
+ module_eval <<'.,.,', 'parser.y', 107
1160
+ def _reduce_32( val, _values)
1161
+ val[1]
1162
+ end
1163
+ .,.,
1164
+
1165
+ module_eval <<'.,.,', 'parser.y', 111
1166
+ def _reduce_33( val, _values)
1167
+ val[1]
1168
+ end
1169
+ .,.,
1170
+
1171
+ # reduce 34 omitted
1172
+
1173
+ module_eval <<'.,.,', 'parser.y', 117
1174
+ def _reduce_35( val, _values)
1175
+ val[1]
1176
+ end
1177
+ .,.,
1178
+
1179
+ module_eval <<'.,.,', 'parser.y', 123
1180
+ def _reduce_36( val, _values)
1181
+ val[0].spec
1182
+ end
1183
+ .,.,
1184
+
1185
+ module_eval <<'.,.,', 'parser.y', 127
1186
+ def _reduce_37( val, _values)
1187
+ val[0].spec
1188
+ end
1189
+ .,.,
1190
+
1191
+ # reduce 38 omitted
1192
+
1193
+ module_eval <<'.,.,', 'parser.y', 134
1194
+ def _reduce_39( val, _values)
1195
+ val[1]
1196
+ end
1197
+ .,.,
1198
+
1199
+ # reduce 40 omitted
1200
+
1201
+ # reduce 41 omitted
1202
+
1203
+ # reduce 42 omitted
1204
+
1205
+ # reduce 43 omitted
1206
+
1207
+ # reduce 44 omitted
1208
+
1209
+ # reduce 45 omitted
1210
+
1211
+ # reduce 46 omitted
1212
+
1213
+ module_eval <<'.,.,', 'parser.y', 146
1214
+ def _reduce_47( val, _values)
1215
+ [ Address.new(nil, nil) ]
1216
+ end
1217
+ .,.,
1218
+
1219
+ module_eval <<'.,.,', 'parser.y', 148
1220
+ def _reduce_48( val, _values)
1221
+ val
1222
+ end
1223
+ .,.,
1224
+
1225
+ module_eval <<'.,.,', 'parser.y', 149
1226
+ def _reduce_49( val, _values)
1227
+ val[0].push val[2]; val[0]
1228
+ end
1229
+ .,.,
1230
+
1231
+ # reduce 50 omitted
1232
+
1233
+ # reduce 51 omitted
1234
+
1235
+ module_eval <<'.,.,', 'parser.y', 156
1236
+ def _reduce_52( val, _values)
1237
+ val
1238
+ end
1239
+ .,.,
1240
+
1241
+ module_eval <<'.,.,', 'parser.y', 160
1242
+ def _reduce_53( val, _values)
1243
+ val[0].push val[2]
1244
+ val[0]
1245
+ end
1246
+ .,.,
1247
+
1248
+ # reduce 54 omitted
1249
+
1250
+ # reduce 55 omitted
1251
+
1252
+ module_eval <<'.,.,', 'parser.y', 168
1253
+ def _reduce_56( val, _values)
1254
+ val[1].phrase = Decoder.decode(val[0])
1255
+ val[1]
1256
+ end
1257
+ .,.,
1258
+
1259
+ # reduce 57 omitted
1260
+
1261
+ module_eval <<'.,.,', 'parser.y', 176
1262
+ def _reduce_58( val, _values)
1263
+ AddressGroup.new(val[0], val[2])
1264
+ end
1265
+ .,.,
1266
+
1267
+ module_eval <<'.,.,', 'parser.y', 178
1268
+ def _reduce_59( val, _values)
1269
+ AddressGroup.new(val[0], [])
1270
+ end
1271
+ .,.,
1272
+
1273
+ module_eval <<'.,.,', 'parser.y', 181
1274
+ def _reduce_60( val, _values)
1275
+ val[0].join('.')
1276
+ end
1277
+ .,.,
1278
+
1279
+ module_eval <<'.,.,', 'parser.y', 182
1280
+ def _reduce_61( val, _values)
1281
+ val[0] << ' ' << val[1].join('.')
1282
+ end
1283
+ .,.,
1284
+
1285
+ module_eval <<'.,.,', 'parser.y', 186
1286
+ def _reduce_62( val, _values)
1287
+ val[2].routes.replace val[1]
1288
+ val[2]
1289
+ end
1290
+ .,.,
1291
+
1292
+ module_eval <<'.,.,', 'parser.y', 191
1293
+ def _reduce_63( val, _values)
1294
+ val[1]
1295
+ end
1296
+ .,.,
1297
+
1298
+ # reduce 64 omitted
1299
+
1300
+ module_eval <<'.,.,', 'parser.y', 196
1301
+ def _reduce_65( val, _values)
1302
+ [ val[1].join('.') ]
1303
+ end
1304
+ .,.,
1305
+
1306
+ module_eval <<'.,.,', 'parser.y', 197
1307
+ def _reduce_66( val, _values)
1308
+ val[0].push val[3].join('.'); val[0]
1309
+ end
1310
+ .,.,
1311
+
1312
+ module_eval <<'.,.,', 'parser.y', 199
1313
+ def _reduce_67( val, _values)
1314
+ Address.new( val[0], val[2] )
1315
+ end
1316
+ .,.,
1317
+
1318
+ module_eval <<'.,.,', 'parser.y', 200
1319
+ def _reduce_68( val, _values)
1320
+ Address.new( val[0], nil )
1321
+ end
1322
+ .,.,
1323
+
1324
+ # reduce 69 omitted
1325
+
1326
+ module_eval <<'.,.,', 'parser.y', 203
1327
+ def _reduce_70( val, _values)
1328
+ val[0].push ''; val[0]
1329
+ end
1330
+ .,.,
1331
+
1332
+ module_eval <<'.,.,', 'parser.y', 206
1333
+ def _reduce_71( val, _values)
1334
+ val
1335
+ end
1336
+ .,.,
1337
+
1338
+ module_eval <<'.,.,', 'parser.y', 209
1339
+ def _reduce_72( val, _values)
1340
+ val[1].times do
1341
+ val[0].push ''
1342
+ end
1343
+ val[0].push val[2]
1344
+ val[0]
1345
+ end
1346
+ .,.,
1347
+
1348
+ module_eval <<'.,.,', 'parser.y', 217
1349
+ def _reduce_73( val, _values)
1350
+ val
1351
+ end
1352
+ .,.,
1353
+
1354
+ module_eval <<'.,.,', 'parser.y', 220
1355
+ def _reduce_74( val, _values)
1356
+ val[1].times do
1357
+ val[0].push ''
1358
+ end
1359
+ val[0].push val[2]
1360
+ val[0]
1361
+ end
1362
+ .,.,
1363
+
1364
+ module_eval <<'.,.,', 'parser.y', 227
1365
+ def _reduce_75( val, _values)
1366
+ 0
1367
+ end
1368
+ .,.,
1369
+
1370
+ module_eval <<'.,.,', 'parser.y', 228
1371
+ def _reduce_76( val, _values)
1372
+ 1
1373
+ end
1374
+ .,.,
1375
+
1376
+ # reduce 77 omitted
1377
+
1378
+ # reduce 78 omitted
1379
+
1380
+ # reduce 79 omitted
1381
+
1382
+ # reduce 80 omitted
1383
+
1384
+ # reduce 81 omitted
1385
+
1386
+ # reduce 82 omitted
1387
+
1388
+ # reduce 83 omitted
1389
+
1390
+ # reduce 84 omitted
1391
+
1392
+ module_eval <<'.,.,', 'parser.y', 243
1393
+ def _reduce_85( val, _values)
1394
+ val[1] = val[1].spec
1395
+ val.join('')
1396
+ end
1397
+ .,.,
1398
+
1399
+ module_eval <<'.,.,', 'parser.y', 247
1400
+ def _reduce_86( val, _values)
1401
+ val
1402
+ end
1403
+ .,.,
1404
+
1405
+ module_eval <<'.,.,', 'parser.y', 248
1406
+ def _reduce_87( val, _values)
1407
+ val[0].push val[2]; val[0]
1408
+ end
1409
+ .,.,
1410
+
1411
+ # reduce 88 omitted
1412
+
1413
+ module_eval <<'.,.,', 'parser.y', 251
1414
+ def _reduce_89( val, _values)
1415
+ val[0] << ' ' << val[1]
1416
+ end
1417
+ .,.,
1418
+
1419
+ module_eval <<'.,.,', 'parser.y', 255
1420
+ def _reduce_90( val, _values)
1421
+ val.push nil
1422
+ val
1423
+ end
1424
+ .,.,
1425
+
1426
+ module_eval <<'.,.,', 'parser.y', 260
1427
+ def _reduce_91( val, _values)
1428
+ val
1429
+ end
1430
+ .,.,
1431
+
1432
+ module_eval <<'.,.,', 'parser.y', 265
1433
+ def _reduce_92( val, _values)
1434
+ [ val[0].to_i, val[2].to_i ]
1435
+ end
1436
+ .,.,
1437
+
1438
+ module_eval <<'.,.,', 'parser.y', 270
1439
+ def _reduce_93( val, _values)
1440
+ [ val[0].downcase, val[2].downcase, decode_params(val[3]) ]
1441
+ end
1442
+ .,.,
1443
+
1444
+ module_eval <<'.,.,', 'parser.y', 274
1445
+ def _reduce_94( val, _values)
1446
+ [ val[0].downcase, nil, decode_params(val[1]) ]
1447
+ end
1448
+ .,.,
1449
+
1450
+ module_eval <<'.,.,', 'parser.y', 279
1451
+ def _reduce_95( val, _values)
1452
+ {}
1453
+ end
1454
+ .,.,
1455
+
1456
+ module_eval <<'.,.,', 'parser.y', 283
1457
+ def _reduce_96( val, _values)
1458
+ val[0][ val[2].downcase ] = val[4]
1459
+ val[0]
1460
+ end
1461
+ .,.,
1462
+
1463
+ # reduce 97 omitted
1464
+
1465
+ # reduce 98 omitted
1466
+
1467
+ module_eval <<'.,.,', 'parser.y', 292
1468
+ def _reduce_99( val, _values)
1469
+ val[0].downcase
1470
+ end
1471
+ .,.,
1472
+
1473
+ module_eval <<'.,.,', 'parser.y', 297
1474
+ def _reduce_100( val, _values)
1475
+ [ val[0].downcase, decode_params(val[1]) ]
1476
+ end
1477
+ .,.,
1478
+
1479
+ # reduce 101 omitted
1480
+
1481
+ # reduce 102 omitted
1482
+
1483
+ # reduce 103 omitted
1484
+
1485
+ # reduce 104 omitted
1486
+
1487
+ # reduce 105 omitted
1488
+
1489
+ # reduce 106 omitted
1490
+
1491
+ # reduce 107 omitted
1492
+
1493
+ # reduce 108 omitted
1494
+
1495
+ # reduce 109 omitted
1496
+
1497
+ def _reduce_none( val, _values)
1498
+ val[0]
1499
+ end
1500
+
1501
+ end # class Parser
1502
+
1503
+ end # module TMail