1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/imap.rb (envelope): allow NIL.

* lib/net/imap.rb (body): ditto.
* lib/net/imap.rb (number): ditto.
* lib/net/imap.rb (ensure_nz_number): show a detailed error
message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2004-01-21 09:01:23 +00:00
parent 2cff4c0126
commit a2f60e923e
2 changed files with 60 additions and 32 deletions

View file

@ -1,3 +1,11 @@
Wed Jan 21 17:57:56 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (envelope): allow NIL.
* lib/net/imap.rb (body): ditto.
* lib/net/imap.rb (number): ditto.
* lib/net/imap.rb (ensure_nz_number): show a detailed error
message.
Wed Jan 21 16:44:15 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (merge_libs): squeeze successive same libraries.

View file

@ -1361,7 +1361,9 @@ module Net # :nodoc:
def ensure_nz_number(num)
if num < -1 || num == 0 || num >= 4294967296
raise DataFormatError, num.inspect
msg = "nz_number must be non-zero unsigned 32-bit integer: " +
num.inspect
raise DataFormatError, msg
end
end
end
@ -2006,30 +2008,37 @@ module Net # :nodoc:
def envelope
@lex_state = EXPR_DATA
match(T_LPAR)
date = nstring
match(T_SPACE)
subject = nstring
match(T_SPACE)
from = address_list
match(T_SPACE)
sender = address_list
match(T_SPACE)
reply_to = address_list
match(T_SPACE)
to = address_list
match(T_SPACE)
cc = address_list
match(T_SPACE)
bcc = address_list
match(T_SPACE)
in_reply_to = nstring
match(T_SPACE)
message_id = nstring
match(T_RPAR)
@lex_state = EXPR_BEG
return Envelope.new(date, subject, from, sender, reply_to,
to, cc, bcc, in_reply_to, message_id)
token = lookahead
if token.symbol == T_NIL
shift_token
result = nil
else
match(T_LPAR)
date = nstring
match(T_SPACE)
subject = nstring
match(T_SPACE)
from = address_list
match(T_SPACE)
sender = address_list
match(T_SPACE)
reply_to = address_list
match(T_SPACE)
to = address_list
match(T_SPACE)
cc = address_list
match(T_SPACE)
bcc = address_list
match(T_SPACE)
in_reply_to = nstring
match(T_SPACE)
message_id = nstring
match(T_RPAR)
result = Envelope.new(date, subject, from, sender, reply_to,
to, cc, bcc, in_reply_to, message_id)
end
@lex_state = EXPR_BEG
return result
end
def flags_data
@ -2082,14 +2091,20 @@ module Net # :nodoc:
def body
@lex_state = EXPR_DATA
match(T_LPAR)
token = lookahead
if token.symbol == T_LPAR
result = body_type_mpart
else
result = body_type_1part
end
match(T_RPAR)
if token.symbol == T_NIL
shift_token
result = nil
else
match(T_LPAR)
token = lookahead
if token.symbol == T_LPAR
result = body_type_mpart
else
result = body_type_1part
end
match(T_RPAR)
end
@lex_state = EXPR_BEG
return result
end
@ -2855,6 +2870,11 @@ module Net # :nodoc:
end
def number
token = lookahead
if token.symbol == T_NIL
shift_token
return nil
end
token = match(T_NUMBER)
return token.value.to_i
end