shithub: mc

Download patch

ref: e3a9307d99e1a2936e63b6ffa5d80a5929d4b549
parent: 2edc2786c55409339a666cd0dc41e21099017d24
parent: 673032b9d80278ccd16b5152c98cfd252e083bdb
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Feb 8 19:20:20 EST 2017

Merge libjson

--- a/lib/bld.sub
+++ b/lib/bld.sub
@@ -1,13 +1,14 @@
 sub =
 	bio
-	date
 	crypto
+	date
 	escfmt
-	inifile
 	fileutil
+	inifile
+	json
 	regex
 	std
 	sys
-	thread
 	testr
+	thread
 ;;
--- /dev/null
+++ b/lib/json/bld.sub
@@ -1,0 +1,9 @@
+lib json =
+	types.myr
+	parse.myr
+	fmt.myr
+
+        lib ../sys:sys
+        lib ../std:std
+;;
+
--- /dev/null
+++ b/lib/json/fmt.myr
@@ -1,0 +1,86 @@
+use std
+
+use "types"
+
+pkg json =
+;;
+
+const __init__ = {
+	var j : elt
+
+	std.fmtinstall(std.typeof(&j), jsonfmt, [][:])
+}
+
+const jsonfmt = {sb, ap, opts
+	var e : elt#
+
+	e = std.vanext(ap)
+	eltfmt(sb, e, 0)
+}
+
+const eltfmt = {sb, e, ind
+	match e
+	| &(`Null):	std.sbfmt(sb, "null")
+	| &(`Bool b):	std.sbfmt(sb, "{}", b)
+	| &(`Num n):	std.sbfmt(sb, "{}", n)
+	| &(`Str s):	jstrfmt(sb, s)
+	| &(`Arr a):	arrfmt(sb, a, ind)
+	| &(`Obj o):	objfmt(sb, o, ind)
+	;;
+}
+
+
+const jstrfmt = {sb, str
+	std.sbputs(sb, "\"")
+	for c in str
+		match (c : char)
+		| '\x0c':	std.sbputs(sb, "\\f")
+		| '\\':	std.sbputs(sb, "\\\\")
+		| '\n': std.sbputs(sb, "\\n")
+		| '\r':	std.sbputs(sb, "\\r")
+		| '\t': std.sbputs(sb, "\\t")
+		| _:	std.sbputb(sb, c)
+		;;
+	;;
+	std.sbputs(sb, "\"")
+}
+
+const arrfmt = {sb, arr, ind
+	var sep
+
+	sep = ""
+	std.sbputs(sb, "[\n")
+	for e in arr
+		std.sbputs(sb, sep)
+		indent(sb, ind + 1)
+		eltfmt(sb, e, ind + 1)
+		sep = ",\n"
+	;;
+	std.sbputs(sb, "\n")
+	indent(sb, ind)
+	std.sbputs(sb, "]")
+}
+
+const objfmt = {sb, obj, ind
+	var sep
+
+	sep = ""
+	std.sbputs(sb, "{\n")
+	for (k, v) in obj
+		std.sbputs(sb, sep)
+		indent(sb, ind + 1)
+		jstrfmt(sb, k)
+		std.sbputs(sb, ": ")
+		eltfmt(sb, v, ind + 1)
+		sep = ",\n"
+	;;
+	std.sbputs(sb, "\n")
+	indent(sb, ind)
+	std.sbputs(sb, "}")
+}
+
+const indent = {sb, ind
+	for var i = 0; i < ind; i++
+		std.sbputc(sb, '\t')
+	;;
+}
--- /dev/null
+++ b/lib/json/j.myr
@@ -1,0 +1,18 @@
+use std
+use json
+
+const main = {args : byte[:][:]
+	var data
+
+	for arg in args[1:]
+		data = std.try(std.slurp(arg))
+		match json.parse(data)
+		| `std.Ok j:
+			std.put("{}\n", j)
+			json.free(j)
+		| `std.Err e:
+			std.put("{}\n", e)
+		;;
+		std.slfree(data)
+	;;
+}
--- /dev/null
+++ b/lib/json/parse.myr
@@ -1,0 +1,401 @@
+use std
+
+use "types"
+
+pkg json =
+	const parse	: (str : byte[:] -> std.result(elt#, err))
+	const free	: (j : elt# -> void)
+;;
+
+const Maxdepth = 1024
+
+type parser = struct
+	str	: byte[:]
+	depth	: std.size
+	line	: std.size
+	off	: std.size
+	idx	: std.size
+;;
+
+const parse = {str
+	var parser : parser
+
+	parser = [
+		.str = str,
+		.depth = 0,
+		.line = 1,
+		.off = 1,
+		.idx = 0,
+	]
+	match parseelt(&parser)
+	| `std.Ok j:
+		takespace(&parser)
+		if parser.idx != parser.str.len
+			free(j)
+			-> `std.Err [
+				.e=`Junk std.decode(parser.str[parser.idx:]),
+				.line=parser.line,
+				.off=parser.off
+			]
+		;;
+		-> `std.Ok j
+	| `std.Err e:
+		-> `std.Err e
+	;;
+}
+
+const free = {j
+	match j
+	| &(`Null):	/* nothing */
+	| &(`Bool _):	/* nothing */
+	| &(`Num _):	/* nothing */
+	| &(`Str s):	std.slfree(s)
+	| &(`Arr a):
+		for e in a
+			free(e)
+		;;
+	| &(`Obj o):
+		for (k, v) in o
+			std.slfree(k)
+			free(v)
+		;;
+	;;
+}
+
+const parseelt = {p
+	takespace(p)
+	match peekc(p)
+	| '{':	-> parseobj(p)
+	| '[':	-> parsearr(p)
+	| '"':	-> parsestr(p)
+	| chr:
+		if matchprefix(p, "false")
+			-> `std.Ok std.mk(`Bool false)
+		elif matchprefix(p, "true")
+			-> `std.Ok std.mk(`Bool true)
+		elif matchprefix(p, "null")
+			-> `std.Ok std.mk(`Null)
+		elif std.isdigit(peekc(p)) || peekc(p) == '-'
+			match parsenum(p)
+			| `std.Some n:	-> `std.Ok std.mk(`Num n)
+			| `std.None:	-> `std.Err [.e=`Junk chr, .line=p.line, .off=p.off]
+			;;
+		else
+			-> `std.Err [.e=`Junk chr, .line=p.line, .off=p.off]
+		;;
+	;;
+}
+
+const parseobj = {p
+	var membs
+	var err
+
+	std.assert(takec(p) == '{', "should only enter 'obj' after '{'")
+	membs = [][:]
+	if !enter(p)
+		err = [.e = `Depth, .line=p.line, .off=p.off]
+		goto error
+	;;
+	takespace(p)
+	if peekc(p) == '}'
+		takec(p)
+		-> `std.Ok std.mk(`Obj membs)
+	;;
+	while peekc(p) != '}'
+		match member(p)
+		| `std.Ok m:
+			std.slpush(&membs, m)
+			takespace(p)
+			match takec(p)
+			| ',':	/* nothing */
+			| '}':	break
+			| std.Badchar:
+				err = [.e=`End,  .line=p.line, .off=p.off]
+				goto error
+			| chr:
+				err = [.e=`Junk chr, .line=p.line, .off=p.off]
+				goto error
+			;;
+		| `std.Err e:
+			err = e
+			goto error
+		;;
+	;;
+	exit(p)
+	-> `std.Ok std.mk(`Obj membs)
+:error
+	for (k, v) in membs
+		std.slfree(k)
+		free(v)
+	;;
+	std.slfree(membs)
+	exit(p)
+	-> `std.Err err
+}
+
+const member = {p
+	var str
+
+	takespace(p)
+	match jsonstr(p)
+	| `std.Ok s:	str = s
+	| `std.Err e:	-> `std.Err e
+	;;
+
+	takespace(p)
+	match takec(p)
+	| ':':	/* nothing */
+	| chr:	-> `std.Err [.e=`Junk chr, .line=p.line, .off=p.off]
+	;;
+
+	takespace(p)
+	match parseelt(p)
+	| `std.Ok elt:
+		-> `std.Ok (str, elt)
+	| `std.Err e:
+		std.slfree(str)
+		-> `std.Err e
+	;;
+}
+
+const parsearr = {p -> std.result(elt#, err)
+	var elts
+	var err
+
+	std.assert(takec(p) == '[', "should only enter 'obj' after '['\n")
+	elts = [][:]
+	if !enter(p)
+		err = [.e = `Depth, .line=p.line, .off=p.off]
+		goto error
+	;;
+	takespace(p)
+	if peekc(p) == ']'
+		takec(p)
+		-> `std.Ok std.mk(`Arr elts)
+	;;
+	while true
+		match parseelt(p)
+		| `std.Ok e:
+			std.slpush(&elts, e)
+		| `std.Err e:
+			err = e
+			goto error
+		;;
+		takespace(p)
+		match takec(p)
+		| ',':	/* nothing */
+		| ']':	break
+		| std.Badchar:
+			err = [.e=`End,  .line=p.line, .off=p.off]
+			goto error
+		| chr:
+			err = [.e=`Junk chr, .line=p.line, .off=p.off]
+			goto error
+		;;
+	;;
+	exit(p)
+	-> `std.Ok std.mk(`Arr elts)
+:error
+	for e in elts
+		free(e)
+	;;
+	std.slfree(elts)
+	exit(p)
+	-> `std.Err err
+}
+
+const parsestr = {p
+	match jsonstr(p)
+	| `std.Ok str:	-> `std.Ok std.mk(`Str str)
+	| `std.Err e:	-> `std.Err e
+	;;
+}
+
+const parsenum = {p
+	var start
+	var ok
+
+	start = p.idx
+	if peekc(p) == '-'
+		p.idx++
+	;;
+	if peekc(p) == '0'
+		p.idx++
+	else
+		ok = false
+		while p.idx < p.str.len
+			if !std.isdigit((p.str[p.idx] : char))
+				break
+			;;
+			ok = true
+			p.idx++
+		;;
+		if !ok
+			-> `std.None
+		;;
+	;;
+
+	if peekc(p) == '.'
+		ok = false
+		p.idx++
+		while p.idx < p.str.len
+			if !std.isdigit((p.str[p.idx] : char))
+				break
+			;;
+			ok = true
+			p.idx++
+		;;
+		if !ok
+			-> `std.None
+		;;
+	;;
+	if peekc(p) == 'e' || peekc(p) == 'E'
+		p.idx++
+		ok = false
+		if peekc(p) == '+' || peekc(p) == '-'
+			p.idx++
+		;;
+		while p.idx < p.str.len
+			if !std.isdigit((p.str[p.idx] : char))
+				break
+			;;
+			ok = true
+			p.idx++
+		;;
+		if !ok
+			-> `std.None
+		;;
+	;;
+
+	-> std.flt64parse(p.str[start:p.idx])
+}
+
+const jsonstr = {p
+	var sb, idx, err
+
+	sb = std.mksb()
+	match takec(p)
+	| '"':	/* nothing */
+	| chr:
+		err = [.e=`Junk chr, .line=p.line, .off=p.off]
+		goto error
+	;;
+	while p.idx < p.str.len
+		match takec(p)
+		| '\\':
+			match takec(p)
+			| '"':	std.sbputc(sb, '"')
+			| '\\':	std.sbputc(sb, '\\')
+			| '/':	std.sbputc(sb, '/')
+			| 'b':	std.sbputc(sb, '\b')
+			| 'n':	std.sbputc(sb, '\n')
+			| 'f':	std.sbputc(sb, '\u{0c}')
+			| 'r':	std.sbputc(sb, '\r')
+			| 't':	std.sbputc(sb, '\t')
+			| 'u':	
+				match unichar(p)
+				| `std.Some c: std.sbputc(sb, c)
+				| `std.None:
+					err = [.e=`Badesc 'u', .line=p.line, .off=p.off]
+					goto error
+				;;
+			| chr:
+				err = [.e=`Badesc chr, .line=p.line, .off=p.off]
+				goto error
+			;;
+		| '"':
+			-> `std.Ok std.sbfin(sb)
+		| std.Badchar:
+			err = [.e=`Junk std.Badchar, .line=p.line, .off=p.off]
+			goto error
+		| chr:
+			if !unescaped(chr)
+				err = [.e=`Junk chr, .line=p.line, .off=p.off]
+				goto error
+			;;
+			std.sbputc(sb, chr)
+			idx += std.charlen(chr)
+		;;
+	;;
+	err = [.e=`End, .line=p.line, .off=p.off]
+
+:error
+	std.sbfree(sb)
+	-> `std.Err err
+}
+
+const unichar = {p
+	var c, i
+
+	c = 0
+	/* must be exactly 4 hex digits */
+	for i = 0; i < 4; i++
+		match std.charval(takec(p), 16)
+		| -1:	-> `std.None
+		| n:	c += n*16
+		;;
+	;;
+	if i == 0
+		-> `std.None
+	;;
+	-> `std.Some c
+}
+
+const matchprefix = {p, pfx
+	if std.hasprefix(p.str[p.idx:], pfx)
+		p.idx += pfx.len
+		-> true
+	;;
+	-> false
+}
+
+const unescaped = {c
+	-> c == 0x20 || c == 0x21 || \
+		(c >= 0x23 && c < 0x5b) || \
+		(c > 0x5d && c <= 0x10ffff)
+}
+
+const takespace = {p
+	while p.idx < p.str.len
+		match (p.str[p.idx] : char)
+		| ' ':
+		| '\t':
+		| '\r':
+		| '\n':
+			p.line++
+			p.off=1
+		| _:
+			break
+		;;
+		p.idx++
+	;;
+}
+
+const peekc = {p
+	-> std.decode(p.str[p.idx:])
+}
+
+const takec = {p
+	var c
+
+	if p.idx == p.str.len
+		-> std.Badchar
+	;;
+	c = std.decode(p.str[p.idx:])
+	p.idx += std.charlen(c)
+	p.off++
+	if c == '\n'
+		p.line++
+		p.off = 1
+	;;
+	-> c
+}
+
+const enter = {p
+	p.depth++
+	-> p.depth <= Maxdepth
+}
+
+const exit = {p
+	p.depth--
+}
--- /dev/null
+++ b/lib/json/test/inputs/LICENSE
@@ -1,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Nicolas Seriot
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+++ b/lib/json/test/inputs/_n_string_UTF8_surrogate_U+D800.json
@@ -1,0 +1,1 @@
+[""]
\ No newline at end of file
binary files /dev/null b/lib/json/test/inputs/_y_string_utf16.json differ
--- /dev/null
+++ b/lib/json/test/inputs/i_number_neg_int_huge_exp.json
@@ -1,0 +1,1 @@
+[-1e+9999]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_number_pos_double_huge_exp.json
@@ -1,0 +1,1 @@
+[1.5e+9999]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_object_key_lone_2nd_surrogate.json
@@ -1,0 +1,1 @@
+{"\uDFAA":0}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_1st_surrogate_but_2nd_missing.json
@@ -1,0 +1,1 @@
+["\uDADA"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_1st_valid_surrogate_2nd_invalid.json
@@ -1,0 +1,1 @@
+["\uD888\u1234"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_UTF-16_invalid_lonely_surrogate.json
@@ -1,0 +1,1 @@
+["\ud800"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_UTF-16_invalid_surrogate.json
@@ -1,0 +1,1 @@
+["\ud800abc"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_UTF-8_invalid_sequence.json
@@ -1,0 +1,1 @@
+["日ш
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_incomplete_surrogate_and_escape_valid.json
@@ -1,0 +1,1 @@
+["\uD800\n"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_incomplete_surrogate_pair.json
@@ -1,0 +1,1 @@
+["\uDd1ea"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_incomplete_surrogates_escape_valid.json
@@ -1,0 +1,1 @@
+["\uD800\uD800\n"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_inverted_surrogates_U+1D11E.json
@@ -1,0 +1,1 @@
+["\uDd1e\uD834"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_lone_second_surrogate.json
@@ -1,0 +1,1 @@
+["\uDFAA"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_not_in_unicode_range.json
@@ -1,0 +1,1 @@
+["����"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_truncated-utf-8.json
@@ -1,0 +1,1 @@
+["�
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_unicode_U+10FFFE_nonchar.json
@@ -1,0 +1,1 @@
+["\uDBFF\uDFFE"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_unicode_U+1FFFE_nonchar.json
@@ -1,0 +1,1 @@
+["\uD83F\uDFFE"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_unicode_U+FDD0_nonchar.json
@@ -1,0 +1,1 @@
+["\uFDD0"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_string_unicode_U+FFFE_nonchar.json
@@ -1,0 +1,1 @@
+["\uFFFE"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/i_structure_500_nested_arrays.json
@@ -1,0 +1,1 @@
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[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/n_array_1_true_without_comma.json
@@ -1,0 +1,1 @@
+[1 true]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_a_invalid_utf8.json
@@ -1,0 +1,1 @@
+[a
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_colon_instead_of_comma.json
@@ -1,0 +1,1 @@
+["": 1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_comma_after_close.json
@@ -1,0 +1,1 @@
+[""],
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_comma_and_number.json
@@ -1,0 +1,1 @@
+[,1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_double_comma.json
@@ -1,0 +1,1 @@
+[1,,2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_double_extra_comma.json
@@ -1,0 +1,1 @@
+["x",,]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_extra_close.json
@@ -1,0 +1,1 @@
+["x"]]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_extra_comma.json
@@ -1,0 +1,1 @@
+["",]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_incomplete.json
@@ -1,0 +1,1 @@
+["x"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_incomplete_invalid_value.json
@@ -1,0 +1,1 @@
+[x
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_inner_array_no_comma.json
@@ -1,0 +1,1 @@
+[3[4]]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_invalid_utf8.json
@@ -1,0 +1,1 @@
+[
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_items_separated_by_semicolon.json
@@ -1,0 +1,1 @@
+[1:2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_just_comma.json
@@ -1,0 +1,1 @@
+[,]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_just_minus.json
@@ -1,0 +1,1 @@
+[-]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_missing_value.json
@@ -1,0 +1,1 @@
+[   , ""]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_newlines_unclosed.json
@@ -1,0 +1,3 @@
+["a",
+4
+,1,
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_number_and_comma.json
@@ -1,0 +1,1 @@
+[1,]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_number_and_several_commas.json
@@ -1,0 +1,1 @@
+[1,,]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_spaces_vertical_tab_formfeed.json
@@ -1,0 +1,1 @@
+["a"\f]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_star_inside.json
@@ -1,0 +1,1 @@
+[*]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_unclosed.json
@@ -1,0 +1,1 @@
+[""
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_unclosed_trailing_comma.json
@@ -1,0 +1,1 @@
+[1,
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_unclosed_with_new_lines.json
@@ -1,0 +1,3 @@
+[1,
+1
+,1
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_array_unclosed_with_object_inside.json
@@ -1,0 +1,1 @@
+[{}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_incomplete_false.json
@@ -1,0 +1,1 @@
+[fals]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_incomplete_null.json
@@ -1,0 +1,1 @@
+[nul]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_incomplete_true.json
@@ -1,0 +1,1 @@
+[tru]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_++.json
@@ -1,0 +1,1 @@
+[++1234]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_+1.json
@@ -1,0 +1,1 @@
+[+1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_+Inf.json
@@ -1,0 +1,1 @@
+[+Inf]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_-01.json
@@ -1,0 +1,1 @@
+[-01]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_-1.0..json
@@ -1,0 +1,1 @@
+[-1.0.]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_-2..json
@@ -1,0 +1,1 @@
+[-2.]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_-NaN.json
@@ -1,0 +1,1 @@
+[-NaN]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_.-1.json
@@ -1,0 +1,1 @@
+[.-1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_.2e-3.json
@@ -1,0 +1,1 @@
+[.2e-3]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0.1.2.json
@@ -1,0 +1,1 @@
+[0.1.2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0.3e+.json
@@ -1,0 +1,1 @@
+[0.3e+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0.3e.json
@@ -1,0 +1,1 @@
+[0.3e]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0.e1.json
@@ -1,0 +1,1 @@
+[0.e1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0_capital_E+.json
@@ -1,0 +1,1 @@
+[0E+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0_capital_E.json
@@ -1,0 +1,1 @@
+[0E]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0e+.json
@@ -1,0 +1,1 @@
+[0e+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_0e.json
@@ -1,0 +1,1 @@
+[0e]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_1.0e+.json
@@ -1,0 +1,1 @@
+[1.0e+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_1.0e-.json
@@ -1,0 +1,1 @@
+[1.0e-]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_1.0e.json
@@ -1,0 +1,1 @@
+[1.0e]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_1_000.json
@@ -1,0 +1,1 @@
+[1 000.0]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_1eE2.json
@@ -1,0 +1,1 @@
+[1eE2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_2.e+3.json
@@ -1,0 +1,1 @@
+[2.e+3]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_2.e-3.json
@@ -1,0 +1,1 @@
+[2.e-3]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_2.e3.json
@@ -1,0 +1,1 @@
+[2.e3]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_9.e+.json
@@ -1,0 +1,1 @@
+[9.e+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_Inf.json
@@ -1,0 +1,1 @@
+[Inf]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_NaN.json
@@ -1,0 +1,1 @@
+[NaN]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_U+FF11_fullwidth_digit_one.json
@@ -1,0 +1,1 @@
+[1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_expression.json
@@ -1,0 +1,1 @@
+[1+2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_hex_1_digit.json
@@ -1,0 +1,1 @@
+[0x1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_hex_2_digits.json
@@ -1,0 +1,1 @@
+[0x42]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_infinity.json
@@ -1,0 +1,1 @@
+[Infinity]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_invalid+-.json
@@ -1,0 +1,1 @@
+[0e+-1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_invalid-negative-real.json
@@ -1,0 +1,1 @@
+[-123.123foo]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_invalid-utf-8-in-bigger-int.json
@@ -1,0 +1,1 @@
+[123
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_invalid-utf-8-in-exponent.json
@@ -1,0 +1,1 @@
+[1e1
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_invalid-utf-8-in-int.json
@@ -1,0 +1,1 @@
+[0�]
--- /dev/null
+++ b/lib/json/test/inputs/n_number_minus_infinity.json
@@ -1,0 +1,1 @@
+[-Infinity]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_minus_sign_with_trailing_garbage.json
@@ -1,0 +1,1 @@
+[-foo]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_minus_space_1.json
@@ -1,0 +1,1 @@
+[- 1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_neg_int_starting_with_zero.json
@@ -1,0 +1,1 @@
+[-012]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_neg_real_without_int_part.json
@@ -1,0 +1,1 @@
+[-.123]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_neg_with_garbage_at_end.json
@@ -1,0 +1,1 @@
+[-1x]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_real_garbage_after_e.json
@@ -1,0 +1,1 @@
+[1ea]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_real_with_invalid_utf8_after_e.json
@@ -1,0 +1,1 @@
+[1e
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_real_without_fractional_part.json
@@ -1,0 +1,1 @@
+[1.]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_starting_with_dot.json
@@ -1,0 +1,1 @@
+[.123]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_then_00.json
@@ -1,0 +1,1 @@
+1
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_with_alpha.json
@@ -1,0 +1,1 @@
+[1.2a-3]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_with_alpha_char.json
@@ -1,0 +1,1 @@
+[1.8011670033376514H-308]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_number_with_leading_zero.json
@@ -1,0 +1,1 @@
+[012]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_bad_value.json
@@ -1,0 +1,1 @@
+["x", truth]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_bracket_key.json
@@ -1,0 +1,1 @@
+{[: "x"}
--- /dev/null
+++ b/lib/json/test/inputs/n_object_comma_instead_of_colon.json
@@ -1,0 +1,1 @@
+{"x", null}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_double_colon.json
@@ -1,0 +1,1 @@
+{"x"::"b"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_emoji.json
@@ -1,0 +1,1 @@
+{🇨🇭}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_garbage_at_end.json
@@ -1,0 +1,1 @@
+{"a":"a" 123}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_key_with_single_quotes.json
@@ -1,0 +1,1 @@
+{key: 'value'}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_missing_colon.json
@@ -1,0 +1,1 @@
+{"a" b}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_missing_key.json
@@ -1,0 +1,1 @@
+{:"b"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_missing_semicolon.json
@@ -1,0 +1,1 @@
+{"a" "b"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_missing_value.json
@@ -1,0 +1,1 @@
+{"a":
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_no-colon.json
@@ -1,0 +1,1 @@
+{"a"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_non_string_key.json
@@ -1,0 +1,1 @@
+{1:1}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_non_string_key_but_huge_number_instead.json
@@ -1,0 +1,1 @@
+{9999E9999:1}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_pi_in_key_and_trailing_comma.json
@@ -1,0 +1,1 @@
+{"�":"0",}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_repeated_null_null.json
@@ -1,0 +1,1 @@
+{null:null,null:null}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_several_trailing_commas.json
@@ -1,0 +1,1 @@
+{"id":0,,,,,}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_single_quote.json
@@ -1,0 +1,1 @@
+{'a':0}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_trailing_comma.json
@@ -1,0 +1,1 @@
+{"id":0,}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_trailing_comment.json
@@ -1,0 +1,1 @@
+{"a":"b"}/**/
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_trailing_comment_open.json
@@ -1,0 +1,1 @@
+{"a":"b"}/**//
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_trailing_comment_slash_open.json
@@ -1,0 +1,1 @@
+{"a":"b"}//
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_trailing_comment_slash_open_incomplete.json
@@ -1,0 +1,1 @@
+{"a":"b"}/
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_two_commas_in_a_row.json
@@ -1,0 +1,1 @@
+{"a":"b",,"c":"d"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_unquoted_key.json
@@ -1,0 +1,1 @@
+{a: "b"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_unterminated-value.json
@@ -1,0 +1,1 @@
+{"a":"a
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_with_single_string.json
@@ -1,0 +1,1 @@
+{ "foo" : "bar", "a" }
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_object_with_trailing_garbage.json
@@ -1,0 +1,1 @@
+{"a":"b"}#
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_single_space.json
@@ -1,0 +1,1 @@
+ 
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_1_surrogate_then_escape u.json
@@ -1,0 +1,1 @@
+["\uD800\u"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_1_surrogate_then_escape u1.json
@@ -1,0 +1,1 @@
+["\uD800\u1"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_1_surrogate_then_escape u1x.json
@@ -1,0 +1,1 @@
+["\uD800\u1x"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_1_surrogate_then_escape.json
@@ -1,0 +1,1 @@
+["\uD800\"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_UTF-16_incomplete_surrogate.json
@@ -1,0 +1,1 @@
+["\uD834\uDd"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_accentuated_char_no_quotes.json
@@ -1,0 +1,1 @@
+[é]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_backslash_00.json
@@ -1,0 +1,1 @@
+["\
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_escape_x.json
@@ -1,0 +1,1 @@
+["\x00"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_escaped_backslash_bad.json
@@ -1,0 +1,1 @@
+["\\\"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_escaped_ctrl_char_tab.json
@@ -1,0 +1,1 @@
+["\	"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_escaped_emoji.json
@@ -1,0 +1,1 @@
+["\🌀"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_incomplete_escape.json
@@ -1,0 +1,1 @@
+["\"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_incomplete_escaped_character.json
@@ -1,0 +1,1 @@
+["\u00A"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_incomplete_surrogate_escape_invalid.json
@@ -1,0 +1,1 @@
+["\uD800\uD800\x"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_invalid-utf-8-in-escape.json
@@ -1,0 +1,1 @@
+["\u�"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_invalid_backslash_esc.json
@@ -1,0 +1,1 @@
+["\a"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_invalid_unicode_escape.json
@@ -1,0 +1,1 @@
+["\uqqqq"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_invalid_utf-8.json
@@ -1,0 +1,1 @@
+["
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_invalid_utf8_after_escape.json
@@ -1,0 +1,1 @@
+["\�"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_iso_latin_1.json
@@ -1,0 +1,1 @@
+["�"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_leading_uescaped_thinspace.json
@@ -1,0 +1,1 @@
+[\u0020"asd"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_lone_utf8_continuation_byte.json
@@ -1,0 +1,1 @@
+["�"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_no_quotes_with_bad_escape.json
@@ -1,0 +1,1 @@
+[\n]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_overlong_sequence_2_bytes.json
@@ -1,0 +1,1 @@
+["��"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_overlong_sequence_6_bytes.json
@@ -1,0 +1,1 @@
+["������"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_overlong_sequence_6_bytes_null.json
@@ -1,0 +1,1 @@
+["������"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_single_doublequote.json
@@ -1,0 +1,1 @@
+"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_single_quote.json
@@ -1,0 +1,1 @@
+['single quote']
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_single_string_no_double_quotes.json
@@ -1,0 +1,1 @@
+abc
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_start_escape_unclosed.json
@@ -1,0 +1,1 @@
+["\
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_unescaped_crtl_char.json
@@ -1,0 +1,1 @@
+["a
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_unescaped_newline.json
@@ -1,0 +1,2 @@
+["new
+line"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_unescaped_tab.json
@@ -1,0 +1,1 @@
+["	"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_unicode_CapitalU.json
@@ -1,0 +1,1 @@
+"\UA66D"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_string_with_trailing_garbage.json
@@ -1,0 +1,1 @@
+""x
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_100000_opening_arrays.json
@@ -1,0 +1,1 @@
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[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[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_<.>.json
@@ -1,0 +1,1 @@
+<.>
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_<null>.json
@@ -1,0 +1,1 @@
+[<null>]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_U+2060_word_joined.json
@@ -1,0 +1,1 @@
+[⁠]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_UTF8_BOM_no_data.json
@@ -1,0 +1,1 @@
+
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_array_trailing_garbage.json
@@ -1,0 +1,1 @@
+[1]x
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_array_with_extra_array_close.json
@@ -1,0 +1,1 @@
+[1]]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_array_with_unclosed_string.json
@@ -1,0 +1,1 @@
+["asd]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_ascii-unicode-identifier.json
@@ -1,0 +1,1 @@
+aå
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_capitalized_True.json
@@ -1,0 +1,1 @@
+[True]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_close_unopened_array.json
@@ -1,0 +1,1 @@
+1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_comma_instead_of_closing_brace.json
@@ -1,0 +1,1 @@
+{"x": true,
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_double_array.json
@@ -1,0 +1,1 @@
+[][]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_end_array.json
@@ -1,0 +1,1 @@
+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_incomplete_UTF8_BOM.json
@@ -1,0 +1,1 @@
+��{}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_lone-invalid-utf-8.json
@@ -1,0 +1,1 @@
+
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_lone-open-bracket.json
@@ -1,0 +1,1 @@
+[
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_null-byte-outside-string.json
@@ -1,0 +1,1 @@
+[
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_number_with_trailing_garbage.json
@@ -1,0 +1,1 @@
+2@
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_object_followed_by_closing_object.json
@@ -1,0 +1,1 @@
+{}}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_object_unclosed_no_value.json
@@ -1,0 +1,1 @@
+{"":
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_object_with_comment.json
@@ -1,0 +1,1 @@
+{"a":/*comment*/"b"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_object_with_trailing_garbage.json
@@ -1,0 +1,1 @@
+{"a": true} "x"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_array_apostrophe.json
@@ -1,0 +1,1 @@
+['
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_array_comma.json
@@ -1,0 +1,1 @@
+[,
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_array_object.json
@@ -1,0 +1,1 @@
+[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":[{"":
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_array_open_object.json
@@ -1,0 +1,1 @@
+[{
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_array_open_string.json
@@ -1,0 +1,1 @@
+["a
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_array_string.json
@@ -1,0 +1,1 @@
+["a"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_object.json
@@ -1,0 +1,1 @@
+{
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_object_close_array.json
@@ -1,0 +1,1 @@
+{]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_object_comma.json
@@ -1,0 +1,1 @@
+{,
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_object_open_array.json
@@ -1,0 +1,1 @@
+{[
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_object_open_string.json
@@ -1,0 +1,1 @@
+{"a
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_object_string_with_apostrophes.json
@@ -1,0 +1,1 @@
+{'a'
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_open_open.json
@@ -1,0 +1,1 @@
+["\{["\{["\{["\{
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_single_point.json
@@ -1,0 +1,1 @@
+
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_single_star.json
@@ -1,0 +1,1 @@
+*
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_trailing_#.json
@@ -1,0 +1,1 @@
+{"a":"b"}#{}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_uescaped_LF_before_string.json
@@ -1,0 +1,1 @@
+[\u000A""]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_unclosed_array.json
@@ -1,0 +1,1 @@
+[1
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_unclosed_array_partial_null.json
@@ -1,0 +1,1 @@
+[ false, nul
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_unclosed_array_unfinished_false.json
@@ -1,0 +1,1 @@
+[ true, fals
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_unclosed_array_unfinished_true.json
@@ -1,0 +1,1 @@
+[ false, tru
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_unclosed_object.json
@@ -1,0 +1,1 @@
+{"asd":"asd"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_unicode-identifier.json
@@ -1,0 +1,1 @@
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_whitespace_U+2060_word_joiner.json
@@ -1,0 +1,1 @@
+[⁠]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/n_structure_whitespace_formfeed.json
@@ -1,0 +1,1 @@
+[]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_arraysWithSpaces.json
@@ -1,0 +1,1 @@
+[[]   ]
--- /dev/null
+++ b/lib/json/test/inputs/y_array_empty-string.json
@@ -1,0 +1,1 @@
+[""]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_empty.json
@@ -1,0 +1,1 @@
+[]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_ending_with_newline.json
@@ -1,0 +1,1 @@
+["a"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_false.json
@@ -1,0 +1,1 @@
+[false]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_heterogeneous.json
@@ -1,0 +1,1 @@
+[null, 1, "1", {}]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_null.json
@@ -1,0 +1,1 @@
+[null]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_with_1_and_newline.json
@@ -1,0 +1,2 @@
+[1
+]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_with_leading_space.json
@@ -1,0 +1,1 @@
+ [1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_with_several_null.json
@@ -1,0 +1,1 @@
+[1,null,null,null,2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_array_with_trailing_space.json
@@ -1,0 +1,1 @@
+[2] 
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number.json
@@ -1,0 +1,1 @@
+[123e65]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_0e+1.json
@@ -1,0 +1,1 @@
+[0e+1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_0e1.json
@@ -1,0 +1,1 @@
+[0e1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_after_space.json
@@ -1,0 +1,1 @@
+[ 4]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_double_close_to_zero.json
@@ -1,0 +1,1 @@
+[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001]
--- /dev/null
+++ b/lib/json/test/inputs/y_number_double_huge_neg_exp.json
@@ -1,0 +1,1 @@
+[123.456e-789]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_huge_exp.json
@@ -1,0 +1,1 @@
+[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_int_with_exp.json
@@ -1,0 +1,1 @@
+[20e1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_minus_zero.json
@@ -1,0 +1,1 @@
+[-0]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_negative_int.json
@@ -1,0 +1,1 @@
+[-123]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_negative_one.json
@@ -1,0 +1,1 @@
+[-1]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_negative_zero.json
@@ -1,0 +1,1 @@
+[-0]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_capital_e.json
@@ -1,0 +1,1 @@
+[1E22]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_capital_e_neg_exp.json
@@ -1,0 +1,1 @@
+[1E-2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_capital_e_pos_exp.json
@@ -1,0 +1,1 @@
+[1E+2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_exponent.json
@@ -1,0 +1,1 @@
+[123e45]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_fraction_exponent.json
@@ -1,0 +1,1 @@
+[123.456e78]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_neg_exp.json
@@ -1,0 +1,1 @@
+[1e-2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_neg_overflow.json
@@ -1,0 +1,1 @@
+[-123123e100000]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_pos_exponent.json
@@ -1,0 +1,1 @@
+[1e+2]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_pos_overflow.json
@@ -1,0 +1,1 @@
+[123123e100000]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_real_underflow.json
@@ -1,0 +1,1 @@
+[123e-10000000]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_simple_int.json
@@ -1,0 +1,1 @@
+[123]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_simple_real.json
@@ -1,0 +1,1 @@
+[123.456789]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_too_big_neg_int.json
@@ -1,0 +1,1 @@
+[-123123123123123123123123123123]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_too_big_pos_int.json
@@ -1,0 +1,1 @@
+[100000000000000000000]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_number_very_big_negative_int.json
@@ -1,0 +1,1 @@
+[-237462374673276894279832749832423479823246327846]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object.json
@@ -1,0 +1,1 @@
+{"asd":"sdf", "dfg":"fgh"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_basic.json
@@ -1,0 +1,1 @@
+{"asd":"sdf"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_duplicated_key.json
@@ -1,0 +1,1 @@
+{"a":"b","a":"c"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_duplicated_key_and_value.json
@@ -1,0 +1,1 @@
+{"a":"b","a":"b"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_empty.json
@@ -1,0 +1,1 @@
+{}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_empty_key.json
@@ -1,0 +1,1 @@
+{"":0}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_escaped_null_in_key.json
@@ -1,0 +1,1 @@
+{"foo\u0000bar": 42}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_extreme_numbers.json
@@ -1,0 +1,1 @@
+{ "min": -1.0e+28, "max": 1.0e+28 }
--- /dev/null
+++ b/lib/json/test/inputs/y_object_long_strings.json
@@ -1,0 +1,1 @@
+{"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_simple.json
@@ -1,0 +1,1 @@
+{"a":[]}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_string_unicode.json
@@ -1,0 +1,1 @@
+{"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" }
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_object_with_newlines.json
@@ -1,0 +1,3 @@
+{
+"a": "b"
+}
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_1_2_3_bytes_UTF-8_sequences.json
@@ -1,0 +1,1 @@
+["\u0060\u012a\u12AB"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_UTF-16_Surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json
@@ -1,0 +1,1 @@
+["\uD834\uDd1e"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_accepted_surrogate_pair.json
@@ -1,0 +1,1 @@
+["\uD801\udc37"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_accepted_surrogate_pairs.json
@@ -1,0 +1,1 @@
+["\ud83d\ude39\ud83d\udc8d"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_allowed_escapes.json
@@ -1,0 +1,1 @@
+["\"\\\/\b\f\n\r\t"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_backslash_and_u_escaped_zero.json
@@ -1,0 +1,1 @@
+["\\u0000"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_backslash_doublequotes.json
@@ -1,0 +1,1 @@
+["\""]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_comments.json
@@ -1,0 +1,1 @@
+["a/*b*/c/*d//e"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_double_escape_a.json
@@ -1,0 +1,1 @@
+["\\a"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_double_escape_n.json
@@ -1,0 +1,1 @@
+["\\n"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_escaped_control_character.json
@@ -1,0 +1,1 @@
+["\u0012"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_escaped_noncharacter.json
@@ -1,0 +1,1 @@
+["\uFFFF"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_in_array.json
@@ -1,0 +1,1 @@
+["asd"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_in_array_with_leading_space.json
@@ -1,0 +1,1 @@
+[ "asd"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_last_surrogates_1_and_2.json
@@ -1,0 +1,1 @@
+["\uDBFF\uDFFF"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_newline_uescaped.json
@@ -1,0 +1,1 @@
+["new\u00A0line"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_nonCharacterInUTF-8_U+10FFFF.json
@@ -1,0 +1,1 @@
+["􏿿"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_nonCharacterInUTF-8_U+1FFFF.json
@@ -1,0 +1,1 @@
+["𛿿"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_nonCharacterInUTF-8_U+FFFF.json
@@ -1,0 +1,1 @@
+["￿"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_null_escape.json
@@ -1,0 +1,1 @@
+["\u0000"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_one-byte-utf-8.json
@@ -1,0 +1,1 @@
+["\u002c"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_pi.json
@@ -1,0 +1,1 @@
+["π"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_simple_ascii.json
@@ -1,0 +1,1 @@
+["asd "]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_space.json
@@ -1,0 +1,1 @@
+" "
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_three-byte-utf-8.json
@@ -1,0 +1,1 @@
+["\u0821"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_two-byte-utf-8.json
@@ -1,0 +1,1 @@
+["\u0123"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_u+2028_line_sep.json
@@ -1,0 +1,1 @@
+["
"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_u+2029_par_sep.json
@@ -1,0 +1,1 @@
+["
"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_uEscape.json
@@ -1,0 +1,1 @@
+["\u0061\u30af\u30EA\u30b9"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unescaped_char_delete.json
@@ -1,0 +1,1 @@
+[""]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unicode.json
@@ -1,0 +1,1 @@
+["\uA66D"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unicodeEscapedBackslash.json
@@ -1,0 +1,1 @@
+["\u005C"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unicode_2.json
@@ -1,0 +1,1 @@
+["⍂㈴⍂"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json
@@ -1,0 +1,1 @@
+["\u200B"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unicode_U+2064_invisible_plus.json
@@ -1,0 +1,1 @@
+["\u2064"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_unicode_escaped_double_quote.json
@@ -1,0 +1,1 @@
+["\u0022"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_utf8.json
@@ -1,0 +1,1 @@
+["€𝄞"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_string_with_del_character.json
@@ -1,0 +1,1 @@
+["aa"]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_lonely_false.json
@@ -1,0 +1,1 @@
+false
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_lonely_int.json
@@ -1,0 +1,1 @@
+42
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_lonely_negative_real.json
@@ -1,0 +1,1 @@
+-0.1
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_lonely_null.json
@@ -1,0 +1,1 @@
+null
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_lonely_string.json
@@ -1,0 +1,1 @@
+"asd"
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_lonely_true.json
@@ -1,0 +1,1 @@
+true
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_string_empty.json
@@ -1,0 +1,1 @@
+""
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_trailing_newline.json
@@ -1,0 +1,1 @@
+["a"]
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_true_in_array.json
@@ -1,0 +1,1 @@
+[true]
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/inputs/y_structure_whitespace_array.json
@@ -1,0 +1,1 @@
+ [] 
\ No newline at end of file
--- /dev/null
+++ b/lib/json/test/parse.myr
@@ -1,0 +1,132 @@
+use std
+use json
+use testr
+
+const main = {
+	strtest()
+	filetest()
+}
+
+const strtest = {
+	testr.run([
+		[.name="null", .fn={ctx
+			var j = std.try(json.parse("null"))
+			match j
+			| &(`json.Null):	std.put("ok\n")
+			| val:	testr.fail(ctx, "wrong value {}", val)
+			;;
+			json.free(j)
+		}],
+		[.name="bool", .fn={ctx
+			var j = std.try(json.parse("true"))
+			match j
+			| &(`json.Bool true):	std.put("ok\n")
+			| val:	testr.fail(ctx, "wrong value {}", val)
+			;;
+			j = std.try(json.parse("false"))
+			match j
+			| &(`json.Bool false):	std.put("ok\n")
+			| val:	testr.fail(ctx, "wrong value {}", val)
+			;;
+			json.free(j)
+		}],
+		[.name="num", .fn={ctx
+			var j = std.try(json.parse("123"))
+			match j
+			| &(`json.Num 123.0):	std.put("ok\n")
+			| val:	testr.fail(ctx, "wrong value {}", val)
+			;;
+			json.free(j)
+		}],
+		[.name="str", .fn={ctx
+			var j = std.try(json.parse("\"some str\""))
+			match j
+			| &(`json.Str "some str"):	std.put("ok\n")
+			| val:	testr.fail(ctx, "wrong value {}", val)
+			;;
+			json.free(j)
+		}],
+		[.name="arr", .fn={ctx
+			var j = std.try(json.parse("[\"some str\", 123, false]"))
+			match j
+			| &(`json.Arr a):
+				match a[0]
+				| &(`json.Str "some str"):	std.put("ok\n")
+				| val:	testr.fail(ctx, "wrong value {}", val)
+				;;
+				match a[1]
+				| &(`json.Num 123.0):	std.put("ok\n")
+				| val:	testr.fail(ctx, "wrong value {}", val)
+				;;
+				match a[2]
+				| &(`json.Bool false):	std.put("ok\n")
+				| val:	testr.fail(ctx, "wrong value {}", val)
+				;;
+			| val:	testr.fail(ctx, "wrong value {}", val)
+			;;
+			json.free(j)
+		}],
+		[.name="obj", .fn={ctx
+			var j = std.try(json.parse("{\"key\": 123, \"another\": \"foo\"}"))
+			match j
+			| &(`json.Obj a):
+				match a[0]
+				| ("key", &(`json.Num 123.0)):
+					std.put("ok\n")
+				| val:
+					testr.fail(ctx, "wrong value {}", val)
+				;;
+				match a[1]
+				| ("another", &(`json.Str "foo")):
+					std.put("ok\n")
+				| val:
+					testr.fail(ctx, "wrong value {}", val)
+				;;
+			| val:
+				testr.fail(ctx, "wrong value {}", val)
+			;;
+			json.free(j)
+		}],
+	][:])
+}
+
+const filetest = {
+	var dir, data, path
+
+	dir = std.try(std.diropen("test/inputs"))
+	for f in std.byentry(dir)
+		path = std.pathcat("test/inputs", f)
+		data = std.try(std.slurp(path))
+		/* 'n' indicates expected failure, 'y' indicates expected success, 'i' indicates implementation defined */
+		match std.decode(f)
+		| 'n':
+			testr.run([
+				[.name=f, .fn={ctx
+					match json.parse(data)
+					| `std.Err e:	/* ok */
+					| `std.Ok r:	testr.fail(ctx, "succeeded in parsing malformed json: {}\n", r)
+						std.die("hah")
+					;;
+				}]
+			][:])
+
+		| 'y':
+			testr.run([
+				[.name=f, .fn={ctx
+					match json.parse(data)
+					| `std.Err e:	testr.fail(ctx, "failed to parse json\n")
+					| `std.Ok r:	json.free(r)
+					;;
+				}]
+			][:])
+		| '_':
+			std.put("skip: {}\n", f)
+		| 'i':
+			std.put("ignoring implementation defined test {}\n", f)
+		| wat:
+			std.fatal("unknown test {}: needs to start with y or n\n", f)
+		;;
+		std.slfree(data)
+		std.slfree(path)
+	;;
+}
--- /dev/null
+++ b/lib/json/types.myr
@@ -1,0 +1,26 @@
+use std
+
+pkg json =
+	type elt = union
+		`Null
+		`Bool	bool
+		`Num	flt64
+		`Str	byte[:]
+		`Arr	elt#[:]
+		`Obj	(byte[:], elt#)[:]
+	;;
+
+	type err = struct
+		e	: errtype
+		line	: std.size
+		off	: std.size
+	;;
+
+	type errtype = union
+		`Badesc char
+		`Junk char
+		`Depth
+		`End
+	;;
+;;
+
--