minor change to guards on the fun returned when incomplete input detected

This commit is contained in:
alisdair sullivan 2011-08-12 06:34:45 -07:00
parent 9bf7554a35
commit 588c836547
2 changed files with 25 additions and 19 deletions

View file

@ -55,13 +55,13 @@ encoder(Opts) ->
emit([], {State, Rest, T, Args}) ->
erlang:apply(?MODULE, State, [Rest, T] ++ Args);
emit([incomplete], {State, Rest, T, Args}) ->
{jsx, incomplete, fun(end_stream) ->
{error, {badjson, []}}
; (Stream) ->
{jsx, incomplete, fun(Stream)
when is_binary(Stream) ->
erlang:apply(?MODULE,
State,
[Rest ++ Stream, T] ++ Args
)
; (Else) -> {error, {badjson, Else}}
end};
emit([Event|Events], {_State, _Rest, iterate, _Args} = Next) ->
{jsx, Event, fun() -> emit(Events, Next) end};