[pre-SRFI] JSON Amirouche Boubekki (01 Jan 2020 14:04 UTC)
Re: [pre-SRFI] JSON Amirouche Boubekki (01 Jan 2020 21:11 UTC)
Re: [pre-SRFI] JSON Lassi Kortela (02 Jan 2020 10:46 UTC)
Re: [pre-SRFI] JSON Amirouche Boubekki (02 Jan 2020 12:07 UTC)
Re: [pre-SRFI] JSON Duy Nguyen (02 Jan 2020 09:13 UTC)
Re: [pre-SRFI] JSON Lassi Kortela (02 Jan 2020 10:03 UTC)
Re: [pre-SRFI] JSON Amirouche Boubekki (02 Jan 2020 12:23 UTC)
Re: [pre-SRFI] JSON Amirouche Boubekki (02 Jan 2020 22:05 UTC)
Re: [pre-SRFI] JSON Duy Nguyen (06 Jan 2020 01:20 UTC)

Re: [pre-SRFI] JSON Amirouche Boubekki 01 Jan 2020 21:10 UTC

Le mer. 1 janv. 2020 à 14:03, Amirouche Boubekki
<xxxxxx@gmail.com> a écrit :
> The stream parser is not coded yet.

Done.

I was under the impression that it would be much easier to implement
custom json->scm on top of the stream reader. But that is not the
case.

ref: https://github.com/amirouche/SRFI-JSON/blob/master/src/json.scm#L294-L377

The (json-parse callback port) procedure will produce events. For
instance the following JSON:

[true, false, [42], false]

Will produce:

(json-structure array-open)
(json-value #t)
(json-value #f)
(json-structure array-open)
(json-value 42)
(json-structure array-close)
(json-value #f)
(json-structure array-close)

The problem that I tried to solve, that is really fun, is to not rely
on the stack to parse any JSON.  That allows the following tests to
pass:

  n_structure_100000_opening_arrays.json

  i_structure_500_nested_arrays.json

The first with a n prefix, will not segfault (or whatever) and the
second just works even if it is unspecified.

--
Amirouche ~ https://hyper.dev