Boost logo

Boost Users :

Subject: Re: [Boost-users] Asio and Spirit
From: Yang Acer (yangacer_at_[hidden])
Date: 2013-06-30 12:18:46


On 2013/7/1, at 0:08, Oliver Kowalke <oliver.kowalke_at_[hidden]> wrote:

>
> 2013/6/30 Yang Acer <yangacer_at_[hidden]>
>> On 2013/6/30, at 4:32, "LeMay.Steve" <Steve.Lemay_at_[hidden]> 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_at_[hidden]
>>> 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.html
>
> 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_at_[hidden]
> 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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net