update README and CHANGES to take error_handler and incomplete_handler into consideration

This commit is contained in:
alisdair sullivan 2013-03-04 23:49:01 -08:00
parent df04f091f7
commit c3e0bae38f
2 changed files with 15 additions and 0 deletions

View file

@ -2,6 +2,7 @@ v1.4
* radically refactored decoder
* `dirty_strings` now behaves intuitively in decoding. bad codepoints, bad utf8, illegal characters and escapes (except `"` and `'` if `single_quoted_strings` is enabled) are ignored completely
* `incomplete_handler` & `error_handler` are now available for use, see documentation in README
v1.3.3

View file

@ -301,6 +301,20 @@ jsx functions all take a common set of options. not all flags have meaning in al
relax is a synonym for `[replaced_bad_utf8, single_quoted_strings, comments, ignored_bad_escapes]` for when you don't care how janky and awful your json input is, you just want the parser to do the best it can
- `incomplete_handler` & `error_handler`
the default incomplete and error handlers can be replaced with user defined handlers. if options include `{error_handler, F}` and/or `{incomplete_handler, F}` where `F` is a function of arity 3 they will be called instead of the default handler. the spec for `F` is as follows
```erlang
F(Remaining, InternalState, Config) -> any()
Remaining = binary() | term()
InternalState = any()
Config = tuple()
```
`Remaining` is the binary fragment or term that caused the error
`InternalState` is an opaque structure containing the internal state of the parser/decoder/encoder
`Config` is a list of options/flags in use by the parser/decoder/encoder
## exports ##