Subject: Re: [boost] Json read...segment by segment
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2015-07-06 05:06:04


On 06.07.2015 10:55, Bjorn Reese wrote:
> On 07/06/2015 09:55 AM, Sebastian Redl wrote:
>
>> The PropertyTree parser is not a streaming parser, it builds a tree out
>> of the entire contents of a file. This cannot be changed. I also don't
>> know of any DOM parser for any semi-structured language that supports
>> this; I wouldn't know how to do this in a useful way.
>
> I am working on a streaming JSON parser [1] (documentation is still
> missing though.) One of the examples [2] is a reimplementation of
> property_tree::read_json(). It currently parses the entire content,
> but only because it mimics the original behavior. It could be rewritten
> to build the property_tree incrementally.
I just replaced the internal parser of PropertyTree (the old one was a
Spirit.Classic parser) with a hand-written streaming parser (push, while
yours appears to be pull) too. It's on the develop branch. The real
problem is a sensible way to mark a tree as partial. Who wants to work
with such a structure? In such cases, I'm pretty sure it would be
simpler to use the streaming interface directly.

Sebastian