On 2005-09-15, Peter Simons <[EMAIL PROTECTED]> wrote:
> The approach I recommend is to run a scanner (tokenizer)
> before the actual parser.
>
> IMAP, like most other RFC protocols, is line-based; so you
> can use a very simple scanner to read a CRLF-terminated line
> efficiently (using non-blocking I/O, for example), which you
> can then feed into the parser just fine because you know
> that it has to contain a complete request (response) that
> you can handle.

I thought of that, but that isn't really true for IMAP.  IMAP responses
can span many, many lines (for instance, it can return a list of all
matching messages in a folder, or multiple bits of status results).

Or they can use only one line.

Not only that, but IMAP has a way where you can embed, say {305} instead
of a string.  That means, "after you finish reading this line, read
exactly 305 bytes, and consider that to be used here."  But if you see
"{305}" (the double quotes indicating a string), this is just a string
containing the text {305}.

So, to make that approach work, I would really need to do a lot of work
outside of Parsec -- the stuff that I really want to use Parsec for, I
think.

-- John


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to