
Can anyone point me to a modern example or description of using Asio with Spirit to parse and asynchronous stream. I keep finding articles that say this can't be done, or at least not easily (but the comments date back to 2007). SGL

On 2013/6/30, at 4:32, "LeMay.Steve"
Can anyone point me to a modern example or description of using Asio with Spirit to parse and asynchronous stream. I keep finding articles that say this can't be done, or at least not easily (but the comments date back to 2007).
SGL _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
You can try coroutine. Here is an example of how to integrate coroutine with asio: http://www.boost.org/doc/libs/1_54_0/libs/coroutine/doc/html/coroutine/intro... Best Acer

2013/6/30 Yang Acer
On 2013/6/30, at 4:32, "LeMay.Steve"
wrote: Can anyone point me to a modern example or description of using Asio with Spirit to parse and asynchronous stream. I keep finding articles that say this can't be done, or at least not easily (but the comments date back to 2007).
SGL
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
You can try coroutine. Here is an example of how to integrate coroutine with asio:
http://www.boost.org/doc/libs/1_54_0/libs/coroutine/doc/html/coroutine/intro...
I don't know how spirit works internaly - the example above could be useful if spirit reads from a stream (usually parsers read pattern from a continuous stream of characters). The idea is that the stream_buff used by the stream runs in a coroutine and suspends the corutine-context if not enough characters are available (from socket, in buffer). Another possible solution would be using the async_result feature from boost.asio (1.54) - but this depends how spirit works.

On 2013/7/1, at 0:08, Oliver Kowalke
2013/6/30 Yang Acer
On 2013/6/30, at 4:32, "LeMay.Steve"
wrote: Can anyone point me to a modern example or description of using Asio with Spirit to parse and asynchronous stream. I keep finding articles that say this can't be done, or at least not easily (but the comments date back to 2007).
SGL _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
You can try coroutine. Here is an example of how to integrate coroutine with asio: http://www.boost.org/doc/libs/1_54_0/libs/coroutine/doc/html/coroutine/intro...
I don't know how spirit works internaly - the example above could be useful if spirit reads from a stream (usually parsers read pattern from a continuous stream of characters). The idea is that the stream_buff used by the stream runs in a coroutine and suspends the corutine-context if not enough characters are available (from socket, in buffer).
Another possible solution would be using the async_result feature from boost.asio (1.54) - but this depends how spirit works. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Spirit does support std::istream. See http://boost-spirit.com/home/2010/01/05/stream-based-parsing-made-easy/ Best Acer
participants (3)
-
LeMay.Steve
-
Oliver Kowalke
-
Yang Acer