Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/paulwittmann/mail into paul…
Browse files Browse the repository at this point in the history
…wittmann-master
  • Loading branch information
Mikel Lindsaar committed Nov 17, 2012
2 parents cc25e65 + c9c66aa commit 2057c2f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
34 changes: 15 additions & 19 deletions lib/mail/parsers/rfc2822.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1337,22 +1337,18 @@ def _nt_local_dot_atom_text
s0, i0 = [], index s0, i0 = [], index
loop do loop do
i1, s1 = index, [] i1, s1 = index, []
s2, i2 = [], index if has_terminal?(".", false, index)
loop do r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
if has_terminal?(".", false, index) @index += 1
r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) else
@index += 1 terminal_parse_failure(".")
else r3 = nil
terminal_parse_failure(".") end
r3 = nil if r3
end r2 = r3
if r3 else
s2 << r3 r2 = instantiate_node(SyntaxNode,input, index...index)
else
break
end
end end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
s1 << r2 s1 << r2
if r2 if r2
r4 = _nt_domain_text r4 = _nt_domain_text
Expand Down Expand Up @@ -2714,11 +2710,11 @@ def _nt_mailbox_list
s3, i3 = [], index s3, i3 = [], index
loop do loop do
i4, s4 = index, [] i4, s4 = index, []
if has_terminal?(",", false, index) if has_terminal?(";", false, index)
r5 = instantiate_node(SyntaxNode,input, index...(index + 1)) r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1 @index += 1
else else
terminal_parse_failure(",") terminal_parse_failure(";")
r5 = nil r5 = nil
end end
s4 << r5 s4 << r5
Expand Down Expand Up @@ -2915,11 +2911,11 @@ def _nt_address_list
r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
s4 << r5 s4 << r5
if r5 if r5
if has_terminal?(",", false, index) if has_terminal?(";", false, index)
r7 = instantiate_node(SyntaxNode,input, index...(index + 1)) r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1 @index += 1
else else
terminal_parse_failure(",") terminal_parse_failure(";")
r7 = nil r7 = nil
end end
s4 << r7 s4 << r7
Expand Down
4 changes: 2 additions & 2 deletions lib/mail/parsers/rfc2822.treetop
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ module Mail
end end


rule mailbox_list rule mailbox_list
(first_addr:mailbox other_addr:("," addr_value:mailbox)*) / obs_mbox_list (first_addr:mailbox other_addr:(("," / ";") addr_value:mailbox)*) / obs_mbox_list
end end


rule mailbox rule mailbox
Expand Down Expand Up @@ -265,7 +265,7 @@ module Mail
end end


rule address_list rule address_list
first_addr:address? other_addr:(FWS* "," FWS* addr_value:address?)* first_addr:address? other_addr:(FWS* ("," / ";") FWS* addr_value:address?)*
end end


rule date_time rule date_time
Expand Down
5 changes: 5 additions & 0 deletions spec/mail/parsers/address_lists_parser_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@
a = Mail::AddressListsParser.new a = Mail::AddressListsParser.new
a.parse(text).should_not be_nil a.parse(text).should_not be_nil
end end
it "should parse an address list separated by semicolons" do
text = 'Mikel Lindsaar <test@lindsaar.net>; Friends: test2@lindsaar.net; Ada <test3@lindsaar.net>;'
a = Mail::AddressListsParser.new
a.parse(text).should_not be_nil
end
end end

0 comments on commit 2057c2f

Please sign in to comment.