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> Wed Jan 21 16:44:15 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (merge_libs): squeeze successive same libraries. * lib/mkmf.rb (merge_libs): squeeze successive same libraries.

View file

@ -1361,7 +1361,9 @@ module Net # :nodoc:
def ensure_nz_number(num) def ensure_nz_number(num)
if num < -1 || num == 0 || num >= 4294967296 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 end
end end
@ -2006,6 +2008,11 @@ module Net # :nodoc:
def envelope def envelope
@lex_state = EXPR_DATA @lex_state = EXPR_DATA
token = lookahead
if token.symbol == T_NIL
shift_token
result = nil
else
match(T_LPAR) match(T_LPAR)
date = nstring date = nstring
match(T_SPACE) match(T_SPACE)
@ -2027,10 +2034,12 @@ module Net # :nodoc:
match(T_SPACE) match(T_SPACE)
message_id = nstring message_id = nstring
match(T_RPAR) match(T_RPAR)
@lex_state = EXPR_BEG result = Envelope.new(date, subject, from, sender, reply_to,
return Envelope.new(date, subject, from, sender, reply_to,
to, cc, bcc, in_reply_to, message_id) to, cc, bcc, in_reply_to, message_id)
end end
@lex_state = EXPR_BEG
return result
end
def flags_data def flags_data
token = match(T_ATOM) token = match(T_ATOM)
@ -2082,6 +2091,11 @@ module Net # :nodoc:
def body def body
@lex_state = EXPR_DATA @lex_state = EXPR_DATA
token = lookahead
if token.symbol == T_NIL
shift_token
result = nil
else
match(T_LPAR) match(T_LPAR)
token = lookahead token = lookahead
if token.symbol == T_LPAR if token.symbol == T_LPAR
@ -2090,6 +2104,7 @@ module Net # :nodoc:
result = body_type_1part result = body_type_1part
end end
match(T_RPAR) match(T_RPAR)
end
@lex_state = EXPR_BEG @lex_state = EXPR_BEG
return result return result
end end
@ -2855,6 +2870,11 @@ module Net # :nodoc:
end end
def number def number
token = lookahead
if token.symbol == T_NIL
shift_token
return nil
end
token = match(T_NUMBER) token = match(T_NUMBER)
return token.value.to_i return token.value.to_i
end end