]> git.notmuchmail.org Git - notmuch/commit
emacs: Implement an incremental JSON parser
authorAustin Clements <amdragon@MIT.EDU>
Mon, 9 Jul 2012 21:42:40 +0000 (17:42 -0400)
committerDavid Bremner <bremner@debian.org>
Thu, 12 Jul 2012 23:39:28 +0000 (17:39 -0600)
commit889dda3731dcdf779cef347576c5d59d1923d26b
treed6f3e22454592867593e72f3338f9b42d26bae41
parentf94a50d80af8c2a5513e58db954dd0b1910eb4a8
emacs: Implement an incremental JSON parser

This parser is designed to read streaming JSON whose structure is
known to the caller.  Like a typical JSON parsing interface, it
provides a function to read a complete JSON value from the input.
However, it extends this with an additional function that
requires the next value in the input to be a compound value and
descends into it, allowing its elements to be read one at a time
or further descended into.  Both functions can return 'retry to
indicate that not enough input is available.

The parser supports efficient partial parsing, so there's no need to
frame the input for correctness or performance.

The bulk of the parsing is still done by Emacs' json.el, so any
improvements or optimizations to that will benefit the incremental
parser as well.

Currently only descending into JSON lists is supported because that's
all we need, but support for descending into JSON objects can be added
in the future.
emacs/notmuch-lib.el