Broken Analysis Using FParsec

Is it possible to enter input into the FParsec parser in chunks, like from a socket? If not, is it possible to get the current result and the inseparable part of the input stream so that I can accomplish this? I am trying to run pieces of input coming from SocketAsyncEventArgswithout buffering all messages.

Update

The reason to note the use SocketAsyncEventArgswas the designation that sending data in CharStreammay lead to asynchronous access to the base Stream. In particular, I am considering using a circular buffer to input data coming from a socket. I remember the FParsec documentation, which stated that the underlying Streamone should not be executed asynchronously, so I planned to manually manage exploded parsing.

Final questions:

  • Is it possible to use a circular buffer under mine Streampassed in CharStream?
  • Don't I really have to worry about how to manually manage the block in this scenario?
+5
source share
1 answer

The regular version of FParsec (but not the low-trust version ) reads an input block or "block-wise", as I call it in the CharStreamdocumentation . That way, if you build CharStreamfrom System.IO.Stream, and the content is large enough to span multiple blocks CharStream, you can start parsing before completely restoring the input.

, , CharStream ( ) , Read System.IO.Stream , . , , , CharStream , , .

: 42.

  • Stream, CharStream, . , , , CharStream, .

  • Stream , , , .

  • CharStream , , Stream .

  • - (.. ). , , , BlockingStream, , .

  • (, ), , .

+8
source

All Articles