From abafcdc0f52d2646b624843ff38fd0d2e3979f4e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 17 Aug 2026 00:19:07 +0200 Subject: [PATCH 1/2] Add a JSON parser and string escaper written in GAP gap/utf8.gi and gap/parse.gi transcribe the picojson parser in src/picojson/picojson.h, gap_val::from_str in src/picojson/gap-traits.h, and getUTF8Char/outputUnicodeChar/FuncJSON_ESCAPE_STRING in src/json.cc, so that the two implementations accept and reject the same texts, produce the same values, and report the same errors. That includes picojson's relaxed reading of numbers and the C code's idiosyncratic UTF-8 decoding, both reproduced deliberately: behaviour should not depend on whether the kernel extension happened to compile. Speed comes from scanning with a TranslateString'd copy of the input and the kernel's Position, so that runs of ordinary bytes are copied in one slice rather than a character at a time, and from reading streams in chunks and seeking back afterwards. Two differences from the C code are on purpose. Input nested deeper than _JSON_MAX_DEPTH is rejected with an ordinary error instead of overflowing the C stack and taking GAP with it. And reading past the end of a string yields 0 rather than whatever follows the buffer, so escaping a string ending in a truncated UTF-8 sequence no longer crashes. Co-Authored-By: Claude Opus 5 --- .github/workflows/CI.yml | 15 + PackageInfo.g | 10 - README | 24 +- gap/impl.gi | 62 ++++ gap/json.gd | 35 ++- gap/json.gi | 13 +- gap/parse.gi | 613 +++++++++++++++++++++++++++++++++++++++ gap/utf8.gi | 184 ++++++++++++ init.g | 13 +- read.g | 5 + 10 files changed, 951 insertions(+), 23 deletions(-) create mode 100644 gap/impl.gi create mode 100644 gap/parse.gi create mode 100644 gap/utf8.gi diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8143242..7463d86 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,3 +43,18 @@ jobs: - uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} + + # Exercise the pure GAP fallback on its own, by not building the kernel + # extension at all. + test-without-kernel-extension: + name: no kernel extension + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - uses: gap-actions/setup-gap@v3 + - uses: gap-actions/run-pkg-tests@v4 + - uses: gap-actions/process-coverage@v3 + - uses: codecov/codecov-action@v6 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/PackageInfo.g b/PackageInfo.g index ea83266..9215782 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -75,16 +75,6 @@ Dependencies := rec( ExternalConditions := [ ], ), -AvailabilityTest := function() - if IsKernelExtensionAvailable("json") = false then - LogPackageLoadingMessage( PACKAGE_WARNING, - [ "kernel functions for json are not available." ] ); - return false; - else - return true; - fi; -end, - TestFile := "tst/testall.g", #Keywords := [ "TODO" ], diff --git a/README b/README index 42ec443..0aa58dd 100644 --- a/README +++ b/README @@ -15,6 +15,12 @@ Note that this library will not map any other GAP types, such as groups, permutations, to or from JSON. If you wish to map between more complex types, look at the openmath package, or IO_Pickle in the IO package. +The package ships a JSON parser written in C and an equivalent one written +in GAP. The C one needs the package's kernel extension to have been compiled +and is used automatically whenever it is present; otherwise the GAP one takes +over, so the package works either way. See JsonAvailableImplementations, +JsonImplementation and SetJsonImplementation in the manual. + Updates ======= @@ -22,11 +28,19 @@ Updates unreleased ====== -Fix a buffer over-read when escaping a string whose last character is a -truncated multi-byte UTF-8 sequence, such as [ CHAR_INT(200) ]. Reading past -the end of the string now yields 0 rather than whatever happened to follow it, -so the sequence falls back to Latin-1 like any other malformed one instead of -raising an error or reading out of bounds. +- Fix a buffer over-read when escaping a string whose last character is a + truncated multi-byte UTF-8 sequence, such as [ CHAR_INT(200) ]. Reading past + the end of the string now yields 0 rather than whatever happened to follow + it, so the sequence falls back to Latin-1 like any other malformed one + instead of raising an error or reading out of bounds. + +- The kernel extension is now optional: without it the package falls back to a + JSON parser written in GAP, which accepts and rejects the same texts, produces + the same values and reports the same errors. SetJsonImplementation switches + between the two at runtime. + +- The test suite now includes JSONTestSuite (https://github.com/nst/JSONTestSuite) + and runs everything through both implementations. v2.3.0 ====== diff --git a/gap/impl.gi b/gap/impl.gi new file mode 100644 index 0000000..31ae7f1 --- /dev/null +++ b/gap/impl.gi @@ -0,0 +1,62 @@ +############################################################################# +## +#W impl.gi json Package +## +## The registry of JSON implementations, and the selection of the one to use. +## This file must be read last: it refers to functions installed by all the +## other files. +## + +# The kernel functions are looked up by name rather than referenced directly, +# so that reading this file produces no warnings when the kernel extension is +# absent and the globals are therefore unbound. +BindGlobal( "_JSON_IMPLEMENTATIONS", rec( + gap := rec( + name := "gap", + StringToGap := _JSON_PureStringToGap, + StreamToGap := _JSON_PureStreamToGap, + EscapeString := _JSON_PureEscapeString, + ListToString := fail, # kernel-only optimisation, see gap/json.gi + ) ) ); + +if JSON_KERNEL_AVAILABLE then + _JSON_IMPLEMENTATIONS.kernel := rec( + name := "kernel", + StringToGap := ValueGlobal("JSON_STRING_TO_GAP"), + StreamToGap := ValueGlobal("JSON_STREAM_TO_GAP"), + EscapeString := ValueGlobal("JSON_ESCAPE_STRING"), + ListToString := ValueGlobal("GAP_LIST_TO_JSON_STRING"), + ); +fi; + +InstallGlobalFunction(JsonAvailableImplementations, +function() + if JSON_KERNEL_AVAILABLE then + return [ "kernel", "gap" ]; + fi; + return [ "gap" ]; +end ); + +InstallGlobalFunction(JsonImplementation, +function() + return _JSON_ACTIVE.name; +end ); + +InstallGlobalFunction(SetJsonImplementation, +function(name) + local old, impl, comp; + if not name in JsonAvailableImplementations() then + # the text deliberately does not list the implementations, which depend + # on whether the kernel extension was built + ErrorNoReturn(" must be one of JsonAvailableImplementations()"); + fi; + old := _JSON_ACTIVE.name; + impl := _JSON_IMPLEMENTATIONS.(name); + # mutate in place; other code holds on to _JSON_ACTIVE itself + for comp in RecNames(impl) do + _JSON_ACTIVE.(comp) := impl.(comp); + od; + return old; +end ); + +SetJsonImplementation( JsonAvailableImplementations()[1] ); diff --git a/gap/json.gd b/gap/json.gd index 924a208..b513a0d 100644 --- a/gap/json.gd +++ b/gap/json.gd @@ -39,4 +39,37 @@ DeclareGlobalFunction("JsonStringToGap"); #! @Returns value #! @Description #! Reads a single JSON object from a stream and converts it to a GAP value. -DeclareGlobalFunction("JsonStreamToGap"); \ No newline at end of file +DeclareGlobalFunction("JsonStreamToGap"); + +#! @Section Implementations +#! The json package parses JSON and escapes strings either with a fast +#! implementation written in C, which is only available if the package's +#! kernel extension was compiled, or with a pure &GAP; one, which is always +#! available. Both produce the same results; the kernel implementation is used +#! whenever it is present, so switching is only of interest for testing. + +#! @Arguments +#! @Returns list of strings +#! @Description +#! The names of the available implementations, most preferred first: either +#! [ "kernel", "gap" ] or [ "gap" ]. +DeclareGlobalFunction("JsonAvailableImplementations"); + +#! @Arguments +#! @Returns string +#! @Description +#! The name of the implementation currently in use. +DeclareGlobalFunction("JsonImplementation"); + +#! @Arguments name +#! @Returns string +#! @Description +#! Selects the implementation name, which must be one of the strings +#! returned by , and returns the name +#! of the previously selected one. +DeclareGlobalFunction("SetJsonImplementation"); + +# The active implementation, as a record with components StringToGap, +# StreamToGap, EscapeString and ListToString. Bound here, in the declaration +# part, so that gap/json.gi can refer to it before gap/impl.gi fills it in. +_JSON_ACTIVE := rec( name := fail ); diff --git a/gap/json.gi b/gap/json.gi index 5e2a971..671d1f1 100644 --- a/gap/json.gi +++ b/gap/json.gi @@ -59,7 +59,7 @@ function(o, s) fi; else WriteAll(o, "\""); - WriteAll(o, JSON_ESCAPE_STRING(s)); + WriteAll(o, _JSON_ACTIVE.EscapeString(s)); WriteAll(o, "\""); fi; end ); @@ -67,8 +67,11 @@ end ); InstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsList], function(o, l) local i, first; - if IsOutputTextStringRep(o) and IsStringRep(o![1]) then - GAP_LIST_TO_JSON_STRING(o![1], o, l); + # the kernel fast path is a pure optimisation producing byte-identical + # output, so the pure GAP implementation just falls through to the loop + if _JSON_ACTIVE.ListToString <> fail + and IsOutputTextStringRep(o) and IsStringRep(o![1]) then + _JSON_ACTIVE.ListToString(o![1], o, l); else first := true; WriteAll(o, "["); @@ -124,10 +127,10 @@ end ); InstallGlobalFunction(JsonStringToGap, function(str) - return JSON_STRING_TO_GAP(str); + return _JSON_ACTIVE.StringToGap(str); end ); InstallGlobalFunction(JsonStreamToGap, function(str) - return JSON_STREAM_TO_GAP(str); + return _JSON_ACTIVE.StreamToGap(str); end ); diff --git a/gap/parse.gi b/gap/parse.gi new file mode 100644 index 0000000..6fc0d4a --- /dev/null +++ b/gap/parse.gi @@ -0,0 +1,613 @@ +############################################################################# +## +#W parse.gi json Package +## +## The pure GAP JSON parser. +## +## This is a transcription of the picojson parser in src/picojson/picojson.h +## and of gap_val::from_str in src/picojson/gap-traits.h, so that both +## implementations accept and reject the same texts, produce the same values +## and raise the same error messages. picojson is more permissive than +## RFC 8259 about numbers -- it accepts leading zeros, `1.`, `-.5` and `2.e3` +## -- and that is reproduced here on purpose; tst/test_jsontestsuite.tst +## pins the exact list of deviations. +## +## Reading is done through a reader record mirroring picojson's input: +## +## buf the bytes read so far +## marks a copy of buf with `"`, `\` and the control characters replaced +## by _JSON_MARK, so that string bodies can be scanned with the +## kernel's Position rather than a GAP level loop +## len Length(buf) +## reallen how many bytes of buf came from the source +## pos index of the next byte to read +## maxpos the largest value pos has ever had, so maxpos-1 is the number +## of bytes actually read; used for the error line number +## eofread whether the last read hit the end of the input +## + +# Maximum nesting depth accepted here. The kernel parser recurses on the C +# stack instead and crashes GAP outright on deeply nested input. +_JSON_MAX_DEPTH := 1024; + +# declared ahead of its definition because it recurses +DeclareGlobalFunction( "_JSON_ParseValue" ); + +# `"`, `\` and the control characters end a run of ordinary string bytes +BindGlobal( "_JSON_PARSE_MARKS", + _JSON_MarkTable( Concatenation( [ 0 .. 31 ], [ 34, 92 ] ) ) ); + +BindGlobal( "_JSON_CONTROL_CHARS", List( [ 0 .. 31 ], CHAR_INT ) ); +ConvertToStringRep( _JSON_CONTROL_CHARS ); + + +############################################################################# +## +## Filling the buffer. +## + +# Appends to the buffer, keeping in step. +BindGlobal( "_JSON_Append", function(r, chunk) + local m; + m := ShallowCopy(chunk); + TranslateString(m, _JSON_PARSE_MARKS); + Append(r.buf, chunk); + Append(r.marks, m); + r.len := Length(r.buf); +end ); + +# Tries to make at least one more byte available; returns whether it managed. +BindGlobal( "_JSON_FillMore", function(r) + local chunk, byte; + + if r.eof then + return false; + fi; + + if r.seekable then + chunk := ReadAll(r.stream, r.chunk); + r.chunk := Minimum(2 * r.chunk, 65536); + if chunk <> fail and Length(chunk) > 0 then + r.reallen := r.reallen + Length(chunk); + _JSON_Append(r, chunk); + return true; + fi; + else + byte := ReadByte(r.stream); + if byte <> fail then + r.reallen := r.reallen + 1; + _JSON_Append(r, [ CHAR_INT(byte) ]); + return true; + fi; + fi; + + # The stream is exhausted. The C iterator returns a byte 0 for the first + # failing ReadByte and only reports the end of the input on the next call, + # so the parser sees one spurious NUL first; reproduce that, as + # tst/test_stream.tst depends on it. See src/json.cc:281-320. + r.eof := true; + _JSON_Append(r, "\000"); + return true; +end ); + +# Ensures the byte at index is available if the source can supply it. +BindGlobal( "_JSON_Fill", function(r, n) + while r.len < n do + if not _JSON_FillMore(r) then + return false; + fi; + od; + return true; +end ); + + +############################################################################# +## +## The primitives of picojson's input. +## + +# picojson's getc: the next byte, or -1 at the end of the input +BindGlobal( "_JSON_Next", function(r) + local c; + if r.len < r.pos and not _JSON_Fill(r, r.pos) then + r.eofread := true; + return -1; + fi; + c := INT_CHAR(r.buf[r.pos]); + r.pos := r.pos + 1; + if r.pos > r.maxpos then + r.maxpos := r.pos; + fi; + r.eofread := false; + return c; +end ); + +# picojson's ungetc, which is a no-op after the end of the input was reached +BindGlobal( "_JSON_Unget", function(r) + if not r.eofread then + r.pos := r.pos - 1; + fi; +end ); + +BindGlobal( "_JSON_SkipWs", function(r) + local c; + repeat + c := _JSON_Next(r); + until c <> 32 and c <> 9 and c <> 10 and c <> 13; + _JSON_Unget(r); +end ); + +BindGlobal( "_JSON_Expect", function(r, c) + _JSON_SkipWs(r); + if _JSON_Next(r) <> c then + _JSON_Unget(r); + return false; + fi; + return true; +end ); + +BindGlobal( "_JSON_Match", function(r, str) + local c; + for c in str do + if _JSON_Next(r) <> INT_CHAR(c) then + _JSON_Unget(r); + return false; + fi; + od; + return true; +end ); + +# Position of the next mark at or after index , filling as needed. +BindGlobal( "_JSON_FindMark", function(r, from) + local q; + while true do + q := Position(r.marks, _JSON_MARK, from - 1); + if q <> fail then + return q; + fi; + from := r.len + 1; + if not _JSON_FillMore(r) then + return fail; + fi; + od; +end ); + + +############################################################################# +## +## Errors. +## + +# Position of the next newline at or after r.pos, or len+1 if there is none. +BindGlobal( "_JSON_FindNewline", function(r) + local p, from; + from := r.pos; + while true do + p := Position(r.buf, '\n', from - 1); + if p <> fail then + return p; + fi; + from := r.len + 1; + if not _JSON_FillMore(r) then + return r.len + 1; + fi; + od; +end ); + +# Repositions a seekable stream on the byte after the last one the parser +# used, undoing any read-ahead done for speed. +BindGlobal( "_JSON_StreamSync", function(r) + if r.seekable then + SeekPositionStream(r.stream, + r.startpos + Minimum(r.maxpos - 1, r.reallen)); + fi; +end ); + +BindGlobal( "_JSON_SyntaxError", function(r) + local read, line, p, stop, tail; + + # picojson counts a line for every read whose predecessor was a newline + read := r.maxpos - 1; + line := 1; + p := 0; + while true do + p := Position(r.buf, '\n', p); + if p = fail or p >= read then + break; + fi; + line := line + 1; + od; + + # the message ends with the rest of the current line, control characters + # removed + stop := _JSON_FindNewline(r); + tail := r.buf{[ r.pos .. stop - 1 ]}; + RemoveCharacters(tail, _JSON_CONTROL_CHARS); + + # that scan consumes the rest of the line, terminating newline included + r.maxpos := Maximum(r.maxpos, stop + 1); + _JSON_StreamSync(r); + ErrorNoReturn("syntax error at line ", line, " near: ", tail); +end ); + + +############################################################################# +## +## Numbers. +## + +BindGlobal( "_JSON_ISNUMCHAR", List( [ 0 .. 255 ], + i -> (i >= 48 and i <= 57) or i = 43 or i = 45 or i = 101 or i = 69 or i = 46 ) ); + +# gap_val::to_gap_int: an optional sign followed by at least one digit +BindGlobal( "_JSON_ToGapInt", function(s) + local neg, rest; + if IsEmpty(s) then + return fail; + fi; + neg := s[1] = '-'; + if neg or s[1] = '+' then + rest := s{[ 2 .. Length(s) ]}; + else + rest := s; + fi; + # Int("") and Int("-") are both 0, so check the digits ourselves + if IsEmpty(rest) or not IsSubset(CHARS_DIGITS, rest) then + return fail; + fi; + if neg then + return - Int(rest); + fi; + return Int(rest); +end ); + +BindGlobal( "_JSON_ParseNumber", function(r) + local tok, c, loc, i, val, mant, exp; + + tok := ""; + repeat + c := _JSON_Next(r); + if c >= 0 and _JSON_ISNUMCHAR[ c+1 ] then + Add(tok, CHAR_INT(c)); + else + _JSON_Unget(r); + break; + fi; + until false; + + if IsEmpty(tok) then + _JSON_SyntaxError(r); + fi; + + # gap_val::from_str: a fractional part or a negative exponent gives a float, + # anything else an integer of arbitrary size + if '.' in tok then + val := FLOAT_STRING(tok); + if val = fail then + _JSON_SyntaxError(r); + fi; + return val; + fi; + + loc := fail; + for i in [ 1 .. Length(tok) ] do + if tok[i] = 'e' or tok[i] = 'E' then + loc := i; + break; + fi; + od; + + if loc = fail then + val := _JSON_ToGapInt(tok); + if val = fail then + _JSON_SyntaxError(r); + fi; + return val; + fi; + + if loc < Length(tok) and tok[loc+1] = '-' then + val := FLOAT_STRING(tok); + if val = fail then + _JSON_SyntaxError(r); + fi; + return val; + fi; + + mant := _JSON_ToGapInt(tok{[ 1 .. loc-1 ]}); + exp := _JSON_ToGapInt(tok{[ loc+1 .. Length(tok) ]}); + if mant = fail or exp = fail then + _JSON_SyntaxError(r); + fi; + return mant * 10 ^ exp; +end ); + + +############################################################################# +## +## Strings. +## + +# picojson's _parse_quadhex, returning fail rather than -1 +BindGlobal( "_JSON_ParseQuadHex", function(r) + local val, i, c; + val := 0; + for i in [ 1 .. 4 ] do + c := _JSON_Next(r); + if c = -1 then + return fail; + elif c >= 48 and c <= 57 then + c := c - 48; + elif c >= 65 and c <= 70 then + c := c - 55; + elif c >= 97 and c <= 102 then + c := c - 87; + else + _JSON_Unget(r); + return fail; + fi; + val := 16 * val + c; + od; + return val; +end ); + +# picojson's _parse_codepoint +BindGlobal( "_JSON_ParseCodepoint", function(r, out) + local val, second; + + val := _JSON_ParseQuadHex(r); + if val = fail then + return false; + fi; + + if val >= 55296 and val <= 57343 then + if val >= 56320 then + # a low surrogate on its own + return false; + fi; + # note the short circuit: if the first byte is not a backslash the second + # one is never read + if _JSON_Next(r) <> 92 or _JSON_Next(r) <> 117 then + _JSON_Unget(r); + return false; + fi; + second := _JSON_ParseQuadHex(r); + if second = fail or second < 56320 or second > 57343 then + return false; + fi; + val := 65536 + 1024 * (val - 55296) + (second - 56320) mod 1024; + fi; + + _JSON_AppendUTF8Char(out, val); + return true; +end ); + +# picojson's _parse_string, entered after the opening quote. Runs of ordinary +# bytes are copied in one go, so a string without escapes costs one Position +# and one slice. +BindGlobal( "_JSON_ParseStringBody", function(r) + local start, out, q, c; + + start := r.pos; + out := fail; + + while true do + q := _JSON_FindMark(r, r.pos); + if q = fail then + # ran off the end; picojson reads -1, which is below ' ' + r.pos := r.len + 1; + r.eofread := true; + _JSON_SyntaxError(r); + fi; + + c := INT_CHAR(r.buf[q]); + if c = 34 then + if out = fail then + out := r.buf{[ start .. q-1 ]}; + else + Append(out, r.buf{[ start .. q-1 ]}); + fi; + r.pos := q + 1; + r.maxpos := Maximum(r.maxpos, q + 1); + r.eofread := false; + return out; + elif c < 32 then + # a raw control character; picojson ungets it before failing + r.pos := q; + r.maxpos := Maximum(r.maxpos, q + 1); + r.eofread := false; + _JSON_SyntaxError(r); + fi; + + # a backslash + if out = fail then + out := ""; + fi; + Append(out, r.buf{[ start .. q-1 ]}); + r.pos := q + 1; + r.maxpos := Maximum(r.maxpos, q + 1); + r.eofread := false; + + c := _JSON_Next(r); + if c = -1 then + _JSON_SyntaxError(r); + elif c = 34 or c = 92 or c = 47 then + Add(out, CHAR_INT(c)); + elif c = 98 then + Add(out, '\b'); + elif c = 102 then + Add(out, '\014'); + elif c = 110 then + Add(out, '\n'); + elif c = 114 then + Add(out, '\r'); + elif c = 116 then + Add(out, '\t'); + elif c = 117 then + if not _JSON_ParseCodepoint(r, out) then + _JSON_SyntaxError(r); + fi; + else + _JSON_SyntaxError(r); + fi; + start := r.pos; + od; +end ); + + +############################################################################# +## +## Values. +## + +InstallGlobalFunction( _JSON_ParseValue, function(r, depth) + local c, res, list, key; + + if depth > _JSON_MAX_DEPTH then + _JSON_StreamSync(r); + ErrorNoReturn("JSON input nested more than _JSON_MAX_DEPTH (", + _JSON_MAX_DEPTH, ") levels deep"); + fi; + + _JSON_SkipWs(r); + c := _JSON_Next(r); + + if c = 110 then # null + if not _JSON_Match(r, "ull") then + _JSON_SyntaxError(r); + fi; + return fail; + + elif c = 116 then # true + if not _JSON_Match(r, "rue") then + _JSON_SyntaxError(r); + fi; + return true; + + elif c = 102 then # false + if not _JSON_Match(r, "alse") then + _JSON_SyntaxError(r); + fi; + return false; + + elif c = 34 then # a string + return _JSON_ParseStringBody(r); + + elif c = 91 then # an array + list := []; + if _JSON_Expect(r, 93) then + return list; + fi; + repeat + Add(list, _JSON_ParseValue(r, depth + 1)); + until not _JSON_Expect(r, 44); + if not _JSON_Expect(r, 93) then + _JSON_SyntaxError(r); + fi; + return list; + + elif c = 123 then # an object + res := rec(); + if _JSON_Expect(r, 125) then + return res; + fi; + repeat + if not _JSON_Expect(r, 34) then + _JSON_SyntaxError(r); + fi; + key := _JSON_ParseStringBody(r); + if not _JSON_Expect(r, 58) then + _JSON_SyntaxError(r); + fi; + # a repeated key overwrites the earlier value, as in the C version + res.(key) := _JSON_ParseValue(r, depth + 1); + until not _JSON_Expect(r, 44); + if not _JSON_Expect(r, 125) then + _JSON_SyntaxError(r); + fi; + return res; + + elif c = 45 or (c >= 48 and c <= 57) then + _JSON_Unget(r); + return _JSON_ParseNumber(r); + fi; + + _JSON_Unget(r); + _JSON_SyntaxError(r); +end ); + + +############################################################################# +## +## Entry points. +## + +BindGlobal( "_JSON_StringReader", function(str) + local marks; + marks := ShallowCopy(str); + TranslateString(marks, _JSON_PARSE_MARKS); + return rec( buf := str, marks := marks, + len := Length(str), reallen := Length(str), + pos := 1, maxpos := 1, eofread := false, + eof := true, seekable := false, stream := fail, + chunk := 0, startpos := 0 ); +end ); + +BindGlobal( "_JSON_PureStringToGap", function(str) + local r, val, i, c, stop; + + if not IsString(str) then + ErrorNoReturn("Input to JsonToGap must be a string"); + fi; + if not IsStringRep(str) then + str := CopyToStringRep(str); + fi; + + r := _JSON_StringReader(str); + val := _JSON_ParseValue(r, 0); + + # nothing but whitespace may follow, mirroring src/json.cc:449-456 + for i in [ r.pos .. Length(str) ] do + c := str[i]; + if not (c in " \t\n\013\014\r") and c <> '\000' then + # the C prints the rest with %s, which stops at a NUL + stop := Position(str, '\000', i-1); + if stop = fail then + stop := Length(str) + 1; + fi; + ErrorNoReturn("Failed to parse end of string: '", + str{[ i .. stop-1 ]}, "'"); + fi; + od; + + return val; +end ); + +BindGlobal( "_JSON_StreamReader", function(stream) + local start, seekable; + + # reading in chunks is far faster than byte by byte, but is only safe if we + # can put back what we did not use + start := CALL_WITH_CATCH(PositionStream, [ stream ]); + seekable := start[1] and IsInt(start[2]) + and CALL_WITH_CATCH(SeekPositionStream, [ stream, start[2] ]) + = [ true, true ]; + if not seekable then + start := [ true, 0 ]; + fi; + + return rec( buf := "", marks := "", + len := 0, reallen := 0, + pos := 1, maxpos := 1, eofread := false, + eof := false, seekable := seekable, stream := stream, + chunk := 1024, startpos := start[2] ); +end ); + +BindGlobal( "_JSON_PureStreamToGap", function(stream) + local r, val; + r := _JSON_StreamReader(stream); + # unlike the string case there is no check for trailing garbage: a stream + # may hold several values in a row + val := _JSON_ParseValue(r, 0); + _JSON_StreamSync(r); + return val; +end ); diff --git a/gap/utf8.gi b/gap/utf8.gi new file mode 100644 index 0000000..8ad04d6 --- /dev/null +++ b/gap/utf8.gi @@ -0,0 +1,184 @@ +############################################################################# +## +#W utf8.gi json Package +## +## UTF-8 handling and string escaping for the pure GAP implementation. +## +## The functions here are transcriptions of getUTF8Char, outputUnicodeChar +## and FuncJSON_ESCAPE_STRING in src/json.cc. They reproduce that code's +## quirks on purpose, so that both implementations produce identical output; +## see the comments on _JSON_GetUTF8Char. +## + +# Character used to mark interesting positions in a TranslateString'd copy of +# the input. Any character not otherwise used would do. +BindGlobal( "_JSON_MARK", CHAR_INT(1) ); + +# builds a 256 character translation table mapping every byte in to +# _JSON_MARK and everything else to a NUL character +BindGlobal( "_JSON_MarkTable", function(bytes) + local table, b; + table := ListWithIdenticalEntries(256, CHAR_INT(0)); + for b in bytes do + table[b+1] := _JSON_MARK; + od; + ConvertToStringRep(table); + return table; +end ); + +# `\`, `"`, `/`, the control characters and everything non-ASCII need looking +# at when escaping. Note 0x7f is deliberately absent: the C code does not +# escape it either. +BindGlobal( "_JSON_ESCAPE_MARKS", + _JSON_MarkTable( Concatenation( [ 0 .. 31 ], [ 34, 47, 92 ], [ 128 .. 255 ] ) ) ); + +# escapes for the control characters which have no shorter form +BindGlobal( "_JSON_CONTROL_ESCAPES", + List( [ 0 .. 31 ], + i -> Concatenation( "\\u00", HexStringInt(i + 256){[2,3]} ) ) ); + + +############################################################################# +## +#F _JSON_GetUTF8Char( , ) +## +## Decodes the character of the string starting at position and +## returns [ , ]. +## +## This is *not* a correct UTF-8 decoder, and must not be turned into one: +## it mirrors getUTF8Char in src/json.cc byte for byte, and tst/test_hard.tst +## pins the resulting output for a file full of malformed UTF-8. In +## particular the bytes 0x80-0x9F count as two byte lead bytes, so that the +## input 0x80 0x80 decodes to code point 0. A sequence that does not decode +## is treated as a single Latin-1 byte. +## +BindGlobal( "_JSON_GetUTF8Char", function(str, pos) + local len, first, val, n, i, c; + + len := Length(str); + first := INT_CHAR(str[pos]); + + if first < 128 then + return [ first, pos + 1 ]; + elif first < 224 then + n := 2; + val := first mod 64; + if val >= 32 then + return [ first, pos + 1 ]; + fi; + elif first < 240 then + n := 3; + val := first mod 32; + else + n := 4; + val := first mod 16; + if val >= 8 then + return [ first, pos + 1 ]; + fi; + fi; + + for i in [ 1 .. n-1 ] do + # reading past the end yields 0, which is not a continuation byte + if pos + i > len then + return [ first, pos + 1 ]; + fi; + c := INT_CHAR(str[pos + i]); + if QuoInt(c, 64) <> 2 then + return [ first, pos + 1 ]; + fi; + val := 64 * val + (c mod 64); + od; + + if val > 1114111 or (val >= 55296 and val <= 57343) then + return [ first, pos + 1 ]; + fi; + + return [ val, pos + n ]; +end ); + + +############################################################################# +## +#F _JSON_AppendUTF8Char( , ) +## +## Appends the UTF-8 encoding of the code point to the string . +## +BindGlobal( "_JSON_AppendUTF8Char", function(out, val) + if val <= 127 then + Add(out, CHAR_INT(val)); + elif val <= 2047 then + Add(out, CHAR_INT(192 + QuoInt(val, 64))); + Add(out, CHAR_INT(128 + val mod 64)); + elif val <= 65535 then + Add(out, CHAR_INT(224 + QuoInt(val, 4096))); + Add(out, CHAR_INT(128 + QuoInt(val, 64) mod 64)); + Add(out, CHAR_INT(128 + val mod 64)); + else + Add(out, CHAR_INT(240 + QuoInt(val, 262144) mod 8)); + Add(out, CHAR_INT(128 + QuoInt(val, 4096) mod 64)); + Add(out, CHAR_INT(128 + QuoInt(val, 64) mod 64)); + Add(out, CHAR_INT(128 + val mod 64)); + fi; +end ); + + +############################################################################# +## +#F _JSON_PureEscapeString( ) +## +## Escapes the string for use inside a pair of JSON quotes, and returns +## itself if nothing needs escaping. +## +BindGlobal( "_JSON_PureEscapeString", function(s) + local str, marks, p, out, prev, dec, val; + + if IsEmpty(s) then + return s; + fi; + if IsStringRep(s) then + str := s; + else + str := CopyToStringRep(s); + fi; + + marks := ShallowCopy(str); + TranslateString(marks, _JSON_ESCAPE_MARKS); + p := Position(marks, _JSON_MARK); + if p = fail then + return s; + fi; + + out := ""; + prev := 1; + while p <> fail do + Append(out, str{[ prev .. p-1 ]}); + # the escaping decision is made on the decoded code point, not on the + # byte: the C code sends overlong encodings through the same switch, so + # that e.g. the bytes 0xC0 0xAF come out as \/ + dec := _JSON_GetUTF8Char(str, p); + val := dec[1]; + if val = 34 or val = 47 or val = 92 then + Add(out, '\\'); + Add(out, CHAR_INT(val)); + elif val = 8 then + Append(out, "\\b"); + elif val = 9 then + Append(out, "\\t"); + elif val = 10 then + Append(out, "\\n"); + elif val = 12 then + Append(out, "\\f"); + elif val = 13 then + Append(out, "\\r"); + elif val < 32 then + Append(out, _JSON_CONTROL_ESCAPES[ val + 1 ]); + else + _JSON_AppendUTF8Char(out, val); + fi; + prev := dec[2]; + p := Position(marks, _JSON_MARK, prev - 1); + od; + Append(out, str{[ prev .. Length(str) ]}); + + return out; +end ); diff --git a/init.g b/init.g index 5f2ccdc..32cd78e 100644 --- a/init.g +++ b/init.g @@ -4,8 +4,17 @@ # Reading the declaration part of the package. # -if LoadKernelExtension("json", "json") = false then - Error("failed to load json kernel extension"); +# The kernel extension is optional: without it we fall back to the pure GAP +# implementation. Probe with IsKernelExtensionAvailable first, as +# LoadKernelExtension raises an error (rather than returning false) when a +# stale .so from an older GAP is present. +BindGlobal( "JSON_KERNEL_AVAILABLE", + IsKernelExtensionAvailable("json", "json") and + LoadKernelExtension("json", "json") ); + +if not JSON_KERNEL_AVAILABLE then + LogPackageLoadingMessage( PACKAGE_INFO, + [ "kernel extension not available, using the pure GAP implementation" ] ); fi; ReadPackage( "json", "gap/json.gd"); diff --git a/read.g b/read.g index 8bd8d8c..83a9366 100644 --- a/read.g +++ b/read.g @@ -3,4 +3,9 @@ # # Reading the implementation part of the package. # +ReadPackage( "json", "gap/utf8.gi"); +ReadPackage( "json", "gap/parse.gi"); ReadPackage( "json", "gap/json.gi"); + +# must come last: it selects the implementation to use +ReadPackage( "json", "gap/impl.gi"); From bd5c9a0128a3ae252e96c747334f1b22ff0604e3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 17 Aug 2026 00:19:24 +0200 Subject: [PATCH 2/2] Test both implementations, and both against JSONTestSuite tst/testall.g now runs the whole test directory once per available implementation, so the GAP code is exercised even where the kernel extension is present. All the existing tests pass unchanged under both, including the ones asserting on exact error messages. tst/JSONTestSuite holds the test_parsing corpus of https://github.com/nst/JSONTestSuite (MIT). Of its 318 files, two nest 100000 levels deep and crash GAP through the kernel parser, so they are left out; the other 316 are checked against the expectations in tst/jsontestsuite.g, which also record the eleven number formats we accept although RFC 8259 does not. Since testall.g runs the file under each implementation against the same expectations, and the file also compares the implementations against each other directly, agreement between them is checked rather than assumed. Co-Authored-By: Claude Opus 5 --- tst/JSONTestSuite/LICENSE | 21 ++ tst/JSONTestSuite/README | 21 ++ .../i_number_double_huge_neg_exp.json | 1 + tst/JSONTestSuite/i_number_huge_exp.json | 1 + .../i_number_neg_int_huge_exp.json | 1 + .../i_number_pos_double_huge_exp.json | 1 + .../i_number_real_neg_overflow.json | 1 + .../i_number_real_pos_overflow.json | 1 + .../i_number_real_underflow.json | 1 + .../i_number_too_big_neg_int.json | 1 + .../i_number_too_big_pos_int.json | 1 + .../i_number_very_big_negative_int.json | 1 + .../i_object_key_lone_2nd_surrogate.json | 1 + ..._string_1st_surrogate_but_2nd_missing.json | 1 + ...tring_1st_valid_surrogate_2nd_invalid.json | 1 + .../i_string_UTF-16LE_with_BOM.json | Bin 0 -> 12 bytes .../i_string_UTF-8_invalid_sequence.json | 1 + .../i_string_UTF8_surrogate_U+D800.json | 1 + ...incomplete_surrogate_and_escape_valid.json | 1 + .../i_string_incomplete_surrogate_pair.json | 1 + ...ng_incomplete_surrogates_escape_valid.json | 1 + .../i_string_invalid_lonely_surrogate.json | 1 + .../i_string_invalid_surrogate.json | 1 + tst/JSONTestSuite/i_string_invalid_utf-8.json | 1 + .../i_string_inverted_surrogates_U+1D11E.json | 1 + tst/JSONTestSuite/i_string_iso_latin_1.json | 1 + .../i_string_lone_second_surrogate.json | 1 + .../i_string_lone_utf8_continuation_byte.json | 1 + .../i_string_not_in_unicode_range.json | 1 + .../i_string_overlong_sequence_2_bytes.json | 1 + .../i_string_overlong_sequence_6_bytes.json | 1 + ...string_overlong_sequence_6_bytes_null.json | 1 + .../i_string_truncated-utf-8.json | 1 + .../i_string_utf16BE_no_BOM.json | Bin 0 -> 10 bytes .../i_string_utf16LE_no_BOM.json | Bin 0 -> 10 bytes .../i_structure_500_nested_arrays.json | 1 + .../i_structure_UTF-8_BOM_empty_object.json | 1 + .../n_array_1_true_without_comma.json | 1 + tst/JSONTestSuite/n_array_a_invalid_utf8.json | 1 + .../n_array_colon_instead_of_comma.json | 1 + .../n_array_comma_after_close.json | 1 + .../n_array_comma_and_number.json | 1 + tst/JSONTestSuite/n_array_double_comma.json | 1 + .../n_array_double_extra_comma.json | 1 + tst/JSONTestSuite/n_array_extra_close.json | 1 + tst/JSONTestSuite/n_array_extra_comma.json | 1 + tst/JSONTestSuite/n_array_incomplete.json | 1 + .../n_array_incomplete_invalid_value.json | 1 + .../n_array_inner_array_no_comma.json | 1 + tst/JSONTestSuite/n_array_invalid_utf8.json | 1 + .../n_array_items_separated_by_semicolon.json | 1 + tst/JSONTestSuite/n_array_just_comma.json | 1 + tst/JSONTestSuite/n_array_just_minus.json | 1 + tst/JSONTestSuite/n_array_missing_value.json | 1 + .../n_array_newlines_unclosed.json | 3 + .../n_array_number_and_comma.json | 1 + .../n_array_number_and_several_commas.json | 1 + .../n_array_spaces_vertical_tab_formfeed.json | 1 + tst/JSONTestSuite/n_array_star_inside.json | 1 + tst/JSONTestSuite/n_array_unclosed.json | 1 + .../n_array_unclosed_trailing_comma.json | 1 + .../n_array_unclosed_with_new_lines.json | 3 + .../n_array_unclosed_with_object_inside.json | 1 + tst/JSONTestSuite/n_incomplete_false.json | 1 + tst/JSONTestSuite/n_incomplete_null.json | 1 + tst/JSONTestSuite/n_incomplete_true.json | 1 + .../n_multidigit_number_then_00.json | Bin 0 -> 4 bytes tst/JSONTestSuite/n_number_++.json | 1 + tst/JSONTestSuite/n_number_+1.json | 1 + tst/JSONTestSuite/n_number_+Inf.json | 1 + tst/JSONTestSuite/n_number_-01.json | 1 + tst/JSONTestSuite/n_number_-1.0..json | 1 + tst/JSONTestSuite/n_number_-2..json | 1 + tst/JSONTestSuite/n_number_-NaN.json | 1 + tst/JSONTestSuite/n_number_.-1.json | 1 + tst/JSONTestSuite/n_number_.2e-3.json | 1 + tst/JSONTestSuite/n_number_0.1.2.json | 1 + tst/JSONTestSuite/n_number_0.3e+.json | 1 + tst/JSONTestSuite/n_number_0.3e.json | 1 + tst/JSONTestSuite/n_number_0.e1.json | 1 + tst/JSONTestSuite/n_number_0_capital_E+.json | 1 + tst/JSONTestSuite/n_number_0_capital_E.json | 1 + tst/JSONTestSuite/n_number_0e+.json | 1 + tst/JSONTestSuite/n_number_0e.json | 1 + tst/JSONTestSuite/n_number_1.0e+.json | 1 + tst/JSONTestSuite/n_number_1.0e-.json | 1 + tst/JSONTestSuite/n_number_1.0e.json | 1 + tst/JSONTestSuite/n_number_1_000.json | 1 + tst/JSONTestSuite/n_number_1eE2.json | 1 + tst/JSONTestSuite/n_number_2.e+3.json | 1 + tst/JSONTestSuite/n_number_2.e-3.json | 1 + tst/JSONTestSuite/n_number_2.e3.json | 1 + tst/JSONTestSuite/n_number_9.e+.json | 1 + tst/JSONTestSuite/n_number_Inf.json | 1 + tst/JSONTestSuite/n_number_NaN.json | 1 + .../n_number_U+FF11_fullwidth_digit_one.json | 1 + tst/JSONTestSuite/n_number_expression.json | 1 + tst/JSONTestSuite/n_number_hex_1_digit.json | 1 + tst/JSONTestSuite/n_number_hex_2_digits.json | 1 + tst/JSONTestSuite/n_number_infinity.json | 1 + tst/JSONTestSuite/n_number_invalid+-.json | 1 + .../n_number_invalid-negative-real.json | 1 + .../n_number_invalid-utf-8-in-bigger-int.json | 1 + .../n_number_invalid-utf-8-in-exponent.json | 1 + .../n_number_invalid-utf-8-in-int.json | 1 + .../n_number_minus_infinity.json | 1 + ...mber_minus_sign_with_trailing_garbage.json | 1 + tst/JSONTestSuite/n_number_minus_space_1.json | 1 + .../n_number_neg_int_starting_with_zero.json | 1 + .../n_number_neg_real_without_int_part.json | 1 + .../n_number_neg_with_garbage_at_end.json | 1 + .../n_number_real_garbage_after_e.json | 1 + ...number_real_with_invalid_utf8_after_e.json | 1 + ...n_number_real_without_fractional_part.json | 1 + .../n_number_starting_with_dot.json | 1 + tst/JSONTestSuite/n_number_with_alpha.json | 1 + .../n_number_with_alpha_char.json | 1 + .../n_number_with_leading_zero.json | 1 + tst/JSONTestSuite/n_object_bad_value.json | 1 + tst/JSONTestSuite/n_object_bracket_key.json | 1 + .../n_object_comma_instead_of_colon.json | 1 + tst/JSONTestSuite/n_object_double_colon.json | 1 + tst/JSONTestSuite/n_object_emoji.json | 1 + .../n_object_garbage_at_end.json | 1 + .../n_object_key_with_single_quotes.json | 1 + ...uation_byte_in_key_and_trailing_comma.json | 1 + tst/JSONTestSuite/n_object_missing_colon.json | 1 + tst/JSONTestSuite/n_object_missing_key.json | 1 + .../n_object_missing_semicolon.json | 1 + tst/JSONTestSuite/n_object_missing_value.json | 1 + tst/JSONTestSuite/n_object_no-colon.json | 1 + .../n_object_non_string_key.json | 1 + ...on_string_key_but_huge_number_instead.json | 1 + .../n_object_repeated_null_null.json | 1 + .../n_object_several_trailing_commas.json | 1 + tst/JSONTestSuite/n_object_single_quote.json | 1 + .../n_object_trailing_comma.json | 1 + .../n_object_trailing_comment.json | 1 + .../n_object_trailing_comment_open.json | 1 + .../n_object_trailing_comment_slash_open.json | 1 + ...railing_comment_slash_open_incomplete.json | 1 + .../n_object_two_commas_in_a_row.json | 1 + tst/JSONTestSuite/n_object_unquoted_key.json | 1 + .../n_object_unterminated-value.json | 1 + .../n_object_with_single_string.json | 1 + .../n_object_with_trailing_garbage.json | 1 + tst/JSONTestSuite/n_single_space.json | 1 + .../n_string_1_surrogate_then_escape.json | 1 + .../n_string_1_surrogate_then_escape_u.json | 1 + .../n_string_1_surrogate_then_escape_u1.json | 1 + .../n_string_1_surrogate_then_escape_u1x.json | 1 + .../n_string_accentuated_char_no_quotes.json | 1 + tst/JSONTestSuite/n_string_backslash_00.json | Bin 0 -> 6 bytes tst/JSONTestSuite/n_string_escape_x.json | 1 + .../n_string_escaped_backslash_bad.json | 1 + .../n_string_escaped_ctrl_char_tab.json | 1 + tst/JSONTestSuite/n_string_escaped_emoji.json | 1 + .../n_string_incomplete_escape.json | 1 + ...n_string_incomplete_escaped_character.json | 1 + .../n_string_incomplete_surrogate.json | 1 + ...g_incomplete_surrogate_escape_invalid.json | 1 + .../n_string_invalid-utf-8-in-escape.json | 1 + .../n_string_invalid_backslash_esc.json | 1 + .../n_string_invalid_unicode_escape.json | 1 + .../n_string_invalid_utf8_after_escape.json | 1 + .../n_string_leading_uescaped_thinspace.json | 1 + .../n_string_no_quotes_with_bad_escape.json | 1 + .../n_string_single_doublequote.json | 1 + tst/JSONTestSuite/n_string_single_quote.json | 1 + ...string_single_string_no_double_quotes.json | 1 + .../n_string_start_escape_unclosed.json | 1 + .../n_string_unescaped_ctrl_char.json | Bin 0 -> 7 bytes .../n_string_unescaped_newline.json | 2 + tst/JSONTestSuite/n_string_unescaped_tab.json | 1 + .../n_string_unicode_CapitalU.json | 1 + .../n_string_with_trailing_garbage.json | 1 + .../n_structure_U+2060_word_joined.json | 1 + .../n_structure_UTF8_BOM_no_data.json | 1 + .../n_structure_angle_bracket_..json | 1 + .../n_structure_angle_bracket_null.json | 1 + .../n_structure_array_trailing_garbage.json | 1 + ...tructure_array_with_extra_array_close.json | 1 + ..._structure_array_with_unclosed_string.json | 1 + .../n_structure_ascii-unicode-identifier.json | 1 + .../n_structure_capitalized_True.json | 1 + .../n_structure_close_unopened_array.json | 1 + ...ucture_comma_instead_of_closing_brace.json | 1 + .../n_structure_double_array.json | 1 + tst/JSONTestSuite/n_structure_end_array.json | 1 + .../n_structure_incomplete_UTF8_BOM.json | 1 + .../n_structure_lone-invalid-utf-8.json | 1 + .../n_structure_lone-open-bracket.json | 1 + tst/JSONTestSuite/n_structure_no_data.json | 0 .../n_structure_null-byte-outside-string.json | Bin 0 -> 3 bytes ...tructure_number_with_trailing_garbage.json | 1 + ...ure_object_followed_by_closing_object.json | 1 + .../n_structure_object_unclosed_no_value.json | 1 + .../n_structure_object_with_comment.json | 1 + ...tructure_object_with_trailing_garbage.json | 1 + .../n_structure_open_array_apostrophe.json | 1 + .../n_structure_open_array_comma.json | 1 + .../n_structure_open_array_open_object.json | 1 + .../n_structure_open_array_open_string.json | 1 + .../n_structure_open_array_string.json | 1 + .../n_structure_open_object.json | 1 + .../n_structure_open_object_close_array.json | 1 + .../n_structure_open_object_comma.json | 1 + .../n_structure_open_object_open_array.json | 1 + .../n_structure_open_object_open_string.json | 1 + ...e_open_object_string_with_apostrophes.json | 1 + tst/JSONTestSuite/n_structure_open_open.json | 1 + .../n_structure_single_eacute.json | 1 + .../n_structure_single_star.json | 1 + tst/JSONTestSuite/n_structure_trailing_#.json | 1 + ...n_structure_uescaped_LF_before_string.json | 1 + .../n_structure_unclosed_array.json | 1 + ...structure_unclosed_array_partial_null.json | 1 + ...cture_unclosed_array_unfinished_false.json | 1 + ...ucture_unclosed_array_unfinished_true.json | 1 + .../n_structure_unclosed_object.json | 1 + .../n_structure_unicode-identifier.json | 1 + ...ructure_whitespace_U+2060_word_joiner.json | 1 + .../n_structure_whitespace_formfeed.json | 1 + .../y_array_arraysWithSpaces.json | 1 + tst/JSONTestSuite/y_array_empty-string.json | 1 + tst/JSONTestSuite/y_array_empty.json | 1 + .../y_array_ending_with_newline.json | 1 + tst/JSONTestSuite/y_array_false.json | 1 + tst/JSONTestSuite/y_array_heterogeneous.json | 1 + tst/JSONTestSuite/y_array_null.json | 1 + .../y_array_with_1_and_newline.json | 2 + .../y_array_with_leading_space.json | 1 + .../y_array_with_several_null.json | 1 + .../y_array_with_trailing_space.json | 1 + tst/JSONTestSuite/y_number.json | 1 + tst/JSONTestSuite/y_number_0e+1.json | 1 + tst/JSONTestSuite/y_number_0e1.json | 1 + tst/JSONTestSuite/y_number_after_space.json | 1 + .../y_number_double_close_to_zero.json | 1 + tst/JSONTestSuite/y_number_int_with_exp.json | 1 + tst/JSONTestSuite/y_number_minus_zero.json | 1 + tst/JSONTestSuite/y_number_negative_int.json | 1 + tst/JSONTestSuite/y_number_negative_one.json | 1 + tst/JSONTestSuite/y_number_negative_zero.json | 1 + .../y_number_real_capital_e.json | 1 + .../y_number_real_capital_e_neg_exp.json | 1 + .../y_number_real_capital_e_pos_exp.json | 1 + tst/JSONTestSuite/y_number_real_exponent.json | 1 + .../y_number_real_fraction_exponent.json | 1 + tst/JSONTestSuite/y_number_real_neg_exp.json | 1 + .../y_number_real_pos_exponent.json | 1 + tst/JSONTestSuite/y_number_simple_int.json | 1 + tst/JSONTestSuite/y_number_simple_real.json | 1 + tst/JSONTestSuite/y_object.json | 1 + tst/JSONTestSuite/y_object_basic.json | 1 + .../y_object_duplicated_key.json | 1 + .../y_object_duplicated_key_and_value.json | 1 + tst/JSONTestSuite/y_object_empty.json | 1 + tst/JSONTestSuite/y_object_empty_key.json | 1 + .../y_object_escaped_null_in_key.json | 1 + .../y_object_extreme_numbers.json | 1 + tst/JSONTestSuite/y_object_long_strings.json | 1 + tst/JSONTestSuite/y_object_simple.json | 1 + .../y_object_string_unicode.json | 1 + tst/JSONTestSuite/y_object_with_newlines.json | 3 + .../y_string_1_2_3_bytes_UTF-8_sequences.json | 1 + .../y_string_accepted_surrogate_pair.json | 1 + .../y_string_accepted_surrogate_pairs.json | 1 + .../y_string_allowed_escapes.json | 1 + ...y_string_backslash_and_u_escaped_zero.json | 1 + .../y_string_backslash_doublequotes.json | 1 + tst/JSONTestSuite/y_string_comments.json | 1 + .../y_string_double_escape_a.json | 1 + .../y_string_double_escape_n.json | 1 + .../y_string_escaped_control_character.json | 1 + .../y_string_escaped_noncharacter.json | 1 + tst/JSONTestSuite/y_string_in_array.json | 1 + .../y_string_in_array_with_leading_space.json | 1 + .../y_string_last_surrogates_1_and_2.json | 1 + tst/JSONTestSuite/y_string_nbsp_uescaped.json | 1 + ...y_string_nonCharacterInUTF-8_U+10FFFF.json | 1 + .../y_string_nonCharacterInUTF-8_U+FFFF.json | 1 + tst/JSONTestSuite/y_string_null_escape.json | 1 + .../y_string_one-byte-utf-8.json | 1 + tst/JSONTestSuite/y_string_pi.json | 1 + ...ring_reservedCharacterInUTF-8_U+1BFFF.json | 1 + tst/JSONTestSuite/y_string_simple_ascii.json | 1 + tst/JSONTestSuite/y_string_space.json | 1 + ...rogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json | 1 + .../y_string_three-byte-utf-8.json | 1 + .../y_string_two-byte-utf-8.json | 1 + .../y_string_u+2028_line_sep.json | 1 + .../y_string_u+2029_par_sep.json | 1 + tst/JSONTestSuite/y_string_uEscape.json | 1 + .../y_string_uescaped_newline.json | 1 + .../y_string_unescaped_char_delete.json | 1 + tst/JSONTestSuite/y_string_unicode.json | 1 + .../y_string_unicodeEscapedBackslash.json | 1 + tst/JSONTestSuite/y_string_unicode_2.json | 1 + .../y_string_unicode_U+10FFFE_nonchar.json | 1 + .../y_string_unicode_U+1FFFE_nonchar.json | 1 + ...tring_unicode_U+200B_ZERO_WIDTH_SPACE.json | 1 + ..._string_unicode_U+2064_invisible_plus.json | 1 + .../y_string_unicode_U+FDD0_nonchar.json | 1 + .../y_string_unicode_U+FFFE_nonchar.json | 1 + ...y_string_unicode_escaped_double_quote.json | 1 + tst/JSONTestSuite/y_string_utf8.json | 1 + .../y_string_with_del_character.json | 1 + .../y_structure_lonely_false.json | 1 + tst/JSONTestSuite/y_structure_lonely_int.json | 1 + .../y_structure_lonely_negative_real.json | 1 + .../y_structure_lonely_null.json | 1 + .../y_structure_lonely_string.json | 1 + .../y_structure_lonely_true.json | 1 + .../y_structure_string_empty.json | 1 + .../y_structure_trailing_newline.json | 1 + .../y_structure_true_in_array.json | 1 + .../y_structure_whitespace_array.json | 1 + tst/jsontestsuite.g | 210 ++++++++++++++++++ tst/test_impl.tst | 47 ++++ tst/test_jsontestsuite.tst | 19 ++ tst/testall.g | 20 +- 322 files changed, 652 insertions(+), 2 deletions(-) create mode 100644 tst/JSONTestSuite/LICENSE create mode 100644 tst/JSONTestSuite/README create mode 100644 tst/JSONTestSuite/i_number_double_huge_neg_exp.json create mode 100644 tst/JSONTestSuite/i_number_huge_exp.json create mode 100644 tst/JSONTestSuite/i_number_neg_int_huge_exp.json create mode 100644 tst/JSONTestSuite/i_number_pos_double_huge_exp.json create mode 100644 tst/JSONTestSuite/i_number_real_neg_overflow.json create mode 100644 tst/JSONTestSuite/i_number_real_pos_overflow.json create mode 100644 tst/JSONTestSuite/i_number_real_underflow.json create mode 100644 tst/JSONTestSuite/i_number_too_big_neg_int.json create mode 100644 tst/JSONTestSuite/i_number_too_big_pos_int.json create mode 100644 tst/JSONTestSuite/i_number_very_big_negative_int.json create mode 100644 tst/JSONTestSuite/i_object_key_lone_2nd_surrogate.json create mode 100644 tst/JSONTestSuite/i_string_1st_surrogate_but_2nd_missing.json create mode 100644 tst/JSONTestSuite/i_string_1st_valid_surrogate_2nd_invalid.json create mode 100644 tst/JSONTestSuite/i_string_UTF-16LE_with_BOM.json create mode 100644 tst/JSONTestSuite/i_string_UTF-8_invalid_sequence.json create mode 100644 tst/JSONTestSuite/i_string_UTF8_surrogate_U+D800.json create mode 100644 tst/JSONTestSuite/i_string_incomplete_surrogate_and_escape_valid.json create mode 100644 tst/JSONTestSuite/i_string_incomplete_surrogate_pair.json create mode 100644 tst/JSONTestSuite/i_string_incomplete_surrogates_escape_valid.json create mode 100644 tst/JSONTestSuite/i_string_invalid_lonely_surrogate.json create mode 100644 tst/JSONTestSuite/i_string_invalid_surrogate.json create mode 100644 tst/JSONTestSuite/i_string_invalid_utf-8.json create mode 100644 tst/JSONTestSuite/i_string_inverted_surrogates_U+1D11E.json create mode 100644 tst/JSONTestSuite/i_string_iso_latin_1.json create mode 100644 tst/JSONTestSuite/i_string_lone_second_surrogate.json create mode 100644 tst/JSONTestSuite/i_string_lone_utf8_continuation_byte.json create mode 100644 tst/JSONTestSuite/i_string_not_in_unicode_range.json create mode 100644 tst/JSONTestSuite/i_string_overlong_sequence_2_bytes.json create mode 100644 tst/JSONTestSuite/i_string_overlong_sequence_6_bytes.json create mode 100644 tst/JSONTestSuite/i_string_overlong_sequence_6_bytes_null.json create mode 100644 tst/JSONTestSuite/i_string_truncated-utf-8.json create mode 100644 tst/JSONTestSuite/i_string_utf16BE_no_BOM.json create mode 100644 tst/JSONTestSuite/i_string_utf16LE_no_BOM.json create mode 100644 tst/JSONTestSuite/i_structure_500_nested_arrays.json create mode 100644 tst/JSONTestSuite/i_structure_UTF-8_BOM_empty_object.json create mode 100644 tst/JSONTestSuite/n_array_1_true_without_comma.json create mode 100644 tst/JSONTestSuite/n_array_a_invalid_utf8.json create mode 100644 tst/JSONTestSuite/n_array_colon_instead_of_comma.json create mode 100644 tst/JSONTestSuite/n_array_comma_after_close.json create mode 100644 tst/JSONTestSuite/n_array_comma_and_number.json create mode 100644 tst/JSONTestSuite/n_array_double_comma.json create mode 100644 tst/JSONTestSuite/n_array_double_extra_comma.json create mode 100644 tst/JSONTestSuite/n_array_extra_close.json create mode 100644 tst/JSONTestSuite/n_array_extra_comma.json create mode 100644 tst/JSONTestSuite/n_array_incomplete.json create mode 100644 tst/JSONTestSuite/n_array_incomplete_invalid_value.json create mode 100644 tst/JSONTestSuite/n_array_inner_array_no_comma.json create mode 100644 tst/JSONTestSuite/n_array_invalid_utf8.json create mode 100644 tst/JSONTestSuite/n_array_items_separated_by_semicolon.json create mode 100644 tst/JSONTestSuite/n_array_just_comma.json create mode 100644 tst/JSONTestSuite/n_array_just_minus.json create mode 100644 tst/JSONTestSuite/n_array_missing_value.json create mode 100644 tst/JSONTestSuite/n_array_newlines_unclosed.json create mode 100644 tst/JSONTestSuite/n_array_number_and_comma.json create mode 100644 tst/JSONTestSuite/n_array_number_and_several_commas.json create mode 100644 tst/JSONTestSuite/n_array_spaces_vertical_tab_formfeed.json create mode 100644 tst/JSONTestSuite/n_array_star_inside.json create mode 100644 tst/JSONTestSuite/n_array_unclosed.json create mode 100644 tst/JSONTestSuite/n_array_unclosed_trailing_comma.json create mode 100644 tst/JSONTestSuite/n_array_unclosed_with_new_lines.json create mode 100644 tst/JSONTestSuite/n_array_unclosed_with_object_inside.json create mode 100644 tst/JSONTestSuite/n_incomplete_false.json create mode 100644 tst/JSONTestSuite/n_incomplete_null.json create mode 100644 tst/JSONTestSuite/n_incomplete_true.json create mode 100644 tst/JSONTestSuite/n_multidigit_number_then_00.json create mode 100644 tst/JSONTestSuite/n_number_++.json create mode 100644 tst/JSONTestSuite/n_number_+1.json create mode 100644 tst/JSONTestSuite/n_number_+Inf.json create mode 100644 tst/JSONTestSuite/n_number_-01.json create mode 100644 tst/JSONTestSuite/n_number_-1.0..json create mode 100644 tst/JSONTestSuite/n_number_-2..json create mode 100644 tst/JSONTestSuite/n_number_-NaN.json create mode 100644 tst/JSONTestSuite/n_number_.-1.json create mode 100644 tst/JSONTestSuite/n_number_.2e-3.json create mode 100644 tst/JSONTestSuite/n_number_0.1.2.json create mode 100644 tst/JSONTestSuite/n_number_0.3e+.json create mode 100644 tst/JSONTestSuite/n_number_0.3e.json create mode 100644 tst/JSONTestSuite/n_number_0.e1.json create mode 100644 tst/JSONTestSuite/n_number_0_capital_E+.json create mode 100644 tst/JSONTestSuite/n_number_0_capital_E.json create mode 100644 tst/JSONTestSuite/n_number_0e+.json create mode 100644 tst/JSONTestSuite/n_number_0e.json create mode 100644 tst/JSONTestSuite/n_number_1.0e+.json create mode 100644 tst/JSONTestSuite/n_number_1.0e-.json create mode 100644 tst/JSONTestSuite/n_number_1.0e.json create mode 100644 tst/JSONTestSuite/n_number_1_000.json create mode 100644 tst/JSONTestSuite/n_number_1eE2.json create mode 100644 tst/JSONTestSuite/n_number_2.e+3.json create mode 100644 tst/JSONTestSuite/n_number_2.e-3.json create mode 100644 tst/JSONTestSuite/n_number_2.e3.json create mode 100644 tst/JSONTestSuite/n_number_9.e+.json create mode 100644 tst/JSONTestSuite/n_number_Inf.json create mode 100644 tst/JSONTestSuite/n_number_NaN.json create mode 100644 tst/JSONTestSuite/n_number_U+FF11_fullwidth_digit_one.json create mode 100644 tst/JSONTestSuite/n_number_expression.json create mode 100644 tst/JSONTestSuite/n_number_hex_1_digit.json create mode 100644 tst/JSONTestSuite/n_number_hex_2_digits.json create mode 100644 tst/JSONTestSuite/n_number_infinity.json create mode 100644 tst/JSONTestSuite/n_number_invalid+-.json create mode 100644 tst/JSONTestSuite/n_number_invalid-negative-real.json create mode 100644 tst/JSONTestSuite/n_number_invalid-utf-8-in-bigger-int.json create mode 100644 tst/JSONTestSuite/n_number_invalid-utf-8-in-exponent.json create mode 100644 tst/JSONTestSuite/n_number_invalid-utf-8-in-int.json create mode 100644 tst/JSONTestSuite/n_number_minus_infinity.json create mode 100644 tst/JSONTestSuite/n_number_minus_sign_with_trailing_garbage.json create mode 100644 tst/JSONTestSuite/n_number_minus_space_1.json create mode 100644 tst/JSONTestSuite/n_number_neg_int_starting_with_zero.json create mode 100644 tst/JSONTestSuite/n_number_neg_real_without_int_part.json create mode 100644 tst/JSONTestSuite/n_number_neg_with_garbage_at_end.json create mode 100644 tst/JSONTestSuite/n_number_real_garbage_after_e.json create mode 100644 tst/JSONTestSuite/n_number_real_with_invalid_utf8_after_e.json create mode 100644 tst/JSONTestSuite/n_number_real_without_fractional_part.json create mode 100644 tst/JSONTestSuite/n_number_starting_with_dot.json create mode 100644 tst/JSONTestSuite/n_number_with_alpha.json create mode 100644 tst/JSONTestSuite/n_number_with_alpha_char.json create mode 100644 tst/JSONTestSuite/n_number_with_leading_zero.json create mode 100644 tst/JSONTestSuite/n_object_bad_value.json create mode 100644 tst/JSONTestSuite/n_object_bracket_key.json create mode 100644 tst/JSONTestSuite/n_object_comma_instead_of_colon.json create mode 100644 tst/JSONTestSuite/n_object_double_colon.json create mode 100644 tst/JSONTestSuite/n_object_emoji.json create mode 100644 tst/JSONTestSuite/n_object_garbage_at_end.json create mode 100644 tst/JSONTestSuite/n_object_key_with_single_quotes.json create mode 100644 tst/JSONTestSuite/n_object_lone_continuation_byte_in_key_and_trailing_comma.json create mode 100644 tst/JSONTestSuite/n_object_missing_colon.json create mode 100644 tst/JSONTestSuite/n_object_missing_key.json create mode 100644 tst/JSONTestSuite/n_object_missing_semicolon.json create mode 100644 tst/JSONTestSuite/n_object_missing_value.json create mode 100644 tst/JSONTestSuite/n_object_no-colon.json create mode 100644 tst/JSONTestSuite/n_object_non_string_key.json create mode 100644 tst/JSONTestSuite/n_object_non_string_key_but_huge_number_instead.json create mode 100644 tst/JSONTestSuite/n_object_repeated_null_null.json create mode 100644 tst/JSONTestSuite/n_object_several_trailing_commas.json create mode 100644 tst/JSONTestSuite/n_object_single_quote.json create mode 100644 tst/JSONTestSuite/n_object_trailing_comma.json create mode 100644 tst/JSONTestSuite/n_object_trailing_comment.json create mode 100644 tst/JSONTestSuite/n_object_trailing_comment_open.json create mode 100644 tst/JSONTestSuite/n_object_trailing_comment_slash_open.json create mode 100644 tst/JSONTestSuite/n_object_trailing_comment_slash_open_incomplete.json create mode 100644 tst/JSONTestSuite/n_object_two_commas_in_a_row.json create mode 100644 tst/JSONTestSuite/n_object_unquoted_key.json create mode 100644 tst/JSONTestSuite/n_object_unterminated-value.json create mode 100644 tst/JSONTestSuite/n_object_with_single_string.json create mode 100644 tst/JSONTestSuite/n_object_with_trailing_garbage.json create mode 100644 tst/JSONTestSuite/n_single_space.json create mode 100644 tst/JSONTestSuite/n_string_1_surrogate_then_escape.json create mode 100644 tst/JSONTestSuite/n_string_1_surrogate_then_escape_u.json create mode 100644 tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1.json create mode 100644 tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1x.json create mode 100644 tst/JSONTestSuite/n_string_accentuated_char_no_quotes.json create mode 100644 tst/JSONTestSuite/n_string_backslash_00.json create mode 100644 tst/JSONTestSuite/n_string_escape_x.json create mode 100644 tst/JSONTestSuite/n_string_escaped_backslash_bad.json create mode 100644 tst/JSONTestSuite/n_string_escaped_ctrl_char_tab.json create mode 100644 tst/JSONTestSuite/n_string_escaped_emoji.json create mode 100644 tst/JSONTestSuite/n_string_incomplete_escape.json create mode 100644 tst/JSONTestSuite/n_string_incomplete_escaped_character.json create mode 100644 tst/JSONTestSuite/n_string_incomplete_surrogate.json create mode 100644 tst/JSONTestSuite/n_string_incomplete_surrogate_escape_invalid.json create mode 100644 tst/JSONTestSuite/n_string_invalid-utf-8-in-escape.json create mode 100644 tst/JSONTestSuite/n_string_invalid_backslash_esc.json create mode 100644 tst/JSONTestSuite/n_string_invalid_unicode_escape.json create mode 100644 tst/JSONTestSuite/n_string_invalid_utf8_after_escape.json create mode 100644 tst/JSONTestSuite/n_string_leading_uescaped_thinspace.json create mode 100644 tst/JSONTestSuite/n_string_no_quotes_with_bad_escape.json create mode 100644 tst/JSONTestSuite/n_string_single_doublequote.json create mode 100644 tst/JSONTestSuite/n_string_single_quote.json create mode 100644 tst/JSONTestSuite/n_string_single_string_no_double_quotes.json create mode 100644 tst/JSONTestSuite/n_string_start_escape_unclosed.json create mode 100644 tst/JSONTestSuite/n_string_unescaped_ctrl_char.json create mode 100644 tst/JSONTestSuite/n_string_unescaped_newline.json create mode 100644 tst/JSONTestSuite/n_string_unescaped_tab.json create mode 100644 tst/JSONTestSuite/n_string_unicode_CapitalU.json create mode 100644 tst/JSONTestSuite/n_string_with_trailing_garbage.json create mode 100644 tst/JSONTestSuite/n_structure_U+2060_word_joined.json create mode 100644 tst/JSONTestSuite/n_structure_UTF8_BOM_no_data.json create mode 100644 tst/JSONTestSuite/n_structure_angle_bracket_..json create mode 100644 tst/JSONTestSuite/n_structure_angle_bracket_null.json create mode 100644 tst/JSONTestSuite/n_structure_array_trailing_garbage.json create mode 100644 tst/JSONTestSuite/n_structure_array_with_extra_array_close.json create mode 100644 tst/JSONTestSuite/n_structure_array_with_unclosed_string.json create mode 100644 tst/JSONTestSuite/n_structure_ascii-unicode-identifier.json create mode 100644 tst/JSONTestSuite/n_structure_capitalized_True.json create mode 100644 tst/JSONTestSuite/n_structure_close_unopened_array.json create mode 100644 tst/JSONTestSuite/n_structure_comma_instead_of_closing_brace.json create mode 100644 tst/JSONTestSuite/n_structure_double_array.json create mode 100644 tst/JSONTestSuite/n_structure_end_array.json create mode 100644 tst/JSONTestSuite/n_structure_incomplete_UTF8_BOM.json create mode 100644 tst/JSONTestSuite/n_structure_lone-invalid-utf-8.json create mode 100644 tst/JSONTestSuite/n_structure_lone-open-bracket.json create mode 100644 tst/JSONTestSuite/n_structure_no_data.json create mode 100644 tst/JSONTestSuite/n_structure_null-byte-outside-string.json create mode 100644 tst/JSONTestSuite/n_structure_number_with_trailing_garbage.json create mode 100644 tst/JSONTestSuite/n_structure_object_followed_by_closing_object.json create mode 100644 tst/JSONTestSuite/n_structure_object_unclosed_no_value.json create mode 100644 tst/JSONTestSuite/n_structure_object_with_comment.json create mode 100644 tst/JSONTestSuite/n_structure_object_with_trailing_garbage.json create mode 100644 tst/JSONTestSuite/n_structure_open_array_apostrophe.json create mode 100644 tst/JSONTestSuite/n_structure_open_array_comma.json create mode 100644 tst/JSONTestSuite/n_structure_open_array_open_object.json create mode 100644 tst/JSONTestSuite/n_structure_open_array_open_string.json create mode 100644 tst/JSONTestSuite/n_structure_open_array_string.json create mode 100644 tst/JSONTestSuite/n_structure_open_object.json create mode 100644 tst/JSONTestSuite/n_structure_open_object_close_array.json create mode 100644 tst/JSONTestSuite/n_structure_open_object_comma.json create mode 100644 tst/JSONTestSuite/n_structure_open_object_open_array.json create mode 100644 tst/JSONTestSuite/n_structure_open_object_open_string.json create mode 100644 tst/JSONTestSuite/n_structure_open_object_string_with_apostrophes.json create mode 100644 tst/JSONTestSuite/n_structure_open_open.json create mode 100644 tst/JSONTestSuite/n_structure_single_eacute.json create mode 100644 tst/JSONTestSuite/n_structure_single_star.json create mode 100644 tst/JSONTestSuite/n_structure_trailing_#.json create mode 100644 tst/JSONTestSuite/n_structure_uescaped_LF_before_string.json create mode 100644 tst/JSONTestSuite/n_structure_unclosed_array.json create mode 100644 tst/JSONTestSuite/n_structure_unclosed_array_partial_null.json create mode 100644 tst/JSONTestSuite/n_structure_unclosed_array_unfinished_false.json create mode 100644 tst/JSONTestSuite/n_structure_unclosed_array_unfinished_true.json create mode 100644 tst/JSONTestSuite/n_structure_unclosed_object.json create mode 100644 tst/JSONTestSuite/n_structure_unicode-identifier.json create mode 100644 tst/JSONTestSuite/n_structure_whitespace_U+2060_word_joiner.json create mode 100644 tst/JSONTestSuite/n_structure_whitespace_formfeed.json create mode 100644 tst/JSONTestSuite/y_array_arraysWithSpaces.json create mode 100644 tst/JSONTestSuite/y_array_empty-string.json create mode 100644 tst/JSONTestSuite/y_array_empty.json create mode 100644 tst/JSONTestSuite/y_array_ending_with_newline.json create mode 100644 tst/JSONTestSuite/y_array_false.json create mode 100644 tst/JSONTestSuite/y_array_heterogeneous.json create mode 100644 tst/JSONTestSuite/y_array_null.json create mode 100644 tst/JSONTestSuite/y_array_with_1_and_newline.json create mode 100644 tst/JSONTestSuite/y_array_with_leading_space.json create mode 100644 tst/JSONTestSuite/y_array_with_several_null.json create mode 100644 tst/JSONTestSuite/y_array_with_trailing_space.json create mode 100644 tst/JSONTestSuite/y_number.json create mode 100644 tst/JSONTestSuite/y_number_0e+1.json create mode 100644 tst/JSONTestSuite/y_number_0e1.json create mode 100644 tst/JSONTestSuite/y_number_after_space.json create mode 100644 tst/JSONTestSuite/y_number_double_close_to_zero.json create mode 100644 tst/JSONTestSuite/y_number_int_with_exp.json create mode 100644 tst/JSONTestSuite/y_number_minus_zero.json create mode 100644 tst/JSONTestSuite/y_number_negative_int.json create mode 100644 tst/JSONTestSuite/y_number_negative_one.json create mode 100644 tst/JSONTestSuite/y_number_negative_zero.json create mode 100644 tst/JSONTestSuite/y_number_real_capital_e.json create mode 100644 tst/JSONTestSuite/y_number_real_capital_e_neg_exp.json create mode 100644 tst/JSONTestSuite/y_number_real_capital_e_pos_exp.json create mode 100644 tst/JSONTestSuite/y_number_real_exponent.json create mode 100644 tst/JSONTestSuite/y_number_real_fraction_exponent.json create mode 100644 tst/JSONTestSuite/y_number_real_neg_exp.json create mode 100644 tst/JSONTestSuite/y_number_real_pos_exponent.json create mode 100644 tst/JSONTestSuite/y_number_simple_int.json create mode 100644 tst/JSONTestSuite/y_number_simple_real.json create mode 100644 tst/JSONTestSuite/y_object.json create mode 100644 tst/JSONTestSuite/y_object_basic.json create mode 100644 tst/JSONTestSuite/y_object_duplicated_key.json create mode 100644 tst/JSONTestSuite/y_object_duplicated_key_and_value.json create mode 100644 tst/JSONTestSuite/y_object_empty.json create mode 100644 tst/JSONTestSuite/y_object_empty_key.json create mode 100644 tst/JSONTestSuite/y_object_escaped_null_in_key.json create mode 100644 tst/JSONTestSuite/y_object_extreme_numbers.json create mode 100644 tst/JSONTestSuite/y_object_long_strings.json create mode 100644 tst/JSONTestSuite/y_object_simple.json create mode 100644 tst/JSONTestSuite/y_object_string_unicode.json create mode 100644 tst/JSONTestSuite/y_object_with_newlines.json create mode 100644 tst/JSONTestSuite/y_string_1_2_3_bytes_UTF-8_sequences.json create mode 100644 tst/JSONTestSuite/y_string_accepted_surrogate_pair.json create mode 100644 tst/JSONTestSuite/y_string_accepted_surrogate_pairs.json create mode 100644 tst/JSONTestSuite/y_string_allowed_escapes.json create mode 100644 tst/JSONTestSuite/y_string_backslash_and_u_escaped_zero.json create mode 100644 tst/JSONTestSuite/y_string_backslash_doublequotes.json create mode 100644 tst/JSONTestSuite/y_string_comments.json create mode 100644 tst/JSONTestSuite/y_string_double_escape_a.json create mode 100644 tst/JSONTestSuite/y_string_double_escape_n.json create mode 100644 tst/JSONTestSuite/y_string_escaped_control_character.json create mode 100644 tst/JSONTestSuite/y_string_escaped_noncharacter.json create mode 100644 tst/JSONTestSuite/y_string_in_array.json create mode 100644 tst/JSONTestSuite/y_string_in_array_with_leading_space.json create mode 100644 tst/JSONTestSuite/y_string_last_surrogates_1_and_2.json create mode 100644 tst/JSONTestSuite/y_string_nbsp_uescaped.json create mode 100644 tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+10FFFF.json create mode 100644 tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+FFFF.json create mode 100644 tst/JSONTestSuite/y_string_null_escape.json create mode 100644 tst/JSONTestSuite/y_string_one-byte-utf-8.json create mode 100644 tst/JSONTestSuite/y_string_pi.json create mode 100644 tst/JSONTestSuite/y_string_reservedCharacterInUTF-8_U+1BFFF.json create mode 100644 tst/JSONTestSuite/y_string_simple_ascii.json create mode 100644 tst/JSONTestSuite/y_string_space.json create mode 100644 tst/JSONTestSuite/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json create mode 100644 tst/JSONTestSuite/y_string_three-byte-utf-8.json create mode 100644 tst/JSONTestSuite/y_string_two-byte-utf-8.json create mode 100644 tst/JSONTestSuite/y_string_u+2028_line_sep.json create mode 100644 tst/JSONTestSuite/y_string_u+2029_par_sep.json create mode 100644 tst/JSONTestSuite/y_string_uEscape.json create mode 100644 tst/JSONTestSuite/y_string_uescaped_newline.json create mode 100644 tst/JSONTestSuite/y_string_unescaped_char_delete.json create mode 100644 tst/JSONTestSuite/y_string_unicode.json create mode 100644 tst/JSONTestSuite/y_string_unicodeEscapedBackslash.json create mode 100644 tst/JSONTestSuite/y_string_unicode_2.json create mode 100644 tst/JSONTestSuite/y_string_unicode_U+10FFFE_nonchar.json create mode 100644 tst/JSONTestSuite/y_string_unicode_U+1FFFE_nonchar.json create mode 100644 tst/JSONTestSuite/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json create mode 100644 tst/JSONTestSuite/y_string_unicode_U+2064_invisible_plus.json create mode 100644 tst/JSONTestSuite/y_string_unicode_U+FDD0_nonchar.json create mode 100644 tst/JSONTestSuite/y_string_unicode_U+FFFE_nonchar.json create mode 100644 tst/JSONTestSuite/y_string_unicode_escaped_double_quote.json create mode 100644 tst/JSONTestSuite/y_string_utf8.json create mode 100644 tst/JSONTestSuite/y_string_with_del_character.json create mode 100644 tst/JSONTestSuite/y_structure_lonely_false.json create mode 100644 tst/JSONTestSuite/y_structure_lonely_int.json create mode 100644 tst/JSONTestSuite/y_structure_lonely_negative_real.json create mode 100644 tst/JSONTestSuite/y_structure_lonely_null.json create mode 100644 tst/JSONTestSuite/y_structure_lonely_string.json create mode 100644 tst/JSONTestSuite/y_structure_lonely_true.json create mode 100644 tst/JSONTestSuite/y_structure_string_empty.json create mode 100644 tst/JSONTestSuite/y_structure_trailing_newline.json create mode 100644 tst/JSONTestSuite/y_structure_true_in_array.json create mode 100644 tst/JSONTestSuite/y_structure_whitespace_array.json create mode 100644 tst/jsontestsuite.g create mode 100644 tst/test_impl.tst create mode 100644 tst/test_jsontestsuite.tst diff --git a/tst/JSONTestSuite/LICENSE b/tst/JSONTestSuite/LICENSE new file mode 100644 index 0000000..c4b3621 --- /dev/null +++ b/tst/JSONTestSuite/LICENSE @@ -0,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. diff --git a/tst/JSONTestSuite/README b/tst/JSONTestSuite/README new file mode 100644 index 0000000..26e49e2 --- /dev/null +++ b/tst/JSONTestSuite/README @@ -0,0 +1,21 @@ +JSONTestSuite +============= + +The .json files in this directory are the test_parsing corpus of + + https://github.com/nst/JSONTestSuite + commit 1ef36fa01286573e846ac449e8683f8833c5b26a (2024-11-22) + +copyright (c) 2016 Nicolas Seriot and distributed under the MIT license, see +the file LICENSE next to this one. + +Following the upstream convention, a file whose name starts with `y_` must be +accepted, one starting with `n_` must be rejected, and one starting with `i_` +may go either way. + +Two upstream files are omitted: n_structure_100000_opening_arrays.json and +n_structure_open_array_object.json nest 100000 levels deep, which overflows +the C stack and crashes GAP outright when the kernel extension is in use. + +tst/test_jsontestsuite.tst runs the corpus through whichever implementation is +active and compares the outcome against the table in tst/jsontestsuite.g. diff --git a/tst/JSONTestSuite/i_number_double_huge_neg_exp.json b/tst/JSONTestSuite/i_number_double_huge_neg_exp.json new file mode 100644 index 0000000..ae4c7b7 --- /dev/null +++ b/tst/JSONTestSuite/i_number_double_huge_neg_exp.json @@ -0,0 +1 @@ +[123.456e-789] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_huge_exp.json b/tst/JSONTestSuite/i_number_huge_exp.json new file mode 100644 index 0000000..9b5efa2 --- /dev/null +++ b/tst/JSONTestSuite/i_number_huge_exp.json @@ -0,0 +1 @@ +[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_neg_int_huge_exp.json b/tst/JSONTestSuite/i_number_neg_int_huge_exp.json new file mode 100644 index 0000000..3abd58a --- /dev/null +++ b/tst/JSONTestSuite/i_number_neg_int_huge_exp.json @@ -0,0 +1 @@ +[-1e+9999] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_pos_double_huge_exp.json b/tst/JSONTestSuite/i_number_pos_double_huge_exp.json new file mode 100644 index 0000000..e10a7eb --- /dev/null +++ b/tst/JSONTestSuite/i_number_pos_double_huge_exp.json @@ -0,0 +1 @@ +[1.5e+9999] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_real_neg_overflow.json b/tst/JSONTestSuite/i_number_real_neg_overflow.json new file mode 100644 index 0000000..3d628a9 --- /dev/null +++ b/tst/JSONTestSuite/i_number_real_neg_overflow.json @@ -0,0 +1 @@ +[-123123e100000] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_real_pos_overflow.json b/tst/JSONTestSuite/i_number_real_pos_overflow.json new file mode 100644 index 0000000..54d7d3d --- /dev/null +++ b/tst/JSONTestSuite/i_number_real_pos_overflow.json @@ -0,0 +1 @@ +[123123e100000] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_real_underflow.json b/tst/JSONTestSuite/i_number_real_underflow.json new file mode 100644 index 0000000..c5236eb --- /dev/null +++ b/tst/JSONTestSuite/i_number_real_underflow.json @@ -0,0 +1 @@ +[123e-10000000] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_too_big_neg_int.json b/tst/JSONTestSuite/i_number_too_big_neg_int.json new file mode 100644 index 0000000..dfa3846 --- /dev/null +++ b/tst/JSONTestSuite/i_number_too_big_neg_int.json @@ -0,0 +1 @@ +[-123123123123123123123123123123] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_too_big_pos_int.json b/tst/JSONTestSuite/i_number_too_big_pos_int.json new file mode 100644 index 0000000..338a8c3 --- /dev/null +++ b/tst/JSONTestSuite/i_number_too_big_pos_int.json @@ -0,0 +1 @@ +[100000000000000000000] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_number_very_big_negative_int.json b/tst/JSONTestSuite/i_number_very_big_negative_int.json new file mode 100644 index 0000000..e2d9738 --- /dev/null +++ b/tst/JSONTestSuite/i_number_very_big_negative_int.json @@ -0,0 +1 @@ +[-237462374673276894279832749832423479823246327846] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_object_key_lone_2nd_surrogate.json b/tst/JSONTestSuite/i_object_key_lone_2nd_surrogate.json new file mode 100644 index 0000000..5be7eba --- /dev/null +++ b/tst/JSONTestSuite/i_object_key_lone_2nd_surrogate.json @@ -0,0 +1 @@ +{"\uDFAA":0} \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_1st_surrogate_but_2nd_missing.json b/tst/JSONTestSuite/i_string_1st_surrogate_but_2nd_missing.json new file mode 100644 index 0000000..3b9e37c --- /dev/null +++ b/tst/JSONTestSuite/i_string_1st_surrogate_but_2nd_missing.json @@ -0,0 +1 @@ +["\uDADA"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_1st_valid_surrogate_2nd_invalid.json b/tst/JSONTestSuite/i_string_1st_valid_surrogate_2nd_invalid.json new file mode 100644 index 0000000..4875928 --- /dev/null +++ b/tst/JSONTestSuite/i_string_1st_valid_surrogate_2nd_invalid.json @@ -0,0 +1 @@ +["\uD888\u1234"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_UTF-16LE_with_BOM.json b/tst/JSONTestSuite/i_string_UTF-16LE_with_BOM.json new file mode 100644 index 0000000000000000000000000000000000000000..2a79c0629a49133d8f715bddbef19cfb3ef025bd GIT binary patch literal 12 ScmezWFPcG#;Uy5qG5`P~Km+3d literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/i_string_UTF-8_invalid_sequence.json b/tst/JSONTestSuite/i_string_UTF-8_invalid_sequence.json new file mode 100644 index 0000000..e2a968a --- /dev/null +++ b/tst/JSONTestSuite/i_string_UTF-8_invalid_sequence.json @@ -0,0 +1 @@ +["日шú"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_UTF8_surrogate_U+D800.json b/tst/JSONTestSuite/i_string_UTF8_surrogate_U+D800.json new file mode 100644 index 0000000..916bff9 --- /dev/null +++ b/tst/JSONTestSuite/i_string_UTF8_surrogate_U+D800.json @@ -0,0 +1 @@ +["í €"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_incomplete_surrogate_and_escape_valid.json b/tst/JSONTestSuite/i_string_incomplete_surrogate_and_escape_valid.json new file mode 100644 index 0000000..3cb11d2 --- /dev/null +++ b/tst/JSONTestSuite/i_string_incomplete_surrogate_and_escape_valid.json @@ -0,0 +1 @@ +["\uD800\n"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_incomplete_surrogate_pair.json b/tst/JSONTestSuite/i_string_incomplete_surrogate_pair.json new file mode 100644 index 0000000..38ec23b --- /dev/null +++ b/tst/JSONTestSuite/i_string_incomplete_surrogate_pair.json @@ -0,0 +1 @@ +["\uDd1ea"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_incomplete_surrogates_escape_valid.json b/tst/JSONTestSuite/i_string_incomplete_surrogates_escape_valid.json new file mode 100644 index 0000000..c9cd6f6 --- /dev/null +++ b/tst/JSONTestSuite/i_string_incomplete_surrogates_escape_valid.json @@ -0,0 +1 @@ +["\uD800\uD800\n"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_invalid_lonely_surrogate.json b/tst/JSONTestSuite/i_string_invalid_lonely_surrogate.json new file mode 100644 index 0000000..3abbd8d --- /dev/null +++ b/tst/JSONTestSuite/i_string_invalid_lonely_surrogate.json @@ -0,0 +1 @@ +["\ud800"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_invalid_surrogate.json b/tst/JSONTestSuite/i_string_invalid_surrogate.json new file mode 100644 index 0000000..ffddc04 --- /dev/null +++ b/tst/JSONTestSuite/i_string_invalid_surrogate.json @@ -0,0 +1 @@ +["\ud800abc"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_invalid_utf-8.json b/tst/JSONTestSuite/i_string_invalid_utf-8.json new file mode 100644 index 0000000..8e45a7e --- /dev/null +++ b/tst/JSONTestSuite/i_string_invalid_utf-8.json @@ -0,0 +1 @@ +["ÿ"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_inverted_surrogates_U+1D11E.json b/tst/JSONTestSuite/i_string_inverted_surrogates_U+1D11E.json new file mode 100644 index 0000000..0d5456c --- /dev/null +++ b/tst/JSONTestSuite/i_string_inverted_surrogates_U+1D11E.json @@ -0,0 +1 @@ +["\uDd1e\uD834"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_iso_latin_1.json b/tst/JSONTestSuite/i_string_iso_latin_1.json new file mode 100644 index 0000000..9389c98 --- /dev/null +++ b/tst/JSONTestSuite/i_string_iso_latin_1.json @@ -0,0 +1 @@ +["é"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_lone_second_surrogate.json b/tst/JSONTestSuite/i_string_lone_second_surrogate.json new file mode 100644 index 0000000..1dbd397 --- /dev/null +++ b/tst/JSONTestSuite/i_string_lone_second_surrogate.json @@ -0,0 +1 @@ +["\uDFAA"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_lone_utf8_continuation_byte.json b/tst/JSONTestSuite/i_string_lone_utf8_continuation_byte.json new file mode 100644 index 0000000..729337c --- /dev/null +++ b/tst/JSONTestSuite/i_string_lone_utf8_continuation_byte.json @@ -0,0 +1 @@ +["�"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_not_in_unicode_range.json b/tst/JSONTestSuite/i_string_not_in_unicode_range.json new file mode 100644 index 0000000..df90a29 --- /dev/null +++ b/tst/JSONTestSuite/i_string_not_in_unicode_range.json @@ -0,0 +1 @@ +["ô¿¿¿"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_overlong_sequence_2_bytes.json b/tst/JSONTestSuite/i_string_overlong_sequence_2_bytes.json new file mode 100644 index 0000000..c8cee5e --- /dev/null +++ b/tst/JSONTestSuite/i_string_overlong_sequence_2_bytes.json @@ -0,0 +1 @@ +["À¯"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_overlong_sequence_6_bytes.json b/tst/JSONTestSuite/i_string_overlong_sequence_6_bytes.json new file mode 100644 index 0000000..9a91da7 --- /dev/null +++ b/tst/JSONTestSuite/i_string_overlong_sequence_6_bytes.json @@ -0,0 +1 @@ +["üƒ¿¿¿¿"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_overlong_sequence_6_bytes_null.json b/tst/JSONTestSuite/i_string_overlong_sequence_6_bytes_null.json new file mode 100644 index 0000000..d24fffd --- /dev/null +++ b/tst/JSONTestSuite/i_string_overlong_sequence_6_bytes_null.json @@ -0,0 +1 @@ +["ü€€€€€"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_truncated-utf-8.json b/tst/JSONTestSuite/i_string_truncated-utf-8.json new file mode 100644 index 0000000..63c7777 --- /dev/null +++ b/tst/JSONTestSuite/i_string_truncated-utf-8.json @@ -0,0 +1 @@ +["àÿ"] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_string_utf16BE_no_BOM.json b/tst/JSONTestSuite/i_string_utf16BE_no_BOM.json new file mode 100644 index 0000000000000000000000000000000000000000..57e5392ff6309134268c7e3ec2a9289b99ff7148 GIT binary patch literal 10 PcmZRGW>8{y3B<7g33~zN literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/i_string_utf16LE_no_BOM.json b/tst/JSONTestSuite/i_string_utf16LE_no_BOM.json new file mode 100644 index 0000000000000000000000000000000000000000..c49c1b25d8e5819591993d4d45e4649a46c1b3e0 GIT binary patch literal 10 Pcma!MP-1uq#IXzj3t$1} literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/i_structure_500_nested_arrays.json b/tst/JSONTestSuite/i_structure_500_nested_arrays.json new file mode 100644 index 0000000..7118405 --- /dev/null +++ b/tst/JSONTestSuite/i_structure_500_nested_arrays.json @@ -0,0 +1 @@ +[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] \ No newline at end of file diff --git a/tst/JSONTestSuite/i_structure_UTF-8_BOM_empty_object.json b/tst/JSONTestSuite/i_structure_UTF-8_BOM_empty_object.json new file mode 100644 index 0000000..22fdca1 --- /dev/null +++ b/tst/JSONTestSuite/i_structure_UTF-8_BOM_empty_object.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_1_true_without_comma.json b/tst/JSONTestSuite/n_array_1_true_without_comma.json new file mode 100644 index 0000000..c14e3f6 --- /dev/null +++ b/tst/JSONTestSuite/n_array_1_true_without_comma.json @@ -0,0 +1 @@ +[1 true] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_a_invalid_utf8.json b/tst/JSONTestSuite/n_array_a_invalid_utf8.json new file mode 100644 index 0000000..38a86e2 --- /dev/null +++ b/tst/JSONTestSuite/n_array_a_invalid_utf8.json @@ -0,0 +1 @@ +[aå] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_colon_instead_of_comma.json b/tst/JSONTestSuite/n_array_colon_instead_of_comma.json new file mode 100644 index 0000000..0d02ad4 --- /dev/null +++ b/tst/JSONTestSuite/n_array_colon_instead_of_comma.json @@ -0,0 +1 @@ +["": 1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_comma_after_close.json b/tst/JSONTestSuite/n_array_comma_after_close.json new file mode 100644 index 0000000..2ccba8d --- /dev/null +++ b/tst/JSONTestSuite/n_array_comma_after_close.json @@ -0,0 +1 @@ +[""], \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_comma_and_number.json b/tst/JSONTestSuite/n_array_comma_and_number.json new file mode 100644 index 0000000..d2c84e3 --- /dev/null +++ b/tst/JSONTestSuite/n_array_comma_and_number.json @@ -0,0 +1 @@ +[,1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_double_comma.json b/tst/JSONTestSuite/n_array_double_comma.json new file mode 100644 index 0000000..0431712 --- /dev/null +++ b/tst/JSONTestSuite/n_array_double_comma.json @@ -0,0 +1 @@ +[1,,2] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_double_extra_comma.json b/tst/JSONTestSuite/n_array_double_extra_comma.json new file mode 100644 index 0000000..3f01d31 --- /dev/null +++ b/tst/JSONTestSuite/n_array_double_extra_comma.json @@ -0,0 +1 @@ +["x",,] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_extra_close.json b/tst/JSONTestSuite/n_array_extra_close.json new file mode 100644 index 0000000..c12f9fa --- /dev/null +++ b/tst/JSONTestSuite/n_array_extra_close.json @@ -0,0 +1 @@ +["x"]] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_extra_comma.json b/tst/JSONTestSuite/n_array_extra_comma.json new file mode 100644 index 0000000..5f8ce18 --- /dev/null +++ b/tst/JSONTestSuite/n_array_extra_comma.json @@ -0,0 +1 @@ +["",] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_incomplete.json b/tst/JSONTestSuite/n_array_incomplete.json new file mode 100644 index 0000000..cc65b0b --- /dev/null +++ b/tst/JSONTestSuite/n_array_incomplete.json @@ -0,0 +1 @@ +["x" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_incomplete_invalid_value.json b/tst/JSONTestSuite/n_array_incomplete_invalid_value.json new file mode 100644 index 0000000..c21a8f6 --- /dev/null +++ b/tst/JSONTestSuite/n_array_incomplete_invalid_value.json @@ -0,0 +1 @@ +[x \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_inner_array_no_comma.json b/tst/JSONTestSuite/n_array_inner_array_no_comma.json new file mode 100644 index 0000000..c70b716 --- /dev/null +++ b/tst/JSONTestSuite/n_array_inner_array_no_comma.json @@ -0,0 +1 @@ +[3[4]] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_invalid_utf8.json b/tst/JSONTestSuite/n_array_invalid_utf8.json new file mode 100644 index 0000000..6099d34 --- /dev/null +++ b/tst/JSONTestSuite/n_array_invalid_utf8.json @@ -0,0 +1 @@ +[ÿ] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_items_separated_by_semicolon.json b/tst/JSONTestSuite/n_array_items_separated_by_semicolon.json new file mode 100644 index 0000000..d4bd731 --- /dev/null +++ b/tst/JSONTestSuite/n_array_items_separated_by_semicolon.json @@ -0,0 +1 @@ +[1:2] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_just_comma.json b/tst/JSONTestSuite/n_array_just_comma.json new file mode 100644 index 0000000..9d7077c --- /dev/null +++ b/tst/JSONTestSuite/n_array_just_comma.json @@ -0,0 +1 @@ +[,] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_just_minus.json b/tst/JSONTestSuite/n_array_just_minus.json new file mode 100644 index 0000000..29501c6 --- /dev/null +++ b/tst/JSONTestSuite/n_array_just_minus.json @@ -0,0 +1 @@ +[-] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_missing_value.json b/tst/JSONTestSuite/n_array_missing_value.json new file mode 100644 index 0000000..3a6ba86 --- /dev/null +++ b/tst/JSONTestSuite/n_array_missing_value.json @@ -0,0 +1 @@ +[ , ""] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_newlines_unclosed.json b/tst/JSONTestSuite/n_array_newlines_unclosed.json new file mode 100644 index 0000000..6466800 --- /dev/null +++ b/tst/JSONTestSuite/n_array_newlines_unclosed.json @@ -0,0 +1,3 @@ +["a", +4 +,1, \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_number_and_comma.json b/tst/JSONTestSuite/n_array_number_and_comma.json new file mode 100644 index 0000000..13f6f1d --- /dev/null +++ b/tst/JSONTestSuite/n_array_number_and_comma.json @@ -0,0 +1 @@ +[1,] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_number_and_several_commas.json b/tst/JSONTestSuite/n_array_number_and_several_commas.json new file mode 100644 index 0000000..0ac408c --- /dev/null +++ b/tst/JSONTestSuite/n_array_number_and_several_commas.json @@ -0,0 +1 @@ +[1,,] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_spaces_vertical_tab_formfeed.json b/tst/JSONTestSuite/n_array_spaces_vertical_tab_formfeed.json new file mode 100644 index 0000000..6cd7cf5 --- /dev/null +++ b/tst/JSONTestSuite/n_array_spaces_vertical_tab_formfeed.json @@ -0,0 +1 @@ +[" a"\f] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_star_inside.json b/tst/JSONTestSuite/n_array_star_inside.json new file mode 100644 index 0000000..5a51946 --- /dev/null +++ b/tst/JSONTestSuite/n_array_star_inside.json @@ -0,0 +1 @@ +[*] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_unclosed.json b/tst/JSONTestSuite/n_array_unclosed.json new file mode 100644 index 0000000..0607330 --- /dev/null +++ b/tst/JSONTestSuite/n_array_unclosed.json @@ -0,0 +1 @@ +["" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_unclosed_trailing_comma.json b/tst/JSONTestSuite/n_array_unclosed_trailing_comma.json new file mode 100644 index 0000000..6604698 --- /dev/null +++ b/tst/JSONTestSuite/n_array_unclosed_trailing_comma.json @@ -0,0 +1 @@ +[1, \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_unclosed_with_new_lines.json b/tst/JSONTestSuite/n_array_unclosed_with_new_lines.json new file mode 100644 index 0000000..4f61de3 --- /dev/null +++ b/tst/JSONTestSuite/n_array_unclosed_with_new_lines.json @@ -0,0 +1,3 @@ +[1, +1 +,1 \ No newline at end of file diff --git a/tst/JSONTestSuite/n_array_unclosed_with_object_inside.json b/tst/JSONTestSuite/n_array_unclosed_with_object_inside.json new file mode 100644 index 0000000..043a87e --- /dev/null +++ b/tst/JSONTestSuite/n_array_unclosed_with_object_inside.json @@ -0,0 +1 @@ +[{} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_incomplete_false.json b/tst/JSONTestSuite/n_incomplete_false.json new file mode 100644 index 0000000..eb18c6a --- /dev/null +++ b/tst/JSONTestSuite/n_incomplete_false.json @@ -0,0 +1 @@ +[fals] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_incomplete_null.json b/tst/JSONTestSuite/n_incomplete_null.json new file mode 100644 index 0000000..c18ef53 --- /dev/null +++ b/tst/JSONTestSuite/n_incomplete_null.json @@ -0,0 +1 @@ +[nul] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_incomplete_true.json b/tst/JSONTestSuite/n_incomplete_true.json new file mode 100644 index 0000000..f451ac6 --- /dev/null +++ b/tst/JSONTestSuite/n_incomplete_true.json @@ -0,0 +1 @@ +[tru] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_multidigit_number_then_00.json b/tst/JSONTestSuite/n_multidigit_number_then_00.json new file mode 100644 index 0000000000000000000000000000000000000000..c22507b864f7f089c91c1eb85b1b15cc63b943a6 GIT binary patch literal 4 LcmXpsGG+h(0mJ~8 literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/n_number_++.json b/tst/JSONTestSuite/n_number_++.json new file mode 100644 index 0000000..bdb62aa --- /dev/null +++ b/tst/JSONTestSuite/n_number_++.json @@ -0,0 +1 @@ +[++1234] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_+1.json b/tst/JSONTestSuite/n_number_+1.json new file mode 100644 index 0000000..3cbe58c --- /dev/null +++ b/tst/JSONTestSuite/n_number_+1.json @@ -0,0 +1 @@ +[+1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_+Inf.json b/tst/JSONTestSuite/n_number_+Inf.json new file mode 100644 index 0000000..871ae14 --- /dev/null +++ b/tst/JSONTestSuite/n_number_+Inf.json @@ -0,0 +1 @@ +[+Inf] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_-01.json b/tst/JSONTestSuite/n_number_-01.json new file mode 100644 index 0000000..0df32ba --- /dev/null +++ b/tst/JSONTestSuite/n_number_-01.json @@ -0,0 +1 @@ +[-01] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_-1.0..json b/tst/JSONTestSuite/n_number_-1.0..json new file mode 100644 index 0000000..7cf55a8 --- /dev/null +++ b/tst/JSONTestSuite/n_number_-1.0..json @@ -0,0 +1 @@ +[-1.0.] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_-2..json b/tst/JSONTestSuite/n_number_-2..json new file mode 100644 index 0000000..9be8436 --- /dev/null +++ b/tst/JSONTestSuite/n_number_-2..json @@ -0,0 +1 @@ +[-2.] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_-NaN.json b/tst/JSONTestSuite/n_number_-NaN.json new file mode 100644 index 0000000..f61615d --- /dev/null +++ b/tst/JSONTestSuite/n_number_-NaN.json @@ -0,0 +1 @@ +[-NaN] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_.-1.json b/tst/JSONTestSuite/n_number_.-1.json new file mode 100644 index 0000000..1c9f2dd --- /dev/null +++ b/tst/JSONTestSuite/n_number_.-1.json @@ -0,0 +1 @@ +[.-1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_.2e-3.json b/tst/JSONTestSuite/n_number_.2e-3.json new file mode 100644 index 0000000..c6c976f --- /dev/null +++ b/tst/JSONTestSuite/n_number_.2e-3.json @@ -0,0 +1 @@ +[.2e-3] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0.1.2.json b/tst/JSONTestSuite/n_number_0.1.2.json new file mode 100644 index 0000000..c83a256 --- /dev/null +++ b/tst/JSONTestSuite/n_number_0.1.2.json @@ -0,0 +1 @@ +[0.1.2] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0.3e+.json b/tst/JSONTestSuite/n_number_0.3e+.json new file mode 100644 index 0000000..a55a1bf --- /dev/null +++ b/tst/JSONTestSuite/n_number_0.3e+.json @@ -0,0 +1 @@ +[0.3e+] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0.3e.json b/tst/JSONTestSuite/n_number_0.3e.json new file mode 100644 index 0000000..3dd5df4 --- /dev/null +++ b/tst/JSONTestSuite/n_number_0.3e.json @@ -0,0 +1 @@ +[0.3e] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0.e1.json b/tst/JSONTestSuite/n_number_0.e1.json new file mode 100644 index 0000000..c92c71c --- /dev/null +++ b/tst/JSONTestSuite/n_number_0.e1.json @@ -0,0 +1 @@ +[0.e1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0_capital_E+.json b/tst/JSONTestSuite/n_number_0_capital_E+.json new file mode 100644 index 0000000..3ba2c7d --- /dev/null +++ b/tst/JSONTestSuite/n_number_0_capital_E+.json @@ -0,0 +1 @@ +[0E+] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0_capital_E.json b/tst/JSONTestSuite/n_number_0_capital_E.json new file mode 100644 index 0000000..5301840 --- /dev/null +++ b/tst/JSONTestSuite/n_number_0_capital_E.json @@ -0,0 +1 @@ +[0E] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0e+.json b/tst/JSONTestSuite/n_number_0e+.json new file mode 100644 index 0000000..8ab0bc4 --- /dev/null +++ b/tst/JSONTestSuite/n_number_0e+.json @@ -0,0 +1 @@ +[0e+] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_0e.json b/tst/JSONTestSuite/n_number_0e.json new file mode 100644 index 0000000..47ec421 --- /dev/null +++ b/tst/JSONTestSuite/n_number_0e.json @@ -0,0 +1 @@ +[0e] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_1.0e+.json b/tst/JSONTestSuite/n_number_1.0e+.json new file mode 100644 index 0000000..cd84b9f --- /dev/null +++ b/tst/JSONTestSuite/n_number_1.0e+.json @@ -0,0 +1 @@ +[1.0e+] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_1.0e-.json b/tst/JSONTestSuite/n_number_1.0e-.json new file mode 100644 index 0000000..4eb7afa --- /dev/null +++ b/tst/JSONTestSuite/n_number_1.0e-.json @@ -0,0 +1 @@ +[1.0e-] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_1.0e.json b/tst/JSONTestSuite/n_number_1.0e.json new file mode 100644 index 0000000..21753f4 --- /dev/null +++ b/tst/JSONTestSuite/n_number_1.0e.json @@ -0,0 +1 @@ +[1.0e] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_1_000.json b/tst/JSONTestSuite/n_number_1_000.json new file mode 100644 index 0000000..7b18b66 --- /dev/null +++ b/tst/JSONTestSuite/n_number_1_000.json @@ -0,0 +1 @@ +[1 000.0] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_1eE2.json b/tst/JSONTestSuite/n_number_1eE2.json new file mode 100644 index 0000000..4318a34 --- /dev/null +++ b/tst/JSONTestSuite/n_number_1eE2.json @@ -0,0 +1 @@ +[1eE2] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_2.e+3.json b/tst/JSONTestSuite/n_number_2.e+3.json new file mode 100644 index 0000000..4442f39 --- /dev/null +++ b/tst/JSONTestSuite/n_number_2.e+3.json @@ -0,0 +1 @@ +[2.e+3] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_2.e-3.json b/tst/JSONTestSuite/n_number_2.e-3.json new file mode 100644 index 0000000..a65060e --- /dev/null +++ b/tst/JSONTestSuite/n_number_2.e-3.json @@ -0,0 +1 @@ +[2.e-3] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_2.e3.json b/tst/JSONTestSuite/n_number_2.e3.json new file mode 100644 index 0000000..66f7cf7 --- /dev/null +++ b/tst/JSONTestSuite/n_number_2.e3.json @@ -0,0 +1 @@ +[2.e3] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_9.e+.json b/tst/JSONTestSuite/n_number_9.e+.json new file mode 100644 index 0000000..732a7b1 --- /dev/null +++ b/tst/JSONTestSuite/n_number_9.e+.json @@ -0,0 +1 @@ +[9.e+] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_Inf.json b/tst/JSONTestSuite/n_number_Inf.json new file mode 100644 index 0000000..c40c734 --- /dev/null +++ b/tst/JSONTestSuite/n_number_Inf.json @@ -0,0 +1 @@ +[Inf] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_NaN.json b/tst/JSONTestSuite/n_number_NaN.json new file mode 100644 index 0000000..4992317 --- /dev/null +++ b/tst/JSONTestSuite/n_number_NaN.json @@ -0,0 +1 @@ +[NaN] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_U+FF11_fullwidth_digit_one.json b/tst/JSONTestSuite/n_number_U+FF11_fullwidth_digit_one.json new file mode 100644 index 0000000..b14587e --- /dev/null +++ b/tst/JSONTestSuite/n_number_U+FF11_fullwidth_digit_one.json @@ -0,0 +1 @@ +[1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_expression.json b/tst/JSONTestSuite/n_number_expression.json new file mode 100644 index 0000000..76fdbc8 --- /dev/null +++ b/tst/JSONTestSuite/n_number_expression.json @@ -0,0 +1 @@ +[1+2] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_hex_1_digit.json b/tst/JSONTestSuite/n_number_hex_1_digit.json new file mode 100644 index 0000000..3b21488 --- /dev/null +++ b/tst/JSONTestSuite/n_number_hex_1_digit.json @@ -0,0 +1 @@ +[0x1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_hex_2_digits.json b/tst/JSONTestSuite/n_number_hex_2_digits.json new file mode 100644 index 0000000..83e516a --- /dev/null +++ b/tst/JSONTestSuite/n_number_hex_2_digits.json @@ -0,0 +1 @@ +[0x42] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_infinity.json b/tst/JSONTestSuite/n_number_infinity.json new file mode 100644 index 0000000..8c2baf7 --- /dev/null +++ b/tst/JSONTestSuite/n_number_infinity.json @@ -0,0 +1 @@ +[Infinity] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_invalid+-.json b/tst/JSONTestSuite/n_number_invalid+-.json new file mode 100644 index 0000000..1cce602 --- /dev/null +++ b/tst/JSONTestSuite/n_number_invalid+-.json @@ -0,0 +1 @@ +[0e+-1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_invalid-negative-real.json b/tst/JSONTestSuite/n_number_invalid-negative-real.json new file mode 100644 index 0000000..5fc3c1e --- /dev/null +++ b/tst/JSONTestSuite/n_number_invalid-negative-real.json @@ -0,0 +1 @@ +[-123.123foo] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_invalid-utf-8-in-bigger-int.json b/tst/JSONTestSuite/n_number_invalid-utf-8-in-bigger-int.json new file mode 100644 index 0000000..3b97e58 --- /dev/null +++ b/tst/JSONTestSuite/n_number_invalid-utf-8-in-bigger-int.json @@ -0,0 +1 @@ +[123å] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_invalid-utf-8-in-exponent.json b/tst/JSONTestSuite/n_number_invalid-utf-8-in-exponent.json new file mode 100644 index 0000000..ea35d72 --- /dev/null +++ b/tst/JSONTestSuite/n_number_invalid-utf-8-in-exponent.json @@ -0,0 +1 @@ +[1e1å] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_invalid-utf-8-in-int.json b/tst/JSONTestSuite/n_number_invalid-utf-8-in-int.json new file mode 100644 index 0000000..371226e --- /dev/null +++ b/tst/JSONTestSuite/n_number_invalid-utf-8-in-int.json @@ -0,0 +1 @@ +[0å] diff --git a/tst/JSONTestSuite/n_number_minus_infinity.json b/tst/JSONTestSuite/n_number_minus_infinity.json new file mode 100644 index 0000000..cf4133d --- /dev/null +++ b/tst/JSONTestSuite/n_number_minus_infinity.json @@ -0,0 +1 @@ +[-Infinity] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_minus_sign_with_trailing_garbage.json b/tst/JSONTestSuite/n_number_minus_sign_with_trailing_garbage.json new file mode 100644 index 0000000..a6d8e78 --- /dev/null +++ b/tst/JSONTestSuite/n_number_minus_sign_with_trailing_garbage.json @@ -0,0 +1 @@ +[-foo] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_minus_space_1.json b/tst/JSONTestSuite/n_number_minus_space_1.json new file mode 100644 index 0000000..9a5ebed --- /dev/null +++ b/tst/JSONTestSuite/n_number_minus_space_1.json @@ -0,0 +1 @@ +[- 1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_neg_int_starting_with_zero.json b/tst/JSONTestSuite/n_number_neg_int_starting_with_zero.json new file mode 100644 index 0000000..67af096 --- /dev/null +++ b/tst/JSONTestSuite/n_number_neg_int_starting_with_zero.json @@ -0,0 +1 @@ +[-012] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_neg_real_without_int_part.json b/tst/JSONTestSuite/n_number_neg_real_without_int_part.json new file mode 100644 index 0000000..1f2a434 --- /dev/null +++ b/tst/JSONTestSuite/n_number_neg_real_without_int_part.json @@ -0,0 +1 @@ +[-.123] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_neg_with_garbage_at_end.json b/tst/JSONTestSuite/n_number_neg_with_garbage_at_end.json new file mode 100644 index 0000000..2aa7311 --- /dev/null +++ b/tst/JSONTestSuite/n_number_neg_with_garbage_at_end.json @@ -0,0 +1 @@ +[-1x] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_real_garbage_after_e.json b/tst/JSONTestSuite/n_number_real_garbage_after_e.json new file mode 100644 index 0000000..9213dfc --- /dev/null +++ b/tst/JSONTestSuite/n_number_real_garbage_after_e.json @@ -0,0 +1 @@ +[1ea] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_real_with_invalid_utf8_after_e.json b/tst/JSONTestSuite/n_number_real_with_invalid_utf8_after_e.json new file mode 100644 index 0000000..1e52ef9 --- /dev/null +++ b/tst/JSONTestSuite/n_number_real_with_invalid_utf8_after_e.json @@ -0,0 +1 @@ +[1eå] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_real_without_fractional_part.json b/tst/JSONTestSuite/n_number_real_without_fractional_part.json new file mode 100644 index 0000000..1de287c --- /dev/null +++ b/tst/JSONTestSuite/n_number_real_without_fractional_part.json @@ -0,0 +1 @@ +[1.] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_starting_with_dot.json b/tst/JSONTestSuite/n_number_starting_with_dot.json new file mode 100644 index 0000000..f682dbd --- /dev/null +++ b/tst/JSONTestSuite/n_number_starting_with_dot.json @@ -0,0 +1 @@ +[.123] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_with_alpha.json b/tst/JSONTestSuite/n_number_with_alpha.json new file mode 100644 index 0000000..1e42d81 --- /dev/null +++ b/tst/JSONTestSuite/n_number_with_alpha.json @@ -0,0 +1 @@ +[1.2a-3] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_with_alpha_char.json b/tst/JSONTestSuite/n_number_with_alpha_char.json new file mode 100644 index 0000000..b79dacc --- /dev/null +++ b/tst/JSONTestSuite/n_number_with_alpha_char.json @@ -0,0 +1 @@ +[1.8011670033376514H-308] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_number_with_leading_zero.json b/tst/JSONTestSuite/n_number_with_leading_zero.json new file mode 100644 index 0000000..7106da1 --- /dev/null +++ b/tst/JSONTestSuite/n_number_with_leading_zero.json @@ -0,0 +1 @@ +[012] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_bad_value.json b/tst/JSONTestSuite/n_object_bad_value.json new file mode 100644 index 0000000..a03a8c0 --- /dev/null +++ b/tst/JSONTestSuite/n_object_bad_value.json @@ -0,0 +1 @@ +["x", truth] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_bracket_key.json b/tst/JSONTestSuite/n_object_bracket_key.json new file mode 100644 index 0000000..cc443b4 --- /dev/null +++ b/tst/JSONTestSuite/n_object_bracket_key.json @@ -0,0 +1 @@ +{[: "x"} diff --git a/tst/JSONTestSuite/n_object_comma_instead_of_colon.json b/tst/JSONTestSuite/n_object_comma_instead_of_colon.json new file mode 100644 index 0000000..8d56377 --- /dev/null +++ b/tst/JSONTestSuite/n_object_comma_instead_of_colon.json @@ -0,0 +1 @@ +{"x", null} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_double_colon.json b/tst/JSONTestSuite/n_object_double_colon.json new file mode 100644 index 0000000..80e8c7b --- /dev/null +++ b/tst/JSONTestSuite/n_object_double_colon.json @@ -0,0 +1 @@ +{"x"::"b"} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_emoji.json b/tst/JSONTestSuite/n_object_emoji.json new file mode 100644 index 0000000..cb4078e --- /dev/null +++ b/tst/JSONTestSuite/n_object_emoji.json @@ -0,0 +1 @@ +{🇨🇭} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_garbage_at_end.json b/tst/JSONTestSuite/n_object_garbage_at_end.json new file mode 100644 index 0000000..80c42cb --- /dev/null +++ b/tst/JSONTestSuite/n_object_garbage_at_end.json @@ -0,0 +1 @@ +{"a":"a" 123} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_key_with_single_quotes.json b/tst/JSONTestSuite/n_object_key_with_single_quotes.json new file mode 100644 index 0000000..77c3275 --- /dev/null +++ b/tst/JSONTestSuite/n_object_key_with_single_quotes.json @@ -0,0 +1 @@ +{key: 'value'} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_lone_continuation_byte_in_key_and_trailing_comma.json b/tst/JSONTestSuite/n_object_lone_continuation_byte_in_key_and_trailing_comma.json new file mode 100644 index 0000000..aa2cb63 --- /dev/null +++ b/tst/JSONTestSuite/n_object_lone_continuation_byte_in_key_and_trailing_comma.json @@ -0,0 +1 @@ +{"¹":"0",} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_missing_colon.json b/tst/JSONTestSuite/n_object_missing_colon.json new file mode 100644 index 0000000..b98eff6 --- /dev/null +++ b/tst/JSONTestSuite/n_object_missing_colon.json @@ -0,0 +1 @@ +{"a" b} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_missing_key.json b/tst/JSONTestSuite/n_object_missing_key.json new file mode 100644 index 0000000..b4fb0f5 --- /dev/null +++ b/tst/JSONTestSuite/n_object_missing_key.json @@ -0,0 +1 @@ +{:"b"} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_missing_semicolon.json b/tst/JSONTestSuite/n_object_missing_semicolon.json new file mode 100644 index 0000000..e345138 --- /dev/null +++ b/tst/JSONTestSuite/n_object_missing_semicolon.json @@ -0,0 +1 @@ +{"a" "b"} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_missing_value.json b/tst/JSONTestSuite/n_object_missing_value.json new file mode 100644 index 0000000..3ef538a --- /dev/null +++ b/tst/JSONTestSuite/n_object_missing_value.json @@ -0,0 +1 @@ +{"a": \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_no-colon.json b/tst/JSONTestSuite/n_object_no-colon.json new file mode 100644 index 0000000..f3797b3 --- /dev/null +++ b/tst/JSONTestSuite/n_object_no-colon.json @@ -0,0 +1 @@ +{"a" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_non_string_key.json b/tst/JSONTestSuite/n_object_non_string_key.json new file mode 100644 index 0000000..b9945b3 --- /dev/null +++ b/tst/JSONTestSuite/n_object_non_string_key.json @@ -0,0 +1 @@ +{1:1} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_non_string_key_but_huge_number_instead.json b/tst/JSONTestSuite/n_object_non_string_key_but_huge_number_instead.json new file mode 100644 index 0000000..b37fa86 --- /dev/null +++ b/tst/JSONTestSuite/n_object_non_string_key_but_huge_number_instead.json @@ -0,0 +1 @@ +{9999E9999:1} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_repeated_null_null.json b/tst/JSONTestSuite/n_object_repeated_null_null.json new file mode 100644 index 0000000..f7d2959 --- /dev/null +++ b/tst/JSONTestSuite/n_object_repeated_null_null.json @@ -0,0 +1 @@ +{null:null,null:null} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_several_trailing_commas.json b/tst/JSONTestSuite/n_object_several_trailing_commas.json new file mode 100644 index 0000000..3c9afe8 --- /dev/null +++ b/tst/JSONTestSuite/n_object_several_trailing_commas.json @@ -0,0 +1 @@ +{"id":0,,,,,} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_single_quote.json b/tst/JSONTestSuite/n_object_single_quote.json new file mode 100644 index 0000000..e5cdf97 --- /dev/null +++ b/tst/JSONTestSuite/n_object_single_quote.json @@ -0,0 +1 @@ +{'a':0} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_trailing_comma.json b/tst/JSONTestSuite/n_object_trailing_comma.json new file mode 100644 index 0000000..a4b0250 --- /dev/null +++ b/tst/JSONTestSuite/n_object_trailing_comma.json @@ -0,0 +1 @@ +{"id":0,} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_trailing_comment.json b/tst/JSONTestSuite/n_object_trailing_comment.json new file mode 100644 index 0000000..a372c65 --- /dev/null +++ b/tst/JSONTestSuite/n_object_trailing_comment.json @@ -0,0 +1 @@ +{"a":"b"}/**/ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_trailing_comment_open.json b/tst/JSONTestSuite/n_object_trailing_comment_open.json new file mode 100644 index 0000000..d557f41 --- /dev/null +++ b/tst/JSONTestSuite/n_object_trailing_comment_open.json @@ -0,0 +1 @@ +{"a":"b"}/**// \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_trailing_comment_slash_open.json b/tst/JSONTestSuite/n_object_trailing_comment_slash_open.json new file mode 100644 index 0000000..e335136 --- /dev/null +++ b/tst/JSONTestSuite/n_object_trailing_comment_slash_open.json @@ -0,0 +1 @@ +{"a":"b"}// \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_trailing_comment_slash_open_incomplete.json b/tst/JSONTestSuite/n_object_trailing_comment_slash_open_incomplete.json new file mode 100644 index 0000000..d892e49 --- /dev/null +++ b/tst/JSONTestSuite/n_object_trailing_comment_slash_open_incomplete.json @@ -0,0 +1 @@ +{"a":"b"}/ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_two_commas_in_a_row.json b/tst/JSONTestSuite/n_object_two_commas_in_a_row.json new file mode 100644 index 0000000..7c639ae --- /dev/null +++ b/tst/JSONTestSuite/n_object_two_commas_in_a_row.json @@ -0,0 +1 @@ +{"a":"b",,"c":"d"} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_unquoted_key.json b/tst/JSONTestSuite/n_object_unquoted_key.json new file mode 100644 index 0000000..8ba1372 --- /dev/null +++ b/tst/JSONTestSuite/n_object_unquoted_key.json @@ -0,0 +1 @@ +{a: "b"} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_unterminated-value.json b/tst/JSONTestSuite/n_object_unterminated-value.json new file mode 100644 index 0000000..7fe699a --- /dev/null +++ b/tst/JSONTestSuite/n_object_unterminated-value.json @@ -0,0 +1 @@ +{"a":"a \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_with_single_string.json b/tst/JSONTestSuite/n_object_with_single_string.json new file mode 100644 index 0000000..d63f7fb --- /dev/null +++ b/tst/JSONTestSuite/n_object_with_single_string.json @@ -0,0 +1 @@ +{ "foo" : "bar", "a" } \ No newline at end of file diff --git a/tst/JSONTestSuite/n_object_with_trailing_garbage.json b/tst/JSONTestSuite/n_object_with_trailing_garbage.json new file mode 100644 index 0000000..787c8f0 --- /dev/null +++ b/tst/JSONTestSuite/n_object_with_trailing_garbage.json @@ -0,0 +1 @@ +{"a":"b"}# \ No newline at end of file diff --git a/tst/JSONTestSuite/n_single_space.json b/tst/JSONTestSuite/n_single_space.json new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/tst/JSONTestSuite/n_single_space.json @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_1_surrogate_then_escape.json b/tst/JSONTestSuite/n_string_1_surrogate_then_escape.json new file mode 100644 index 0000000..acec66d --- /dev/null +++ b/tst/JSONTestSuite/n_string_1_surrogate_then_escape.json @@ -0,0 +1 @@ +["\uD800\"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u.json b/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u.json new file mode 100644 index 0000000..e834b05 --- /dev/null +++ b/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u.json @@ -0,0 +1 @@ +["\uD800\u"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1.json b/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1.json new file mode 100644 index 0000000..a04cd34 --- /dev/null +++ b/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1.json @@ -0,0 +1 @@ +["\uD800\u1"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1x.json b/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1x.json new file mode 100644 index 0000000..bfbd234 --- /dev/null +++ b/tst/JSONTestSuite/n_string_1_surrogate_then_escape_u1x.json @@ -0,0 +1 @@ +["\uD800\u1x"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_accentuated_char_no_quotes.json b/tst/JSONTestSuite/n_string_accentuated_char_no_quotes.json new file mode 100644 index 0000000..fd68956 --- /dev/null +++ b/tst/JSONTestSuite/n_string_accentuated_char_no_quotes.json @@ -0,0 +1 @@ +[é] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_backslash_00.json b/tst/JSONTestSuite/n_string_backslash_00.json new file mode 100644 index 0000000000000000000000000000000000000000..b5bf267b5d4ee922d20cec1543b66d1530ff76cf GIT binary patch literal 6 Ncma!6ieXTS1pox&0a*Y5 literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/n_string_escape_x.json b/tst/JSONTestSuite/n_string_escape_x.json new file mode 100644 index 0000000..fae2919 --- /dev/null +++ b/tst/JSONTestSuite/n_string_escape_x.json @@ -0,0 +1 @@ +["\x00"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_escaped_backslash_bad.json b/tst/JSONTestSuite/n_string_escaped_backslash_bad.json new file mode 100644 index 0000000..016fcb4 --- /dev/null +++ b/tst/JSONTestSuite/n_string_escaped_backslash_bad.json @@ -0,0 +1 @@ +["\\\"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_escaped_ctrl_char_tab.json b/tst/JSONTestSuite/n_string_escaped_ctrl_char_tab.json new file mode 100644 index 0000000..f35ea38 --- /dev/null +++ b/tst/JSONTestSuite/n_string_escaped_ctrl_char_tab.json @@ -0,0 +1 @@ +["\ "] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_escaped_emoji.json b/tst/JSONTestSuite/n_string_escaped_emoji.json new file mode 100644 index 0000000..a277754 --- /dev/null +++ b/tst/JSONTestSuite/n_string_escaped_emoji.json @@ -0,0 +1 @@ +["\🌀"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_incomplete_escape.json b/tst/JSONTestSuite/n_string_incomplete_escape.json new file mode 100644 index 0000000..3415c33 --- /dev/null +++ b/tst/JSONTestSuite/n_string_incomplete_escape.json @@ -0,0 +1 @@ +["\"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_incomplete_escaped_character.json b/tst/JSONTestSuite/n_string_incomplete_escaped_character.json new file mode 100644 index 0000000..0f2197e --- /dev/null +++ b/tst/JSONTestSuite/n_string_incomplete_escaped_character.json @@ -0,0 +1 @@ +["\u00A"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_incomplete_surrogate.json b/tst/JSONTestSuite/n_string_incomplete_surrogate.json new file mode 100644 index 0000000..75504a6 --- /dev/null +++ b/tst/JSONTestSuite/n_string_incomplete_surrogate.json @@ -0,0 +1 @@ +["\uD834\uDd"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_incomplete_surrogate_escape_invalid.json b/tst/JSONTestSuite/n_string_incomplete_surrogate_escape_invalid.json new file mode 100644 index 0000000..bd96560 --- /dev/null +++ b/tst/JSONTestSuite/n_string_incomplete_surrogate_escape_invalid.json @@ -0,0 +1 @@ +["\uD800\uD800\x"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_invalid-utf-8-in-escape.json b/tst/JSONTestSuite/n_string_invalid-utf-8-in-escape.json new file mode 100644 index 0000000..0c43006 --- /dev/null +++ b/tst/JSONTestSuite/n_string_invalid-utf-8-in-escape.json @@ -0,0 +1 @@ +["\uå"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_invalid_backslash_esc.json b/tst/JSONTestSuite/n_string_invalid_backslash_esc.json new file mode 100644 index 0000000..d1eb609 --- /dev/null +++ b/tst/JSONTestSuite/n_string_invalid_backslash_esc.json @@ -0,0 +1 @@ +["\a"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_invalid_unicode_escape.json b/tst/JSONTestSuite/n_string_invalid_unicode_escape.json new file mode 100644 index 0000000..7608cb6 --- /dev/null +++ b/tst/JSONTestSuite/n_string_invalid_unicode_escape.json @@ -0,0 +1 @@ +["\uqqqq"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_invalid_utf8_after_escape.json b/tst/JSONTestSuite/n_string_invalid_utf8_after_escape.json new file mode 100644 index 0000000..2f757a2 --- /dev/null +++ b/tst/JSONTestSuite/n_string_invalid_utf8_after_escape.json @@ -0,0 +1 @@ +["\å"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_leading_uescaped_thinspace.json b/tst/JSONTestSuite/n_string_leading_uescaped_thinspace.json new file mode 100644 index 0000000..7b297c6 --- /dev/null +++ b/tst/JSONTestSuite/n_string_leading_uescaped_thinspace.json @@ -0,0 +1 @@ +[\u0020"asd"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_no_quotes_with_bad_escape.json b/tst/JSONTestSuite/n_string_no_quotes_with_bad_escape.json new file mode 100644 index 0000000..01bc70a --- /dev/null +++ b/tst/JSONTestSuite/n_string_no_quotes_with_bad_escape.json @@ -0,0 +1 @@ +[\n] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_single_doublequote.json b/tst/JSONTestSuite/n_string_single_doublequote.json new file mode 100644 index 0000000..9d68933 --- /dev/null +++ b/tst/JSONTestSuite/n_string_single_doublequote.json @@ -0,0 +1 @@ +" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_single_quote.json b/tst/JSONTestSuite/n_string_single_quote.json new file mode 100644 index 0000000..caff239 --- /dev/null +++ b/tst/JSONTestSuite/n_string_single_quote.json @@ -0,0 +1 @@ +['single quote'] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_single_string_no_double_quotes.json b/tst/JSONTestSuite/n_string_single_string_no_double_quotes.json new file mode 100644 index 0000000..f2ba8f8 --- /dev/null +++ b/tst/JSONTestSuite/n_string_single_string_no_double_quotes.json @@ -0,0 +1 @@ +abc \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_start_escape_unclosed.json b/tst/JSONTestSuite/n_string_start_escape_unclosed.json new file mode 100644 index 0000000..db62a46 --- /dev/null +++ b/tst/JSONTestSuite/n_string_start_escape_unclosed.json @@ -0,0 +1 @@ +["\ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_unescaped_ctrl_char.json b/tst/JSONTestSuite/n_string_unescaped_ctrl_char.json new file mode 100644 index 0000000000000000000000000000000000000000..9f21348071d3d736bdd469f159cea674c09237af GIT binary patch literal 7 Ocma!6N@Pe>iUj}$`2oKG literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/n_string_unescaped_newline.json b/tst/JSONTestSuite/n_string_unescaped_newline.json new file mode 100644 index 0000000..700d360 --- /dev/null +++ b/tst/JSONTestSuite/n_string_unescaped_newline.json @@ -0,0 +1,2 @@ +["new +line"] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_unescaped_tab.json b/tst/JSONTestSuite/n_string_unescaped_tab.json new file mode 100644 index 0000000..160264a --- /dev/null +++ b/tst/JSONTestSuite/n_string_unescaped_tab.json @@ -0,0 +1 @@ +[" "] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_unicode_CapitalU.json b/tst/JSONTestSuite/n_string_unicode_CapitalU.json new file mode 100644 index 0000000..17332bb --- /dev/null +++ b/tst/JSONTestSuite/n_string_unicode_CapitalU.json @@ -0,0 +1 @@ +"\UA66D" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_string_with_trailing_garbage.json b/tst/JSONTestSuite/n_string_with_trailing_garbage.json new file mode 100644 index 0000000..efe3bd2 --- /dev/null +++ b/tst/JSONTestSuite/n_string_with_trailing_garbage.json @@ -0,0 +1 @@ +""x \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_U+2060_word_joined.json b/tst/JSONTestSuite/n_structure_U+2060_word_joined.json new file mode 100644 index 0000000..81156a6 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_U+2060_word_joined.json @@ -0,0 +1 @@ +[â� ] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_UTF8_BOM_no_data.json b/tst/JSONTestSuite/n_structure_UTF8_BOM_no_data.json new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_UTF8_BOM_no_data.json @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_angle_bracket_..json b/tst/JSONTestSuite/n_structure_angle_bracket_..json new file mode 100644 index 0000000..a56fef0 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_angle_bracket_..json @@ -0,0 +1 @@ +<.> \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_angle_bracket_null.json b/tst/JSONTestSuite/n_structure_angle_bracket_null.json new file mode 100644 index 0000000..617f262 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_angle_bracket_null.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_array_trailing_garbage.json b/tst/JSONTestSuite/n_structure_array_trailing_garbage.json new file mode 100644 index 0000000..5a745e6 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_array_trailing_garbage.json @@ -0,0 +1 @@ +[1]x \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_array_with_extra_array_close.json b/tst/JSONTestSuite/n_structure_array_with_extra_array_close.json new file mode 100644 index 0000000..6cfb139 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_array_with_extra_array_close.json @@ -0,0 +1 @@ +[1]] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_array_with_unclosed_string.json b/tst/JSONTestSuite/n_structure_array_with_unclosed_string.json new file mode 100644 index 0000000..ba6b178 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_array_with_unclosed_string.json @@ -0,0 +1 @@ +["asd] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_ascii-unicode-identifier.json b/tst/JSONTestSuite/n_structure_ascii-unicode-identifier.json new file mode 100644 index 0000000..ef2ab62 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_ascii-unicode-identifier.json @@ -0,0 +1 @@ +aÃ¥ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_capitalized_True.json b/tst/JSONTestSuite/n_structure_capitalized_True.json new file mode 100644 index 0000000..7cd8846 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_capitalized_True.json @@ -0,0 +1 @@ +[True] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_close_unopened_array.json b/tst/JSONTestSuite/n_structure_close_unopened_array.json new file mode 100644 index 0000000..d2af0c6 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_close_unopened_array.json @@ -0,0 +1 @@ +1] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_comma_instead_of_closing_brace.json b/tst/JSONTestSuite/n_structure_comma_instead_of_closing_brace.json new file mode 100644 index 0000000..ac61b82 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_comma_instead_of_closing_brace.json @@ -0,0 +1 @@ +{"x": true, \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_double_array.json b/tst/JSONTestSuite/n_structure_double_array.json new file mode 100644 index 0000000..058d162 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_double_array.json @@ -0,0 +1 @@ +[][] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_end_array.json b/tst/JSONTestSuite/n_structure_end_array.json new file mode 100644 index 0000000..54caf60 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_end_array.json @@ -0,0 +1 @@ +] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_incomplete_UTF8_BOM.json b/tst/JSONTestSuite/n_structure_incomplete_UTF8_BOM.json new file mode 100644 index 0000000..bfcdd51 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_incomplete_UTF8_BOM.json @@ -0,0 +1 @@ +ï»{} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_lone-invalid-utf-8.json b/tst/JSONTestSuite/n_structure_lone-invalid-utf-8.json new file mode 100644 index 0000000..8b1296c --- /dev/null +++ b/tst/JSONTestSuite/n_structure_lone-invalid-utf-8.json @@ -0,0 +1 @@ +å \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_lone-open-bracket.json b/tst/JSONTestSuite/n_structure_lone-open-bracket.json new file mode 100644 index 0000000..8e2f0be --- /dev/null +++ b/tst/JSONTestSuite/n_structure_lone-open-bracket.json @@ -0,0 +1 @@ +[ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_no_data.json b/tst/JSONTestSuite/n_structure_no_data.json new file mode 100644 index 0000000..e69de29 diff --git a/tst/JSONTestSuite/n_structure_null-byte-outside-string.json b/tst/JSONTestSuite/n_structure_null-byte-outside-string.json new file mode 100644 index 0000000000000000000000000000000000000000..326db14422a756e9bd39221edf37b844cb8471c7 GIT binary patch literal 3 Kcma!Mhy?%vaR9jh literal 0 HcmV?d00001 diff --git a/tst/JSONTestSuite/n_structure_number_with_trailing_garbage.json b/tst/JSONTestSuite/n_structure_number_with_trailing_garbage.json new file mode 100644 index 0000000..0746539 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_number_with_trailing_garbage.json @@ -0,0 +1 @@ +2@ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_object_followed_by_closing_object.json b/tst/JSONTestSuite/n_structure_object_followed_by_closing_object.json new file mode 100644 index 0000000..aa9ebae --- /dev/null +++ b/tst/JSONTestSuite/n_structure_object_followed_by_closing_object.json @@ -0,0 +1 @@ +{}} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_object_unclosed_no_value.json b/tst/JSONTestSuite/n_structure_object_unclosed_no_value.json new file mode 100644 index 0000000..17d0451 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_object_unclosed_no_value.json @@ -0,0 +1 @@ +{"": \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_object_with_comment.json b/tst/JSONTestSuite/n_structure_object_with_comment.json new file mode 100644 index 0000000..ed1b569 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_object_with_comment.json @@ -0,0 +1 @@ +{"a":/*comment*/"b"} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_object_with_trailing_garbage.json b/tst/JSONTestSuite/n_structure_object_with_trailing_garbage.json new file mode 100644 index 0000000..9ca2336 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_object_with_trailing_garbage.json @@ -0,0 +1 @@ +{"a": true} "x" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_array_apostrophe.json b/tst/JSONTestSuite/n_structure_open_array_apostrophe.json new file mode 100644 index 0000000..8bebe3a --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_array_apostrophe.json @@ -0,0 +1 @@ +[' \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_array_comma.json b/tst/JSONTestSuite/n_structure_open_array_comma.json new file mode 100644 index 0000000..6295fdc --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_array_comma.json @@ -0,0 +1 @@ +[, \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_array_open_object.json b/tst/JSONTestSuite/n_structure_open_array_open_object.json new file mode 100644 index 0000000..7a63c8c --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_array_open_object.json @@ -0,0 +1 @@ +[{ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_array_open_string.json b/tst/JSONTestSuite/n_structure_open_array_open_string.json new file mode 100644 index 0000000..9822a6b --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_array_open_string.json @@ -0,0 +1 @@ +["a \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_array_string.json b/tst/JSONTestSuite/n_structure_open_array_string.json new file mode 100644 index 0000000..42a6193 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_array_string.json @@ -0,0 +1 @@ +["a" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_object.json b/tst/JSONTestSuite/n_structure_open_object.json new file mode 100644 index 0000000..81750b9 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_object.json @@ -0,0 +1 @@ +{ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_object_close_array.json b/tst/JSONTestSuite/n_structure_open_object_close_array.json new file mode 100644 index 0000000..eebc700 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_object_close_array.json @@ -0,0 +1 @@ +{] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_object_comma.json b/tst/JSONTestSuite/n_structure_open_object_comma.json new file mode 100644 index 0000000..47bc910 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_object_comma.json @@ -0,0 +1 @@ +{, \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_object_open_array.json b/tst/JSONTestSuite/n_structure_open_object_open_array.json new file mode 100644 index 0000000..381ede5 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_object_open_array.json @@ -0,0 +1 @@ +{[ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_object_open_string.json b/tst/JSONTestSuite/n_structure_open_object_open_string.json new file mode 100644 index 0000000..328c30c --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_object_open_string.json @@ -0,0 +1 @@ +{"a \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_object_string_with_apostrophes.json b/tst/JSONTestSuite/n_structure_open_object_string_with_apostrophes.json new file mode 100644 index 0000000..9dba170 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_object_string_with_apostrophes.json @@ -0,0 +1 @@ +{'a' \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_open_open.json b/tst/JSONTestSuite/n_structure_open_open.json new file mode 100644 index 0000000..841fd5f --- /dev/null +++ b/tst/JSONTestSuite/n_structure_open_open.json @@ -0,0 +1 @@ +["\{["\{["\{["\{ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_single_eacute.json b/tst/JSONTestSuite/n_structure_single_eacute.json new file mode 100644 index 0000000..92a39f3 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_single_eacute.json @@ -0,0 +1 @@ +é \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_single_star.json b/tst/JSONTestSuite/n_structure_single_star.json new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_single_star.json @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_trailing_#.json b/tst/JSONTestSuite/n_structure_trailing_#.json new file mode 100644 index 0000000..8986110 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_trailing_#.json @@ -0,0 +1 @@ +{"a":"b"}#{} \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_uescaped_LF_before_string.json b/tst/JSONTestSuite/n_structure_uescaped_LF_before_string.json new file mode 100644 index 0000000..df2f0f2 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_uescaped_LF_before_string.json @@ -0,0 +1 @@ +[\u000A""] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_unclosed_array.json b/tst/JSONTestSuite/n_structure_unclosed_array.json new file mode 100644 index 0000000..1120951 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_unclosed_array.json @@ -0,0 +1 @@ +[1 \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_unclosed_array_partial_null.json b/tst/JSONTestSuite/n_structure_unclosed_array_partial_null.json new file mode 100644 index 0000000..0d59176 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_unclosed_array_partial_null.json @@ -0,0 +1 @@ +[ false, nul \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_unclosed_array_unfinished_false.json b/tst/JSONTestSuite/n_structure_unclosed_array_unfinished_false.json new file mode 100644 index 0000000..a2ff850 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_unclosed_array_unfinished_false.json @@ -0,0 +1 @@ +[ true, fals \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_unclosed_array_unfinished_true.json b/tst/JSONTestSuite/n_structure_unclosed_array_unfinished_true.json new file mode 100644 index 0000000..3149e8f --- /dev/null +++ b/tst/JSONTestSuite/n_structure_unclosed_array_unfinished_true.json @@ -0,0 +1 @@ +[ false, tru \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_unclosed_object.json b/tst/JSONTestSuite/n_structure_unclosed_object.json new file mode 100644 index 0000000..694d69d --- /dev/null +++ b/tst/JSONTestSuite/n_structure_unclosed_object.json @@ -0,0 +1 @@ +{"asd":"asd" \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_unicode-identifier.json b/tst/JSONTestSuite/n_structure_unicode-identifier.json new file mode 100644 index 0000000..7284aea --- /dev/null +++ b/tst/JSONTestSuite/n_structure_unicode-identifier.json @@ -0,0 +1 @@ +Ã¥ \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_whitespace_U+2060_word_joiner.json b/tst/JSONTestSuite/n_structure_whitespace_U+2060_word_joiner.json new file mode 100644 index 0000000..81156a6 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_whitespace_U+2060_word_joiner.json @@ -0,0 +1 @@ +[â� ] \ No newline at end of file diff --git a/tst/JSONTestSuite/n_structure_whitespace_formfeed.json b/tst/JSONTestSuite/n_structure_whitespace_formfeed.json new file mode 100644 index 0000000..a9ea535 --- /dev/null +++ b/tst/JSONTestSuite/n_structure_whitespace_formfeed.json @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_arraysWithSpaces.json b/tst/JSONTestSuite/y_array_arraysWithSpaces.json new file mode 100644 index 0000000..5822907 --- /dev/null +++ b/tst/JSONTestSuite/y_array_arraysWithSpaces.json @@ -0,0 +1 @@ +[[] ] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_empty-string.json b/tst/JSONTestSuite/y_array_empty-string.json new file mode 100644 index 0000000..93b6be2 --- /dev/null +++ b/tst/JSONTestSuite/y_array_empty-string.json @@ -0,0 +1 @@ +[""] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_empty.json b/tst/JSONTestSuite/y_array_empty.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/tst/JSONTestSuite/y_array_empty.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_ending_with_newline.json b/tst/JSONTestSuite/y_array_ending_with_newline.json new file mode 100644 index 0000000..eac5f7b --- /dev/null +++ b/tst/JSONTestSuite/y_array_ending_with_newline.json @@ -0,0 +1 @@ +["a"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_false.json b/tst/JSONTestSuite/y_array_false.json new file mode 100644 index 0000000..67b2f07 --- /dev/null +++ b/tst/JSONTestSuite/y_array_false.json @@ -0,0 +1 @@ +[false] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_heterogeneous.json b/tst/JSONTestSuite/y_array_heterogeneous.json new file mode 100644 index 0000000..d3c1e26 --- /dev/null +++ b/tst/JSONTestSuite/y_array_heterogeneous.json @@ -0,0 +1 @@ +[null, 1, "1", {}] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_null.json b/tst/JSONTestSuite/y_array_null.json new file mode 100644 index 0000000..500db4a --- /dev/null +++ b/tst/JSONTestSuite/y_array_null.json @@ -0,0 +1 @@ +[null] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_with_1_and_newline.json b/tst/JSONTestSuite/y_array_with_1_and_newline.json new file mode 100644 index 0000000..9948255 --- /dev/null +++ b/tst/JSONTestSuite/y_array_with_1_and_newline.json @@ -0,0 +1,2 @@ +[1 +] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_with_leading_space.json b/tst/JSONTestSuite/y_array_with_leading_space.json new file mode 100644 index 0000000..18bfe64 --- /dev/null +++ b/tst/JSONTestSuite/y_array_with_leading_space.json @@ -0,0 +1 @@ + [1] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_with_several_null.json b/tst/JSONTestSuite/y_array_with_several_null.json new file mode 100644 index 0000000..99f6c5d --- /dev/null +++ b/tst/JSONTestSuite/y_array_with_several_null.json @@ -0,0 +1 @@ +[1,null,null,null,2] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_array_with_trailing_space.json b/tst/JSONTestSuite/y_array_with_trailing_space.json new file mode 100644 index 0000000..de9e7a9 --- /dev/null +++ b/tst/JSONTestSuite/y_array_with_trailing_space.json @@ -0,0 +1 @@ +[2] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number.json b/tst/JSONTestSuite/y_number.json new file mode 100644 index 0000000..e5f5cc3 --- /dev/null +++ b/tst/JSONTestSuite/y_number.json @@ -0,0 +1 @@ +[123e65] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_0e+1.json b/tst/JSONTestSuite/y_number_0e+1.json new file mode 100644 index 0000000..d1d3967 --- /dev/null +++ b/tst/JSONTestSuite/y_number_0e+1.json @@ -0,0 +1 @@ +[0e+1] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_0e1.json b/tst/JSONTestSuite/y_number_0e1.json new file mode 100644 index 0000000..3283a79 --- /dev/null +++ b/tst/JSONTestSuite/y_number_0e1.json @@ -0,0 +1 @@ +[0e1] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_after_space.json b/tst/JSONTestSuite/y_number_after_space.json new file mode 100644 index 0000000..623570d --- /dev/null +++ b/tst/JSONTestSuite/y_number_after_space.json @@ -0,0 +1 @@ +[ 4] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_double_close_to_zero.json b/tst/JSONTestSuite/y_number_double_close_to_zero.json new file mode 100644 index 0000000..96555ff --- /dev/null +++ b/tst/JSONTestSuite/y_number_double_close_to_zero.json @@ -0,0 +1 @@ +[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] diff --git a/tst/JSONTestSuite/y_number_int_with_exp.json b/tst/JSONTestSuite/y_number_int_with_exp.json new file mode 100644 index 0000000..a4ca9e7 --- /dev/null +++ b/tst/JSONTestSuite/y_number_int_with_exp.json @@ -0,0 +1 @@ +[20e1] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_minus_zero.json b/tst/JSONTestSuite/y_number_minus_zero.json new file mode 100644 index 0000000..37af131 --- /dev/null +++ b/tst/JSONTestSuite/y_number_minus_zero.json @@ -0,0 +1 @@ +[-0] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_negative_int.json b/tst/JSONTestSuite/y_number_negative_int.json new file mode 100644 index 0000000..8e30f8b --- /dev/null +++ b/tst/JSONTestSuite/y_number_negative_int.json @@ -0,0 +1 @@ +[-123] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_negative_one.json b/tst/JSONTestSuite/y_number_negative_one.json new file mode 100644 index 0000000..99d21a2 --- /dev/null +++ b/tst/JSONTestSuite/y_number_negative_one.json @@ -0,0 +1 @@ +[-1] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_negative_zero.json b/tst/JSONTestSuite/y_number_negative_zero.json new file mode 100644 index 0000000..37af131 --- /dev/null +++ b/tst/JSONTestSuite/y_number_negative_zero.json @@ -0,0 +1 @@ +[-0] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_capital_e.json b/tst/JSONTestSuite/y_number_real_capital_e.json new file mode 100644 index 0000000..6edbdfc --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_capital_e.json @@ -0,0 +1 @@ +[1E22] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_capital_e_neg_exp.json b/tst/JSONTestSuite/y_number_real_capital_e_neg_exp.json new file mode 100644 index 0000000..0a01bd3 --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_capital_e_neg_exp.json @@ -0,0 +1 @@ +[1E-2] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_capital_e_pos_exp.json b/tst/JSONTestSuite/y_number_real_capital_e_pos_exp.json new file mode 100644 index 0000000..5a8fc09 --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_capital_e_pos_exp.json @@ -0,0 +1 @@ +[1E+2] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_exponent.json b/tst/JSONTestSuite/y_number_real_exponent.json new file mode 100644 index 0000000..da2522d --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_exponent.json @@ -0,0 +1 @@ +[123e45] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_fraction_exponent.json b/tst/JSONTestSuite/y_number_real_fraction_exponent.json new file mode 100644 index 0000000..3944a7a --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_fraction_exponent.json @@ -0,0 +1 @@ +[123.456e78] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_neg_exp.json b/tst/JSONTestSuite/y_number_real_neg_exp.json new file mode 100644 index 0000000..ca40d3c --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_neg_exp.json @@ -0,0 +1 @@ +[1e-2] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_real_pos_exponent.json b/tst/JSONTestSuite/y_number_real_pos_exponent.json new file mode 100644 index 0000000..343601d --- /dev/null +++ b/tst/JSONTestSuite/y_number_real_pos_exponent.json @@ -0,0 +1 @@ +[1e+2] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_simple_int.json b/tst/JSONTestSuite/y_number_simple_int.json new file mode 100644 index 0000000..e47f69a --- /dev/null +++ b/tst/JSONTestSuite/y_number_simple_int.json @@ -0,0 +1 @@ +[123] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_number_simple_real.json b/tst/JSONTestSuite/y_number_simple_real.json new file mode 100644 index 0000000..b02878e --- /dev/null +++ b/tst/JSONTestSuite/y_number_simple_real.json @@ -0,0 +1 @@ +[123.456789] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object.json b/tst/JSONTestSuite/y_object.json new file mode 100644 index 0000000..78262ed --- /dev/null +++ b/tst/JSONTestSuite/y_object.json @@ -0,0 +1 @@ +{"asd":"sdf", "dfg":"fgh"} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_basic.json b/tst/JSONTestSuite/y_object_basic.json new file mode 100644 index 0000000..646bbe7 --- /dev/null +++ b/tst/JSONTestSuite/y_object_basic.json @@ -0,0 +1 @@ +{"asd":"sdf"} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_duplicated_key.json b/tst/JSONTestSuite/y_object_duplicated_key.json new file mode 100644 index 0000000..bbc2e1c --- /dev/null +++ b/tst/JSONTestSuite/y_object_duplicated_key.json @@ -0,0 +1 @@ +{"a":"b","a":"c"} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_duplicated_key_and_value.json b/tst/JSONTestSuite/y_object_duplicated_key_and_value.json new file mode 100644 index 0000000..211581c --- /dev/null +++ b/tst/JSONTestSuite/y_object_duplicated_key_and_value.json @@ -0,0 +1 @@ +{"a":"b","a":"b"} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_empty.json b/tst/JSONTestSuite/y_object_empty.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/tst/JSONTestSuite/y_object_empty.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_empty_key.json b/tst/JSONTestSuite/y_object_empty_key.json new file mode 100644 index 0000000..c0013d3 --- /dev/null +++ b/tst/JSONTestSuite/y_object_empty_key.json @@ -0,0 +1 @@ +{"":0} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_escaped_null_in_key.json b/tst/JSONTestSuite/y_object_escaped_null_in_key.json new file mode 100644 index 0000000..593f0f6 --- /dev/null +++ b/tst/JSONTestSuite/y_object_escaped_null_in_key.json @@ -0,0 +1 @@ +{"foo\u0000bar": 42} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_extreme_numbers.json b/tst/JSONTestSuite/y_object_extreme_numbers.json new file mode 100644 index 0000000..a0d3531 --- /dev/null +++ b/tst/JSONTestSuite/y_object_extreme_numbers.json @@ -0,0 +1 @@ +{ "min": -1.0e+28, "max": 1.0e+28 } \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_long_strings.json b/tst/JSONTestSuite/y_object_long_strings.json new file mode 100644 index 0000000..bdc4a08 --- /dev/null +++ b/tst/JSONTestSuite/y_object_long_strings.json @@ -0,0 +1 @@ +{"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_simple.json b/tst/JSONTestSuite/y_object_simple.json new file mode 100644 index 0000000..dacac91 --- /dev/null +++ b/tst/JSONTestSuite/y_object_simple.json @@ -0,0 +1 @@ +{"a":[]} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_string_unicode.json b/tst/JSONTestSuite/y_object_string_unicode.json new file mode 100644 index 0000000..8effdb2 --- /dev/null +++ b/tst/JSONTestSuite/y_object_string_unicode.json @@ -0,0 +1 @@ +{"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" } \ No newline at end of file diff --git a/tst/JSONTestSuite/y_object_with_newlines.json b/tst/JSONTestSuite/y_object_with_newlines.json new file mode 100644 index 0000000..246ec6b --- /dev/null +++ b/tst/JSONTestSuite/y_object_with_newlines.json @@ -0,0 +1,3 @@ +{ +"a": "b" +} \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_1_2_3_bytes_UTF-8_sequences.json b/tst/JSONTestSuite/y_string_1_2_3_bytes_UTF-8_sequences.json new file mode 100644 index 0000000..9967dde --- /dev/null +++ b/tst/JSONTestSuite/y_string_1_2_3_bytes_UTF-8_sequences.json @@ -0,0 +1 @@ +["\u0060\u012a\u12AB"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_accepted_surrogate_pair.json b/tst/JSONTestSuite/y_string_accepted_surrogate_pair.json new file mode 100644 index 0000000..996875c --- /dev/null +++ b/tst/JSONTestSuite/y_string_accepted_surrogate_pair.json @@ -0,0 +1 @@ +["\uD801\udc37"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_accepted_surrogate_pairs.json b/tst/JSONTestSuite/y_string_accepted_surrogate_pairs.json new file mode 100644 index 0000000..3401021 --- /dev/null +++ b/tst/JSONTestSuite/y_string_accepted_surrogate_pairs.json @@ -0,0 +1 @@ +["\ud83d\ude39\ud83d\udc8d"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_allowed_escapes.json b/tst/JSONTestSuite/y_string_allowed_escapes.json new file mode 100644 index 0000000..7f49553 --- /dev/null +++ b/tst/JSONTestSuite/y_string_allowed_escapes.json @@ -0,0 +1 @@ +["\"\\\/\b\f\n\r\t"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_backslash_and_u_escaped_zero.json b/tst/JSONTestSuite/y_string_backslash_and_u_escaped_zero.json new file mode 100644 index 0000000..d4439ed --- /dev/null +++ b/tst/JSONTestSuite/y_string_backslash_and_u_escaped_zero.json @@ -0,0 +1 @@ +["\\u0000"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_backslash_doublequotes.json b/tst/JSONTestSuite/y_string_backslash_doublequotes.json new file mode 100644 index 0000000..ae03243 --- /dev/null +++ b/tst/JSONTestSuite/y_string_backslash_doublequotes.json @@ -0,0 +1 @@ +["\""] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_comments.json b/tst/JSONTestSuite/y_string_comments.json new file mode 100644 index 0000000..2260c20 --- /dev/null +++ b/tst/JSONTestSuite/y_string_comments.json @@ -0,0 +1 @@ +["a/*b*/c/*d//e"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_double_escape_a.json b/tst/JSONTestSuite/y_string_double_escape_a.json new file mode 100644 index 0000000..6715d6f --- /dev/null +++ b/tst/JSONTestSuite/y_string_double_escape_a.json @@ -0,0 +1 @@ +["\\a"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_double_escape_n.json b/tst/JSONTestSuite/y_string_double_escape_n.json new file mode 100644 index 0000000..44ca56c --- /dev/null +++ b/tst/JSONTestSuite/y_string_double_escape_n.json @@ -0,0 +1 @@ +["\\n"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_escaped_control_character.json b/tst/JSONTestSuite/y_string_escaped_control_character.json new file mode 100644 index 0000000..5b014a9 --- /dev/null +++ b/tst/JSONTestSuite/y_string_escaped_control_character.json @@ -0,0 +1 @@ +["\u0012"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_escaped_noncharacter.json b/tst/JSONTestSuite/y_string_escaped_noncharacter.json new file mode 100644 index 0000000..2ff52e2 --- /dev/null +++ b/tst/JSONTestSuite/y_string_escaped_noncharacter.json @@ -0,0 +1 @@ +["\uFFFF"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_in_array.json b/tst/JSONTestSuite/y_string_in_array.json new file mode 100644 index 0000000..21d7ae4 --- /dev/null +++ b/tst/JSONTestSuite/y_string_in_array.json @@ -0,0 +1 @@ +["asd"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_in_array_with_leading_space.json b/tst/JSONTestSuite/y_string_in_array_with_leading_space.json new file mode 100644 index 0000000..9e1887c --- /dev/null +++ b/tst/JSONTestSuite/y_string_in_array_with_leading_space.json @@ -0,0 +1 @@ +[ "asd"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_last_surrogates_1_and_2.json b/tst/JSONTestSuite/y_string_last_surrogates_1_and_2.json new file mode 100644 index 0000000..3919cef --- /dev/null +++ b/tst/JSONTestSuite/y_string_last_surrogates_1_and_2.json @@ -0,0 +1 @@ +["\uDBFF\uDFFF"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_nbsp_uescaped.json b/tst/JSONTestSuite/y_string_nbsp_uescaped.json new file mode 100644 index 0000000..2085ab1 --- /dev/null +++ b/tst/JSONTestSuite/y_string_nbsp_uescaped.json @@ -0,0 +1 @@ +["new\u00A0line"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+10FFFF.json b/tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+10FFFF.json new file mode 100644 index 0000000..059e4d9 --- /dev/null +++ b/tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+10FFFF.json @@ -0,0 +1 @@ +["ô�¿¿"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+FFFF.json b/tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+FFFF.json new file mode 100644 index 0000000..4c913bd --- /dev/null +++ b/tst/JSONTestSuite/y_string_nonCharacterInUTF-8_U+FFFF.json @@ -0,0 +1 @@ +["ï¿¿"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_null_escape.json b/tst/JSONTestSuite/y_string_null_escape.json new file mode 100644 index 0000000..c1ad844 --- /dev/null +++ b/tst/JSONTestSuite/y_string_null_escape.json @@ -0,0 +1 @@ +["\u0000"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_one-byte-utf-8.json b/tst/JSONTestSuite/y_string_one-byte-utf-8.json new file mode 100644 index 0000000..1571859 --- /dev/null +++ b/tst/JSONTestSuite/y_string_one-byte-utf-8.json @@ -0,0 +1 @@ +["\u002c"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_pi.json b/tst/JSONTestSuite/y_string_pi.json new file mode 100644 index 0000000..9df11ae --- /dev/null +++ b/tst/JSONTestSuite/y_string_pi.json @@ -0,0 +1 @@ +["Ï€"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_reservedCharacterInUTF-8_U+1BFFF.json b/tst/JSONTestSuite/y_string_reservedCharacterInUTF-8_U+1BFFF.json new file mode 100644 index 0000000..10a33a1 --- /dev/null +++ b/tst/JSONTestSuite/y_string_reservedCharacterInUTF-8_U+1BFFF.json @@ -0,0 +1 @@ +["𛿿"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_simple_ascii.json b/tst/JSONTestSuite/y_string_simple_ascii.json new file mode 100644 index 0000000..8cadf7d --- /dev/null +++ b/tst/JSONTestSuite/y_string_simple_ascii.json @@ -0,0 +1 @@ +["asd "] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_space.json b/tst/JSONTestSuite/y_string_space.json new file mode 100644 index 0000000..efd782c --- /dev/null +++ b/tst/JSONTestSuite/y_string_space.json @@ -0,0 +1 @@ +" " \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json b/tst/JSONTestSuite/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json new file mode 100644 index 0000000..7620b66 --- /dev/null +++ b/tst/JSONTestSuite/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json @@ -0,0 +1 @@ +["\uD834\uDd1e"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_three-byte-utf-8.json b/tst/JSONTestSuite/y_string_three-byte-utf-8.json new file mode 100644 index 0000000..108f1d6 --- /dev/null +++ b/tst/JSONTestSuite/y_string_three-byte-utf-8.json @@ -0,0 +1 @@ +["\u0821"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_two-byte-utf-8.json b/tst/JSONTestSuite/y_string_two-byte-utf-8.json new file mode 100644 index 0000000..461503c --- /dev/null +++ b/tst/JSONTestSuite/y_string_two-byte-utf-8.json @@ -0,0 +1 @@ +["\u0123"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_u+2028_line_sep.json b/tst/JSONTestSuite/y_string_u+2028_line_sep.json new file mode 100644 index 0000000..897b602 --- /dev/null +++ b/tst/JSONTestSuite/y_string_u+2028_line_sep.json @@ -0,0 +1 @@ +["
"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_u+2029_par_sep.json b/tst/JSONTestSuite/y_string_u+2029_par_sep.json new file mode 100644 index 0000000..8cd998c --- /dev/null +++ b/tst/JSONTestSuite/y_string_u+2029_par_sep.json @@ -0,0 +1 @@ +["
"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_uEscape.json b/tst/JSONTestSuite/y_string_uEscape.json new file mode 100644 index 0000000..f7b41a0 --- /dev/null +++ b/tst/JSONTestSuite/y_string_uEscape.json @@ -0,0 +1 @@ +["\u0061\u30af\u30EA\u30b9"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_uescaped_newline.json b/tst/JSONTestSuite/y_string_uescaped_newline.json new file mode 100644 index 0000000..3a5a220 --- /dev/null +++ b/tst/JSONTestSuite/y_string_uescaped_newline.json @@ -0,0 +1 @@ +["new\u000Aline"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unescaped_char_delete.json b/tst/JSONTestSuite/y_string_unescaped_char_delete.json new file mode 100644 index 0000000..7d064f4 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unescaped_char_delete.json @@ -0,0 +1 @@ +[""] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode.json b/tst/JSONTestSuite/y_string_unicode.json new file mode 100644 index 0000000..3598095 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode.json @@ -0,0 +1 @@ +["\uA66D"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicodeEscapedBackslash.json b/tst/JSONTestSuite/y_string_unicodeEscapedBackslash.json new file mode 100644 index 0000000..0bb3b51 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicodeEscapedBackslash.json @@ -0,0 +1 @@ +["\u005C"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_2.json b/tst/JSONTestSuite/y_string_unicode_2.json new file mode 100644 index 0000000..a7dcb97 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_2.json @@ -0,0 +1 @@ +["â�‚㈴â�‚"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_U+10FFFE_nonchar.json b/tst/JSONTestSuite/y_string_unicode_U+10FFFE_nonchar.json new file mode 100644 index 0000000..9a8370b --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_U+10FFFE_nonchar.json @@ -0,0 +1 @@ +["\uDBFF\uDFFE"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_U+1FFFE_nonchar.json b/tst/JSONTestSuite/y_string_unicode_U+1FFFE_nonchar.json new file mode 100644 index 0000000..c51f8ae --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_U+1FFFE_nonchar.json @@ -0,0 +1 @@ +["\uD83F\uDFFE"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json b/tst/JSONTestSuite/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json new file mode 100644 index 0000000..626d5f8 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json @@ -0,0 +1 @@ +["\u200B"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_U+2064_invisible_plus.json b/tst/JSONTestSuite/y_string_unicode_U+2064_invisible_plus.json new file mode 100644 index 0000000..1e23972 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_U+2064_invisible_plus.json @@ -0,0 +1 @@ +["\u2064"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_U+FDD0_nonchar.json b/tst/JSONTestSuite/y_string_unicode_U+FDD0_nonchar.json new file mode 100644 index 0000000..18ef151 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_U+FDD0_nonchar.json @@ -0,0 +1 @@ +["\uFDD0"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_U+FFFE_nonchar.json b/tst/JSONTestSuite/y_string_unicode_U+FFFE_nonchar.json new file mode 100644 index 0000000..13d261f --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_U+FFFE_nonchar.json @@ -0,0 +1 @@ +["\uFFFE"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_unicode_escaped_double_quote.json b/tst/JSONTestSuite/y_string_unicode_escaped_double_quote.json new file mode 100644 index 0000000..4e62578 --- /dev/null +++ b/tst/JSONTestSuite/y_string_unicode_escaped_double_quote.json @@ -0,0 +1 @@ +["\u0022"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_utf8.json b/tst/JSONTestSuite/y_string_utf8.json new file mode 100644 index 0000000..4087843 --- /dev/null +++ b/tst/JSONTestSuite/y_string_utf8.json @@ -0,0 +1 @@ +["€ð�„ž"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_string_with_del_character.json b/tst/JSONTestSuite/y_string_with_del_character.json new file mode 100644 index 0000000..8bd2490 --- /dev/null +++ b/tst/JSONTestSuite/y_string_with_del_character.json @@ -0,0 +1 @@ +["aa"] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_lonely_false.json b/tst/JSONTestSuite/y_structure_lonely_false.json new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/tst/JSONTestSuite/y_structure_lonely_false.json @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_lonely_int.json b/tst/JSONTestSuite/y_structure_lonely_int.json new file mode 100644 index 0000000..f70d7bb --- /dev/null +++ b/tst/JSONTestSuite/y_structure_lonely_int.json @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_lonely_negative_real.json b/tst/JSONTestSuite/y_structure_lonely_negative_real.json new file mode 100644 index 0000000..b5135a2 --- /dev/null +++ b/tst/JSONTestSuite/y_structure_lonely_negative_real.json @@ -0,0 +1 @@ +-0.1 \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_lonely_null.json b/tst/JSONTestSuite/y_structure_lonely_null.json new file mode 100644 index 0000000..ec747fa --- /dev/null +++ b/tst/JSONTestSuite/y_structure_lonely_null.json @@ -0,0 +1 @@ +null \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_lonely_string.json b/tst/JSONTestSuite/y_structure_lonely_string.json new file mode 100644 index 0000000..b6e982c --- /dev/null +++ b/tst/JSONTestSuite/y_structure_lonely_string.json @@ -0,0 +1 @@ +"asd" \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_lonely_true.json b/tst/JSONTestSuite/y_structure_lonely_true.json new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/tst/JSONTestSuite/y_structure_lonely_true.json @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_string_empty.json b/tst/JSONTestSuite/y_structure_string_empty.json new file mode 100644 index 0000000..3cc762b --- /dev/null +++ b/tst/JSONTestSuite/y_structure_string_empty.json @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_trailing_newline.json b/tst/JSONTestSuite/y_structure_trailing_newline.json new file mode 100644 index 0000000..0c3426d --- /dev/null +++ b/tst/JSONTestSuite/y_structure_trailing_newline.json @@ -0,0 +1 @@ +["a"] diff --git a/tst/JSONTestSuite/y_structure_true_in_array.json b/tst/JSONTestSuite/y_structure_true_in_array.json new file mode 100644 index 0000000..de601e3 --- /dev/null +++ b/tst/JSONTestSuite/y_structure_true_in_array.json @@ -0,0 +1 @@ +[true] \ No newline at end of file diff --git a/tst/JSONTestSuite/y_structure_whitespace_array.json b/tst/JSONTestSuite/y_structure_whitespace_array.json new file mode 100644 index 0000000..2bedf7f --- /dev/null +++ b/tst/JSONTestSuite/y_structure_whitespace_array.json @@ -0,0 +1 @@ + [] \ No newline at end of file diff --git a/tst/jsontestsuite.g b/tst/jsontestsuite.g new file mode 100644 index 0000000..b67d2f3 --- /dev/null +++ b/tst/jsontestsuite.g @@ -0,0 +1,210 @@ +############################################################################# +## +## jsontestsuite.g json Package +## +## Support code for tst/test_jsontestsuite.tst, which runs the corpus in +## tst/JSONTestSuite through the package. +## +## Upstream names a file y_* if it must be accepted, n_* if it must be +## rejected and i_* if either is allowed. We accept every y_ file and reject +## every n_ file bar the eleven listed below, all of them number formats that +## picojson is more relaxed about than RFC 8259. Both implementations are +## deliberately relaxed in the same way, so tightening them up is a separate +## decision rather than a difference between the two. +## + +BindGlobal( "_JSON_TS_DIR", "JSONTestSuite" ); + +# n_ files we accept anyway +BindGlobal( "_JSON_TS_LENIENT", MakeImmutable( [ + "n_multidigit_number_then_00.json", # 123\0\0 + "n_number_-01.json", # leading zero + "n_number_-2..json", # no fractional digits + "n_number_0.e1.json", + "n_number_2.e+3.json", + "n_number_2.e-3.json", + "n_number_2.e3.json", + "n_number_neg_int_starting_with_zero.json", + "n_number_neg_real_without_int_part.json", # -.123 + "n_number_real_without_fractional_part.json", # 1. + "n_number_with_leading_zero.json", +] ) ); + +# i_ files we accept; the remaining i_ files must be rejected. Broadly, we +# pass malformed UTF-8 through untouched but insist on well formed \u +# surrogate pairs. +BindGlobal( "_JSON_TS_ACCEPTED", MakeImmutable( [ + "i_number_double_huge_neg_exp.json", + "i_number_huge_exp.json", + "i_number_neg_int_huge_exp.json", + "i_number_pos_double_huge_exp.json", + "i_number_real_neg_overflow.json", + "i_number_real_pos_overflow.json", + "i_number_real_underflow.json", + "i_number_too_big_neg_int.json", + "i_number_too_big_pos_int.json", + "i_number_very_big_negative_int.json", + "i_string_UTF-8_invalid_sequence.json", + "i_string_UTF8_surrogate_U+D800.json", + "i_string_invalid_utf-8.json", + "i_string_iso_latin_1.json", + "i_string_lone_utf8_continuation_byte.json", + "i_string_not_in_unicode_range.json", + "i_string_overlong_sequence_2_bytes.json", + "i_string_overlong_sequence_6_bytes.json", + "i_string_overlong_sequence_6_bytes_null.json", + "i_string_truncated-utf-8.json", + "i_structure_500_nested_arrays.json", +] ) ); + + +############################################################################# +## +#F _JSON_TS_Normalize( ) +## +## A canonical string for a parsed value, used to compare the results of the +## two implementations. Strings become lists of byte values, so that the +## deliberately malformed UTF-8 in the corpus can be compared without being +## re-encoded, and record components are sorted, so that the order in which +## the parsers happened to fill a record does not matter. +## +DeclareGlobalFunction( "_JSON_TS_Normalize" ); # recurses + +InstallGlobalFunction( _JSON_TS_Normalize, function(obj) + local parts, nam; + + if obj = fail then + return "null"; + elif obj = true then + return "true"; + elif obj = false then + return "false"; + elif IsInt(obj) then + return Concatenation("I", String(obj)); + elif IsFloat(obj) then + return Concatenation("F", String(obj)); + elif IsStringRep(obj) then + return Concatenation("S", String(List(obj, IntChar))); + elif IsRecord(obj) then + parts := List(SortedList(RecNames(obj)), + nam -> Concatenation(_JSON_TS_Normalize(nam), ":", + _JSON_TS_Normalize(obj.(nam)))); + return Concatenation("{", JoinStringsWithSeparator(parts, ","), "}"); + elif IsList(obj) then + parts := List(obj, _JSON_TS_Normalize); + return Concatenation("[", JoinStringsWithSeparator(parts, ","), "]"); + fi; + + return Concatenation("?", String(obj)); +end ); + + +############################################################################# +## +#F _JSON_TS_Files( ) +## +## The corpus, sorted so that the tests run in a reproducible order. +## +BindGlobal( "_JSON_TS_Files", function() + local dir, files; + dir := Filename(DirectoriesPackageLibrary("json", "tst"), _JSON_TS_DIR); + files := Filtered(DirectoryContents(dir), + f -> 5 < Length(f) and f{[ Length(f)-4 .. Length(f) ]} = ".json"); + return [ dir, SortedList(files) ]; +end ); + + +############################################################################# +## +#F _JSON_TS_Parse( , ) +## +## Parses one corpus file, returning either [ true, ] or +## [ false ]. +## +if IsReadOnlyGlobal("ERROR_OUTPUT") then + MakeReadWriteGlobal("ERROR_OUTPUT"); +fi; + +BindGlobal( "_JSON_TS_Parse", function(dir, file) + local saved, sink, res; + # most of the corpus is meant to be rejected, so send the error messages to + # a sink rather than into the test output + saved := ERROR_OUTPUT; + sink := OutputTextString("", false); + ERROR_OUTPUT := sink; + res := CALL_WITH_CATCH(JsonStringToGap, + [ StringFile(Filename(Directory(dir), file)) ]); + ERROR_OUTPUT := saved; + CloseStream(sink); + if res[1] then + return [ true, _JSON_TS_Normalize(res[2]) ]; + fi; + return [ false ]; +end ); + + +############################################################################# +## +#F _JSON_TS_CheckConformance( ) +## +## Checks the implementation currently in use against the expectations above, +## and prints a line for every disagreement. +## +BindGlobal( "_JSON_TS_CheckConformance", function() + local data, dir, file, accepted, expected; + + data := _JSON_TS_Files(); + dir := data[1]; + + for file in data[2] do + accepted := _JSON_TS_Parse(dir, file)[1]; + if file[1] = 'y' then + expected := true; + elif file[1] = 'n' then + expected := file in _JSON_TS_LENIENT; + else + expected := file in _JSON_TS_ACCEPTED; + fi; + if accepted <> expected then + if accepted then + Print("unexpectedly accepted: ", file, "\n"); + else + Print("unexpectedly rejected: ", file, "\n"); + fi; + fi; + od; +end ); + + +############################################################################# +## +#F _JSON_TS_CheckAgreement( ) +## +## Checks that every available implementation parses the corpus the same way, +## and prints a line for every disagreement. Does nothing useful when only +## one implementation is present. +## +BindGlobal( "_JSON_TS_CheckAgreement", function() + local impls, saved, data, dir, file, results, i; + + impls := JsonAvailableImplementations(); + saved := JsonImplementation(); + data := _JSON_TS_Files(); + dir := data[1]; + + for file in data[2] do + results := []; + for i in impls do + SetJsonImplementation(i); + Add(results, _JSON_TS_Parse(dir, file)); + od; + for i in [ 2 .. Length(impls) ] do + if results[i] <> results[1] then + Print(file, ": ", impls[1], " gave ", results[1], + " but ", impls[i], " gave ", results[i], "\n"); + fi; + od; + od; + + SetJsonImplementation(saved); +end ); diff --git a/tst/test_impl.tst b/tst/test_impl.tst new file mode 100644 index 0000000..4211bbb --- /dev/null +++ b/tst/test_impl.tst @@ -0,0 +1,47 @@ +# +# The runtime switch between the kernel and the pure GAP implementation. +# +gap> START_TEST("json package: test_impl.tst"); +gap> LoadPackage("json", false);; + +# +gap> saved := JsonImplementation();; +gap> saved in JsonAvailableImplementations(); +true +gap> "gap" in JsonAvailableImplementations(); +true +gap> JsonAvailableImplementations() = [ "kernel", "gap" ] or +> JsonAvailableImplementations() = [ "gap" ]; +true + +# the kernel implementation is preferred whenever it was built +gap> JsonAvailableImplementations()[1] = "kernel" or not JSON_KERNEL_AVAILABLE; +true + +# +gap> SetJsonImplementation("gap");; +gap> JsonImplementation(); +"gap" +gap> JsonStringToGap(GapToJsonString(rec(a := [1, "b", 2.5, fail]))); +rec( a := [ 1, "b", 2.5, fail ] ) + +# +gap> SetJsonImplementation("nosuchthing"); +Error, must be one of JsonAvailableImplementations() + +# the pure GAP parser rejects pathologically nested input rather than +# overflowing the C stack the way the kernel one does +gap> deep := n -> Concatenation(ListWithIdenticalEntries(n, '['), "1", +> ListWithIdenticalEntries(n, ']'));; +gap> JsonStringToGap(deep(_JSON_MAX_DEPTH));; +gap> JsonStringToGap(deep(_JSON_MAX_DEPTH + 1)); +Error, JSON input nested more than _JSON_MAX_DEPTH (1024) levels deep + +# switching returns the previously selected implementation +gap> SetJsonImplementation(saved) = "gap"; +true +gap> JsonImplementation() = saved; +true + +# +gap> STOP_TEST("json package: test_impl.tst"); diff --git a/tst/test_jsontestsuite.tst b/tst/test_jsontestsuite.tst new file mode 100644 index 0000000..f8f4c62 --- /dev/null +++ b/tst/test_jsontestsuite.tst @@ -0,0 +1,19 @@ +# +# Runs the JSONTestSuite corpus in tst/JSONTestSuite through the package; see +# tst/jsontestsuite.g for the expectations and tst/JSONTestSuite/README for +# where the corpus comes from. +# +gap> START_TEST("json package: test_jsontestsuite.tst"); +gap> LoadPackage("json", false);; +gap> if not IsBound(_JSON_TS_CheckAgreement) then # testall.g runs us twice +> Read(Filename(DirectoriesPackageLibrary("json", "tst"), "jsontestsuite.g")); +> fi; + +# the active implementation accepts and rejects what we expect it to +gap> _JSON_TS_CheckConformance(); + +# and every implementation agrees with every other one +gap> _JSON_TS_CheckAgreement(); + +# +gap> STOP_TEST("json package: test_jsontestsuite.tst"); diff --git a/tst/testall.g b/tst/testall.g index ead4576..ef46cee 100644 --- a/tst/testall.g +++ b/tst/testall.g @@ -4,9 +4,25 @@ # This file runs package tests. It is also referenced in the package # metadata in PackageInfo.g. # +# The whole test directory is run once per available implementation, so that +# the pure GAP code is exercised even on installations which have the kernel +# extension. +# LoadPackage( "json" ); -TestDirectory(DirectoriesPackageLibrary( "json", "tst" ), - rec(exitGAP := true)); +TestJson := function() + local dirs, result, impl; + dirs := DirectoriesPackageLibrary( "json", "tst" ); + result := true; + for impl in JsonAvailableImplementations() do + SetJsonImplementation( impl ); + Print( "#I testing the '", impl, "' implementation\n" ); + result := TestDirectory( dirs, rec( exitGAP := false ) ) and result; + od; + return result; +end; +if TestJson() then + QUIT_GAP(0); +fi; FORCE_QUIT_GAP(1);