is_json/2 and format/2 now both accept either a json text (binary) or a function that acts as a jsx iterator. specs updated to reflect

This commit is contained in:
alisdair sullivan 2011-07-04 19:25:09 -07:00
parent e088c6fd26
commit 0052480652
3 changed files with 38 additions and 32 deletions

View file

@ -35,12 +35,12 @@
-type jsx_opt() :: {escaped_unicode, ascii | codepoint | none}
| {multi_term, true | false}
| {encoding, auto
| utf8
| utf16
| {utf16, little}
| utf32
| {utf32, little}
}.
| utf8
| utf16
| {utf16, little}
| utf32
| {utf32, little}
}.
%% events emitted by the parser and component types
@ -60,16 +60,26 @@
| {literal, false}
| {literal, null}.
-type jsx_iterator() :: jsx_decoder() | jsx_encoder().
%% this probably doesn't work properly
-type jsx_decoder() :: fun((binary()) -> jsx_decoder_result()).
-type jsx_decoder() :: fun((binary()) -> jsx_iterator_result()).
-type jsx_decoder_result() ::
{event, jsx_event(), fun(() -> jsx_decoder_result())}
| {incomplete, jsx_decoder()}
-type jsx_encoder() :: fun((list(jsx_event())) -> jsx_iterator_result()).
-type jsx_iterator_result() ::
{event, jsx_event(), fun(() -> jsx_iterator_result())}
| {incomplete, jsx_iterator()}
| {error, {badjson, binary()}}.
-type supported_utf() :: utf8
| utf16
| {utf16, little}