[haiku-development] Re: JSON Streaming Parser (Part 2)

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: Haiku Development ML <haiku-development@xxxxxxxxxxxxx>
  • Date: Fri, 12 May 2017 15:51:21 -0400

A quick glance over it -- looks OK. Adding documentation to docs/user (the
Haiku Book) does make the most sense (and should be mostly self-explanatory
on how to do that). There also seem to be some unrelated changes in the
patch (to the repositories files?) but otherwise it looks OK.

On Fri, May 12, 2017 at 2:35 AM, Andrew Lindesay <apl@xxxxxxxxxxxxxx> wrote:

Hello;

I've worked through re-factoring the JSON streaming changes.  I've gone
through a couple of different approaches and I think this makes the most
sense.

I believe that I have fixed the code-style issues that Axel raised;
thank you for the out-of-band explanation on the function ordering.

The flex parser is now replaced with a hand-written one.  I fear it
won't be as fast, but the integration is certainly much much tidier than
with the flex generated one.  I think the hand-written one is, in
balance, worthwhile.

The hand-written parser could probably benefit from a "BDataIO"-ish
in-memory buffer, but that can come later on.  Some unit tests are there
to provide a level of safety for any future changes.

JsonTypes.h is merged into the JsonEvent.h now because the flex material
is gone.  It makes more sense here as the event model can be used
separate from the parse logic -- for streaming out.

Sorry; I can't see the sense in writing to the BMessageBuilder as I want
the events to fire into something that is JSON parse specific.  The JSON
parse events are more constrained than BMessage and so it is my opinion
that the JSON-specific SAX-style listener approach with a direct write
to a BMessage (see BJsonMessageWriter) is a better approach.

I have also written some documentation in the form of a Markdown file in
the "/docs/...".  I see there is all sorts of documentation in there.
Is that the best way to do this?

Please see an updated patch here;

http://linfamsha-public.s3.amazonaws.com/haiku-json-work-12may2017.diff.gz

Regards;

--
Andrew Lindesay


Other related posts: