title: fparsec rfc2822 parsing multiple header lines
body: <p>I'm trying to parse RFC 2822 using fparsec but I'm unable to deal with the headers with multiple lines:  (it gets confused with the next header):
  here's my best try: do you have any tips?</p>
  
  <pre><code>let str (s:string) = pstring s
  
  let stringLiteral =
      manySatisfy (fun c -&gt; c &lt;&gt; ':' &amp;&amp; c &lt;&gt; '\r' &amp;&amp; c &lt;&gt; '\n')
  
  let ws = many (pchar ' ')
  
  let keyValueSimple  =  stringLiteral .&gt;&gt;. (ws &gt;&gt;. str ":" &gt;&gt;. ws &gt;&gt;. stringLiteral) .&gt;&gt;. pchar '\n' |&gt;&gt; (fun (a,b) -&gt; a)
  
  let lineValue = ws &gt;&gt;. stringLiteral .&gt;&gt;. (pchar '\n' .&gt;&gt;. ( pchar '\t')) |&gt;&gt; ( fun (a,b) -&gt; a )
  
  let lastValue = ws &gt;&gt;. stringLiteral .&gt;&gt;. (pchar '\n' .&gt;&gt; notFollowedBy ( pchar '\t') ) |&gt;&gt; ( fun (a,b) -&gt; a )
  
  let keyValueComplex =  stringLiteral .&gt;&gt;. (ws &gt;&gt;. pchar ':') .&gt;&gt;. (many lineValue) .&gt;&gt;. lastValue |&gt;&gt; ( fun (((f),d),b) -&gt; (f,f) )                     
  
  let headers = many1 (keyValueComplex)
  
  let parse (fileName:string) = 
      test headers "Return-Path: &lt;ewrwe@werw.com&gt;\n\twerwe\nDelivered-To: adfasdf@aasdfas.afa.com\n "
  </code></pre>
  
  <p>I get expecting \t at 3,1: Delivered-To: adfasdf@aasdfas.afa.com</p>