Permalink
Browse files

Version 1.1.0 commit. Also added treeetop rake task to generate .tree…

…top files
  • Loading branch information...
1 parent 5a60c8c commit ed01949c1f7e5b7014e8c759047589a396961d22 @mikel committed Nov 3, 2009
Showing with 150 additions and 0 deletions.
  1. +7 −0 CHANGELOG.rdoc
  2. +133 −0 lib/mail/parsers/content_location.rb
  3. +10 −0 lib/tasks/treetop.rake
View
@@ -1,5 +1,6 @@
== Tue Nov 3 00:59:45 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
+* Tested mail against entire Enron set (2.3gb) and the Trec 2005 set (0.5gb), ~ half a million emails without crashing
* Some headers only can appear once, enforce during header parse assignment. <jlindley>
* Convert empty bodies into empty arrays instead of nil. <jlindley>
* Handle blank content dispositions. <jlindley>
@@ -8,6 +9,12 @@
* Added handling of multi value parameters, like filename*1*="us-ascii'en'blah" filename*2="bleh" <mikel>
* Added dependency on ActiveSupport 2.3 or higher <mikel>
+== Sun Nov 1 12:00:00 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
+
+* handle OpenSSL::SSL::VERIFY_NONE returning 0 <jlindley>
+* doing Mail.new { content_type [text, plain, { charset => UTF-8 }] } is now
+ possible (content type accepts an array) <mikel>
+
== Sat Oct 31 11:00:41 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
* Fixed attachment handling, so mail can find attachment from a content-type,
@@ -0,0 +1,133 @@
+# Autogenerated from a Treetop grammar. Edits may be lost.
+
+
+module Mail
+ module ContentLocation
+ include Treetop::Runtime
+
+ def root
+ @root || :primary
+ end
+
+ include RFC2822
+
+ include RFC2045
+
+ module Primary0
+ def CFWS1
+ elements[0]
+ end
+
+ def location
+ elements[1]
+ end
+
+ def CFWS2
+ elements[2]
+ end
+ end
+
+ def _nt_primary
+ start_index = index
+ if node_cache[:primary].has_key?(index)
+ cached = node_cache[:primary][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0, s0 = index, []
+ r1 = _nt_CFWS
+ s0 << r1
+ if r1
+ r2 = _nt_location
+ s0 << r2
+ if r2
+ r3 = _nt_CFWS
+ s0 << r3
+ end
+ end
+ if s0.last
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
+ r0.extend(Primary0)
+ else
+ @index = i0
+ r0 = nil
+ end
+
+ node_cache[:primary][start_index] = r0
+
+ r0
+ end
+
+ module Location0
+ def text_value
+ quoted_content.text_value
+ end
+ end
+
+ def _nt_location
+ start_index = index
+ if node_cache[:location].has_key?(index)
+ cached = node_cache[:location][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ r1 = _nt_quoted_string
+ r1.extend(Location0)
+ if r1
+ r0 = r1
+ else
+ s2, i2 = [], index
+ loop do
+ i3 = index
+ r4 = _nt_token
+ if r4
+ r3 = r4
+ else
+ if has_terminal?('\G[\\x3d]', true, index)
+ r5 = true
+ @index += 1
+ else
+ r5 = nil
+ end
+ if r5
+ r3 = r5
+ else
+ @index = i3
+ r3 = nil
+ end
+ end
+ if r3
+ s2 << r3
+ else
+ break
+ end
+ end
+ if s2.empty?
+ @index = i2
+ r2 = nil
+ else
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
+ end
+ if r2
+ r0 = r2
+ else
+ @index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:location][start_index] = r0
+
+ r0
+ end
+
+ end
+
+ class ContentLocationParser < Treetop::Runtime::CompiledParser
+ include ContentLocation
+ end
+
+end
View
@@ -0,0 +1,10 @@
+namespace :treetop do
+
+ desc "Pre-generate all the .treetop files into .rb files"
+ task :generate do
+ Dir[File.join(File.dirname(__FILE__), '..', 'mail', 'parsers', '*.treetop')].each do |filename|
+ `tt #{filename}`
+ end
+ end
+
+end

0 comments on commit ed01949

Please sign in to comment.