
On 9/15/05, John Goerzen
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.
Well, you do have a state monad to work with. Why not just stuff the number 305 into your state, keep reading until you've read 305 bytes (decrementing the count as you read), and return the 305-byte string as your result for this parser? When you resume, you should be ready to parse the next very token after the 305-byte string. -- Adam