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