Commit graph

212 commits

Author SHA1 Message Date
alisdair sullivan
72c92bae0d add experimental consult/1,2 function that consults a file
containing zero or more json terms and returns them in a list
2015-01-25 21:44:15 -08:00
alisdair sullivan
8592742ded rework decoder and encoder slightly to be a little more sane 2014-12-11 06:57:49 +00:00
alisdair sullivan
e2ba87f1cb switch to a counting implementation of number parsing a la strings 2014-12-09 02:20:01 -08:00
alisdair sullivan
e5e04db58e produce binaries in escaped strings in decoder/parser instead of lists 2014-12-09 02:19:13 -08:00
alisdair sullivan
1033245da3 binary_to_whatever is not available on R15? fixed 2014-12-09 05:12:33 +00:00
alisdair sullivan
c39515bd60 early exit from value when encountering literals and less list allocation
for number parsing
2014-12-09 01:46:57 +00:00
alisdair sullivan
34771087ff switch to iodata accumulation for number parsing 2014-12-08 04:05:03 +00:00
alisdair sullivan
4b3fa9b903 further unrolling of string parsing states and elimination of when
guards
2014-12-07 19:12:43 -08:00
alisdair sullivan
8e2d7a0253 decoder clause reordering and unrolling to reduce when clauses 2014-12-07 16:31:29 -08:00
alisdair sullivan
a9982687c6 certain astral plane json escape sequences were inadvertently being
replaced with the replacement character
2014-12-07 15:30:37 -08:00
alisdair sullivan
8a4f92d8e6 skip redundant check for uescape escaping 2014-12-07 14:27:39 -08:00
alisdair sullivan
eed34483e4 allow control codes in json passed to the decoder
a malicious actor can introduce the same codepoints via \uXXXX
escapes and they are not dangerous in erlang binaries regardless
2014-12-03 23:11:40 -08:00
alisdair sullivan
edee5931a4 perform uescape escaping in the decoder (for json -> whatever
transformation)`
2014-12-03 23:02:02 -08:00
alisdair sullivan
dc8e6a0c54 switch string parsing to a count and slice implementation 2014-12-03 22:54:44 -08:00
alisdair sullivan
9528216d15 allow unicode noncharacters and reserved space characters in json
strings

fixes #67
2014-12-01 19:43:07 +00:00
alisdair sullivan
6b43609730 allow a single trailing comma in objects or arrays 2014-08-19 17:47:44 -07:00
alisdair sullivan
c25bb49902 use end_json to end streaming when in streaming mode in addition
to `end_stream`
2014-08-13 23:00:35 -07:00
alisdair sullivan
e1599574ff properly export config type 2014-02-10 06:39:15 +00:00
alisdair sullivan
1049d69f3e remove dead code
(thanks to dialyzer for the assist)
2014-02-10 04:06:13 +00:00
alisdair sullivan
3bb65e9bab Merge branch 'develop' into vtwopointoh 2013-12-17 02:03:21 +00:00
Michael Truog
30b136ce72 Fix dialyzer errors. 2013-11-22 19:22:01 -08:00
alisdair sullivan
4d7c1c5c18 Merge remote-tracking branch 'origin/develop' into develop 2013-10-29 19:49:46 +00:00
alisdair sullivan
d06b64e4bd replace incorrect boolean shortcircuits in multibyte escaping 2013-10-29 19:44:28 +00:00
alisdair sullivan
1909687aff fix format of incomplete tests in jsx_decoder 2013-10-21 06:25:45 +00:00
alisdair sullivan
f6ebd9a1c4 remove inconsistent custom error_handler' and incomplete_handler'
tests pending reimplementation
2013-10-21 06:22:49 +00:00
alisdair sullivan
96f76b6178 further refactoring of test suite 2013-10-21 05:46:53 +00:00
alisdair sullivan
4f08d5355f fix bug where escape characters were getting dropped when operating
under `dirty_strings'
2013-10-20 21:20:55 +00:00
alisdair sullivan
486fda2a74 refactor test suite for additional completeness and clarity 2013-10-20 21:06:51 +00:00
alisdair sullivan
f340e8dc22 refactor options to complete mission: more pragmatism 2013-10-20 03:28:22 +00:00
alisdair sullivan
99484ce4f2 minor refactor of jsx_decoder 2013-10-20 03:23:38 +00:00
alisdair sullivan
a83fa3598d comments allowed by default. pragmatism 1 literalists 0 2013-10-20 03:20:36 +00:00
alisdair sullivan
f137ff484b fix bad utf8 encodings by default (convert to u+FFFD)
this (temporarily, i hope) removes the fast path for handling
strings internally without escaping or replacing bad utf8
2013-10-20 03:16:56 +00:00
alisdair sullivan
e4a401a3a6 incomplete input now results in an error when parsing json or jsx
internal form

streaming decoding is now only available when forced with the
`stream` option and no longer returns until forced to via the
token `end_stream`. this api is still subject to being replaced
with an even more explicit streaming mode
2013-10-20 03:10:18 +00:00
alisdair sullivan
6797bf3ed7 rename explicit_end to stream in prep for behavior change 2013-10-20 03:10:09 +00:00
Ola Backstrom
2943116c08 Added typespecs on all exported functions
Made sure all exported types do have a typespec is useful in build scenarios
where the erlang compile options
[warnings_as_errors, warn_missing_spec]
are used.

A few type errors found by Dialyzer are corrected too.

	modified:   src/jsx.erl
	modified:   src/jsx_config.erl
	modified:   src/jsx_config.hrl
	modified:   src/jsx_decoder.erl
	modified:   src/jsx_parser.erl
	modified:   src/jsx_to_json.erl
	modified:   src/jsx_to_term.erl
	modified:   src/jsx_verify.erl
2013-09-19 17:04:38 +02:00
alisdair sullivan
0bbe56c700 check for incomplete valid input before checking for malformed utf8 2013-08-27 05:02:37 +00:00
alisdair sullivan
af11b97879 undo `optimized' ordering of string parsing clauses in decoder 2013-08-27 04:09:10 +00:00
alisdair sullivan
0441224998 update license dates 2013-03-10 20:30:24 -07:00
alisdair sullivan
7f7d824116 fix edge case involving dirty_strings 2013-03-10 20:26:46 -07:00
alisdair sullivan
96ca5d4d63 coding style 2013-03-10 19:58:13 -07:00
alisdair sullivan
5e54bb3458 perf enhancements in string 2013-03-10 19:54:43 -07:00
alisdair sullivan
1747f28377 whitespace 2013-03-10 19:49:46 -07:00
alisdair sullivan
1bb7c46120 simplify handling of dirty strings 2013-03-10 19:49:06 -07:00
alisdair sullivan
a34b567ae4 add test for escaped strings and dirty strings interaction 2013-03-10 19:10:23 -07:00
alisdair sullivan
8cf3a9d144 breakout initialdecimal state to improve binary matching 2013-03-10 19:02:20 -07:00
alisdair sullivan
30108f5872 inline singlequote and doublequote and move them in match order 2013-03-10 18:15:55 -07:00
alisdair sullivan
56153d76da Merge branch 'moarclean' into develop 2013-03-10 18:05:39 -07:00
alisdair sullivan
9475ac5dd9 fix binary optimization hurdles 2013-03-10 18:05:18 -07:00
alisdair sullivan
06a289c975 begin breaking out complex states to substates 2013-03-10 17:34:50 -07:00
alisdair sullivan
1190d6cf34 shuffle some string clauses for slightly better performance 2013-03-06 23:34:46 -08:00