diff --git a/aeson.cabal b/aeson.cabal index 508c01f42..1426d34dd 100644 --- a/aeson.cabal +++ b/aeson.cabal @@ -166,6 +166,7 @@ test-suite aeson-tests ErrorMessages Functions Instances + JSONTestSuite Options Properties PropertyGeneric diff --git a/tests/JSONTestSuite.hs b/tests/JSONTestSuite.hs new file mode 100644 index 000000000..70d7cb4ab --- /dev/null +++ b/tests/JSONTestSuite.hs @@ -0,0 +1,80 @@ +module JSONTestSuite (tests) where + +import Test.Tasty (TestTree, testGroup) +import Data.Either.Compat (isLeft, isRight) +import Test.Tasty.HUnit ( testCase, assertBool ) +import System.Directory (getDirectoryContents) +import System.FilePath ((), takeExtension, takeFileName) +import Data.List (sort) +import Control.Monad (forM) + +import qualified Data.ByteString.Lazy as L +import qualified Data.HashSet as HashSet + +import Data.Aeson + +jsonTestSuiteTest :: FilePath -> TestTree +jsonTestSuiteTest path = testCase fileName $ do + payload <- L.readFile path + let result = eitherDecode payload :: Either String Value + assertBool (show result) $ case take 2 fileName of + "n_" -> isLeft result + "y_" -> isRight result + "i_" | fileName `HashSet.member` ignore_accepted -> isRight result + | otherwise -> isLeft result + _ | fileName `HashSet.member` transform_rejected -> isLeft result + | otherwise -> isRight result -- test_transform tests have inconsistent names + where + fileName = takeFileName path + +-- Build a collection of tests based on the current contents of the +-- JSONTestSuite test directories. + +tests :: IO TestTree +tests = do + let suitePath = "tests/JSONTestSuite" + let suites = ["test_parsing", "test_transform"] + testPaths <- fmap (sort . concat) . forM suites $ \suite -> do + let dir = suitePath suite + entries <- getDirectoryContents dir + let ok name = takeExtension name == ".json" + return . map (dir ) . filter ok $ entries + return $ testGroup "JSONTestSuite" $ map jsonTestSuiteTest testPaths + +-- The set expected-to-be-failing JSONTestSuite tests. +-- Not all of these failures are genuine bugs. +-- Of those that are bugs, not all are worth fixing. + +-- | The @i@ cases we can ignore. We don't. +-- +-- @i_@ - parsers are free to accept or reject content +-- +-- We specify which @i_@ case we accept, so we can catch changes even in unspecified behavior. +-- (There is less case we accept) +ignore_accepted :: HashSet.HashSet FilePath +ignore_accepted = HashSet.fromList + [ "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_structure_500_nested_arrays.json" + ] + +-- | Transform folder contain weird structures and characters that parsers may understand differently. +-- +-- We don't even try to understand some. +transform_rejected :: HashSet.HashSet FilePath +transform_rejected = HashSet.fromList + [ "string_1_escaped_invalid_codepoint.json" + , "string_1_invalid_codepoint.json" + , "string_2_escaped_invalid_codepoints.json" + , "string_2_invalid_codepoints.json" + , "string_3_escaped_invalid_codepoints.json" + , "string_3_invalid_codepoints.json" + ] \ No newline at end of file diff --git a/tests/JSONTestSuite/README.md b/tests/JSONTestSuite/README.md deleted file mode 100644 index c593effb9..000000000 --- a/tests/JSONTestSuite/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# JSON Parsing Test Suite -A comprehensive test suite for RFC 7159 compliant JSON parsers - -This repository was created as an appendix to the article [Parsing JSON is a Minefield 💣](http://seriot.ch/parsing_json.php). - -**/parsers/** - -This directory contains several parsers and tiny wrappers to turn the parsers into JSON validators, by returning a specific value. - -- `0` the parser did accept the content -- `1` the parser did reject the content -- `>=1` the process did crash -- `timeout` happens after 5 seconds - -**/test\_parsing/** - -The name of these files tell if their contents should be accepted or rejected. - -- `y_` content must be accepted by parsers -- `n_` content must be rejected by parsers -- `i_` parsers are free to accept or reject content - -**/test\_transform/** - -These files contain weird structures and characters that parsers may understand differently, eg: - -- huge numbers -- dictionaries with similar keys -- NULL characters -- escaped invalid strings - -These files were used to produce `results/transform.html`. - -**/run_tests.py** - -Run all parsers with all files: - - $ python3 run_tests.py - -Run all parsers with a specific file: - - $ python3 run_tests.py file.json - -The script writes logs in `results/logs.txt`. - -The script then reads `logs.txt` and generates `results/parsing.html`. - -**/results/** - -JSON Parsing Tests diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/bin/test-AppleJSONSerialization b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/bin/test-AppleJSONSerialization deleted file mode 100755 index 14b9ace90..000000000 Binary files a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/bin/test-AppleJSONSerialization and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.pbxproj deleted file mode 100644 index a891c5563..000000000 --- a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.pbxproj +++ /dev/null @@ -1,260 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03997F941D70CE0C0001C89F /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03997F931D70CE0C0001C89F /* main.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03997F8E1D70CE0C0001C89F /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03997F901D70CE0C0001C89F /* test-AppleJSONSerialization */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "test-AppleJSONSerialization"; sourceTree = BUILT_PRODUCTS_DIR; }; - 03997F931D70CE0C0001C89F /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03997F8D1D70CE0C0001C89F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03997F871D70CE0C0001C89F = { - isa = PBXGroup; - children = ( - 03997F921D70CE0C0001C89F /* test-AppleJSONSerialization */, - 03997F911D70CE0C0001C89F /* Products */, - ); - sourceTree = ""; - }; - 03997F911D70CE0C0001C89F /* Products */ = { - isa = PBXGroup; - children = ( - 03997F901D70CE0C0001C89F /* test-AppleJSONSerialization */, - ); - name = Products; - sourceTree = ""; - }; - 03997F921D70CE0C0001C89F /* test-AppleJSONSerialization */ = { - isa = PBXGroup; - children = ( - 03997F931D70CE0C0001C89F /* main.swift */, - ); - path = "test-AppleJSONSerialization"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03997F8F1D70CE0C0001C89F /* test-AppleJSONSerialization */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03997F971D70CE0C0001C89F /* Build configuration list for PBXNativeTarget "test-AppleJSONSerialization" */; - buildPhases = ( - 03997F8C1D70CE0C0001C89F /* Sources */, - 03997F8D1D70CE0C0001C89F /* Frameworks */, - 03997F8E1D70CE0C0001C89F /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "test-AppleJSONSerialization"; - productName = "test-AppleJSONSerialization"; - productReference = 03997F901D70CE0C0001C89F /* test-AppleJSONSerialization */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03997F881D70CE0C0001C89F /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03997F8F1D70CE0C0001C89F = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03997F8B1D70CE0C0001C89F /* Build configuration list for PBXProject "test-AppleJSONSerialization" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03997F871D70CE0C0001C89F; - productRefGroup = 03997F911D70CE0C0001C89F /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03997F8F1D70CE0C0001C89F /* test-AppleJSONSerialization */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03997F8C1D70CE0C0001C89F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03997F941D70CE0C0001C89F /* main.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03997F951D70CE0C0001C89F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 03997F961D70CE0C0001C89F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03997F981D70CE0C0001C89F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 03997F991D70CE0C0001C89F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03997F8B1D70CE0C0001C89F /* Build configuration list for PBXProject "test-AppleJSONSerialization" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03997F951D70CE0C0001C89F /* Debug */, - 03997F961D70CE0C0001C89F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03997F971D70CE0C0001C89F /* Build configuration list for PBXNativeTarget "test-AppleJSONSerialization" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03997F981D70CE0C0001C89F /* Debug */, - 03997F991D70CE0C0001C89F /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03997F881D70CE0C0001C89F /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 9ab6e06bf..000000000 --- a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 7bfff1bd3..000000000 Binary files a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-AppleJSONSerialization.xcscheme b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-AppleJSONSerialization.xcscheme deleted file mode 100644 index 2f4204912..000000000 --- a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-AppleJSONSerialization.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 03df80f80..000000000 --- a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test-AppleJSONSerialization.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03997F8F1D70CE0C0001C89F - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization/main.swift b/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization/main.swift deleted file mode 100644 index 9df5aa5dd..000000000 --- a/tests/JSONTestSuite/parsers/test-AppleJSONSerialization/test-AppleJSONSerialization/main.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// main.swift -// test-AppleJSONSerialization -// -// Created by nst on 26/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard ProcessInfo.processInfo.arguments.count == 2 else { - let url = NSURL(fileURLWithPath: ProcessInfo.processInfo.arguments[0]) - guard let programName = url.lastPathComponent else { exit(1) } - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = ProcessInfo.processInfo.arguments[1] - let url = NSURL.fileURL(withPath:path) - - do { - let data = try Data(contentsOf:url) - - let _ = try JSONSerialization.jsonObject(with: data, options: [.allowFragments]) - - exit(0) - } catch { - exit(1) - } -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_Bash_JSON/JSON.sh b/tests/JSONTestSuite/parsers/test_Bash_JSON/JSON.sh deleted file mode 100755 index 077863385..000000000 --- a/tests/JSONTestSuite/parsers/test_Bash_JSON/JSON.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/sh - -throw() { - echo "$*" >&2 - exit 1 -} - -BRIEF=0 -LEAFONLY=0 -PRUNE=0 -NO_HEAD=0 -NORMALIZE_SOLIDUS=0 - -usage() { - echo - echo "Usage: JSON.sh [-b] [-l] [-p] [-s] [-h]" - echo - echo "-p - Prune empty. Exclude fields with empty values." - echo "-l - Leaf only. Only show leaf nodes, which stops data duplication." - echo "-b - Brief. Combines 'Leaf only' and 'Prune empty' options." - echo "-n - No-head. Do not show nodes that have no path (lines that start with [])." - echo "-s - Remove escaping of the solidus symbol (straight slash)." - echo "-h - This help text." - echo -} - -parse_options() { - set -- "$@" - local ARGN=$# - while [ "$ARGN" -ne 0 ] - do - case $1 in - -h) usage - exit 0 - ;; - -b) BRIEF=1 - LEAFONLY=1 - PRUNE=1 - ;; - -l) LEAFONLY=1 - ;; - -p) PRUNE=1 - ;; - -n) NO_HEAD=1 - ;; - -s) NORMALIZE_SOLIDUS=1 - ;; - ?*) echo "ERROR: Unknown option." - usage - exit 0 - ;; - esac - shift 1 - ARGN=$((ARGN-1)) - done -} - -awk_egrep () { - local pattern_string=$1 - - gawk '{ - while ($0) { - start=match($0, pattern); - token=substr($0, start, RLENGTH); - print token; - $0=substr($0, start+RLENGTH); - } - }' pattern="$pattern_string" -} - -tokenize () { - local GREP - local ESCAPE - local CHAR - - if echo "test string" | egrep -ao --color=never "test" >/dev/null 2>&1 - then - GREP='egrep -ao --color=never' - else - GREP='egrep -ao' - fi - - if echo "test string" | egrep -o "test" >/dev/null 2>&1 - then - ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' - CHAR='[^[:cntrl:]"\\]' - else - GREP=awk_egrep - ESCAPE='(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' - CHAR='[^[:cntrl:]"\\\\]' - fi - - local STRING="\"$CHAR*($ESCAPE$CHAR*)*\"" - local NUMBER='-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?' - local KEYWORD='null|false|true' - local SPACE='[[:space:]]+' - - # Force zsh to expand $A into multiple words - local is_wordsplit_disabled=$(unsetopt 2>/dev/null | grep -c '^shwordsplit$') - if [ $is_wordsplit_disabled != 0 ]; then setopt shwordsplit; fi - $GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | egrep -v "^$SPACE$" - if [ $is_wordsplit_disabled != 0 ]; then unsetopt shwordsplit; fi -} - -parse_array () { - local index=0 - local ary='' - read -r token - case "$token" in - ']') ;; - *) - while : - do - parse_value "$1" "$index" - index=$((index+1)) - ary="$ary""$value" - read -r token - case "$token" in - ']') break ;; - ',') ary="$ary," ;; - *) throw "EXPECTED , or ] GOT ${token:-EOF}" ;; - esac - read -r token - done - ;; - esac - [ "$BRIEF" -eq 0 ] && value=$(printf '[%s]' "$ary") || value= - : -} - -parse_object () { - local key - local obj='' - read -r token - case "$token" in - '}') ;; - *) - while : - do - case "$token" in - '"'*'"') key=$token ;; - *) throw "EXPECTED string GOT ${token:-EOF}" ;; - esac - read -r token - case "$token" in - ':') ;; - *) throw "EXPECTED : GOT ${token:-EOF}" ;; - esac - read -r token - parse_value "$1" "$key" - obj="$obj$key:$value" - read -r token - case "$token" in - '}') break ;; - ',') obj="$obj," ;; - *) throw "EXPECTED , or } GOT ${token:-EOF}" ;; - esac - read -r token - done - ;; - esac - [ "$BRIEF" -eq 0 ] && value=$(printf '{%s}' "$obj") || value= - : -} - -parse_value () { - local jpath="${1:+$1,}$2" isleaf=0 isempty=0 print=0 - case "$token" in - '{') parse_object "$jpath" ;; - '[') parse_array "$jpath" ;; - # At this point, the only valid single-character tokens are digits. - ''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;; - *) value=$token - # if asked, replace solidus ("\/") in json strings with normalized value: "/" - [ "$NORMALIZE_SOLIDUS" -eq 1 ] && value=$(echo "$value" | sed 's#\\/#/#g') - isleaf=1 - [ "$value" = '""' ] && isempty=1 - ;; - esac - [ "$value" = '' ] && return - [ "$NO_HEAD" -eq 1 ] && [ -z "$jpath" ] && return - - [ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 0 ] && print=1 - [ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && [ $PRUNE -eq 0 ] && print=1 - [ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 1 ] && [ "$isempty" -eq 0 ] && print=1 - [ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && \ - [ $PRUNE -eq 1 ] && [ $isempty -eq 0 ] && print=1 - [ "$print" -eq 1 ] && printf "[%s]\t%s\n" "$jpath" "$value" - : -} - -parse () { - read -r token - parse_value - read -r token - case "$token" in - '') ;; - *) throw "EXPECTED EOF GOT $token" ;; - esac -} - -if ([ "$0" = "$BASH_SOURCE" ] || ! [ -n "$BASH_SOURCE" ]); -then - parse_options "$@" - tokenize | parse -fi - -# vi: expandtab sw=2 ts=2 diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/bin/test_Freddy b/tests/JSONTestSuite/parsers/test_Freddy_20160830/bin/test_Freddy deleted file mode 100755 index 10f4b2994..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Freddy_20160830/bin/test_Freddy and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.pbxproj deleted file mode 100644 index 3ed80c199..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.pbxproj +++ /dev/null @@ -1,300 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03D84ABB1D5B0A1000776402 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03D84ABA1D5B0A1000776402 /* main.swift */; }; - 03F8F7811D5B75600021630C /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7781D5B75600021630C /* JSON.swift */; }; - 03F8F7821D5B75600021630C /* JSONDecodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7791D5B75600021630C /* JSONDecodable.swift */; }; - 03F8F7831D5B75600021630C /* JSONEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77A1D5B75600021630C /* JSONEncodable.swift */; }; - 03F8F7841D5B75600021630C /* JSONEncodingDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */; }; - 03F8F7851D5B75600021630C /* JSONLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */; }; - 03F8F7861D5B75600021630C /* JSONParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77D1D5B75600021630C /* JSONParser.swift */; }; - 03F8F7871D5B75600021630C /* JSONParsing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77E1D5B75600021630C /* JSONParsing.swift */; }; - 03F8F7881D5B75600021630C /* JSONSerializing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77F1D5B75600021630C /* JSONSerializing.swift */; }; - 03F8F7891D5B75600021630C /* JSONSubscripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7801D5B75600021630C /* JSONSubscripting.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03D84AB51D5B0A1000776402 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03D84AB71D5B0A1000776402 /* test_Freddy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_Freddy; sourceTree = BUILT_PRODUCTS_DIR; }; - 03D84ABA1D5B0A1000776402 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 03F8F7781D5B75600021630C /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSON.swift; path = test_Freddy/JSON.swift; sourceTree = ""; }; - 03F8F7791D5B75600021630C /* JSONDecodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONDecodable.swift; path = test_Freddy/JSONDecodable.swift; sourceTree = ""; }; - 03F8F77A1D5B75600021630C /* JSONEncodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONEncodable.swift; path = test_Freddy/JSONEncodable.swift; sourceTree = ""; }; - 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONEncodingDetector.swift; path = test_Freddy/JSONEncodingDetector.swift; sourceTree = ""; }; - 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONLiteralConvertible.swift; path = test_Freddy/JSONLiteralConvertible.swift; sourceTree = ""; }; - 03F8F77D1D5B75600021630C /* JSONParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONParser.swift; path = test_Freddy/JSONParser.swift; sourceTree = ""; }; - 03F8F77E1D5B75600021630C /* JSONParsing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONParsing.swift; path = test_Freddy/JSONParsing.swift; sourceTree = ""; }; - 03F8F77F1D5B75600021630C /* JSONSerializing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSerializing.swift; path = test_Freddy/JSONSerializing.swift; sourceTree = ""; }; - 03F8F7801D5B75600021630C /* JSONSubscripting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSubscripting.swift; path = test_Freddy/JSONSubscripting.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03D84AB41D5B0A1000776402 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03D84AAE1D5B0A1000776402 = { - isa = PBXGroup; - children = ( - 03F8F7781D5B75600021630C /* JSON.swift */, - 03F8F7791D5B75600021630C /* JSONDecodable.swift */, - 03F8F77A1D5B75600021630C /* JSONEncodable.swift */, - 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */, - 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */, - 03F8F77D1D5B75600021630C /* JSONParser.swift */, - 03F8F77E1D5B75600021630C /* JSONParsing.swift */, - 03F8F77F1D5B75600021630C /* JSONSerializing.swift */, - 03F8F7801D5B75600021630C /* JSONSubscripting.swift */, - 03D84AB91D5B0A1000776402 /* test_Freddy */, - 03D84AB81D5B0A1000776402 /* Products */, - ); - sourceTree = ""; - }; - 03D84AB81D5B0A1000776402 /* Products */ = { - isa = PBXGroup; - children = ( - 03D84AB71D5B0A1000776402 /* test_Freddy */, - ); - name = Products; - sourceTree = ""; - }; - 03D84AB91D5B0A1000776402 /* test_Freddy */ = { - isa = PBXGroup; - children = ( - 03D84ABA1D5B0A1000776402 /* main.swift */, - ); - path = test_Freddy; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03D84AB61D5B0A1000776402 /* test_Freddy */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03D84ABE1D5B0A1000776402 /* Build configuration list for PBXNativeTarget "test_Freddy" */; - buildPhases = ( - 03D84AB31D5B0A1000776402 /* Sources */, - 03D84AB41D5B0A1000776402 /* Frameworks */, - 03D84AB51D5B0A1000776402 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_Freddy; - productName = test_Freddy; - productReference = 03D84AB71D5B0A1000776402 /* test_Freddy */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03D84AAF1D5B0A1000776402 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03D84AB61D5B0A1000776402 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - DevelopmentTeamName = "Nicolas Seriot"; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03D84AB21D5B0A1000776402 /* Build configuration list for PBXProject "test_Freddy" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03D84AAE1D5B0A1000776402; - productRefGroup = 03D84AB81D5B0A1000776402 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03D84AB61D5B0A1000776402 /* test_Freddy */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03D84AB31D5B0A1000776402 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03F8F7881D5B75600021630C /* JSONSerializing.swift in Sources */, - 03F8F7821D5B75600021630C /* JSONDecodable.swift in Sources */, - 03F8F7851D5B75600021630C /* JSONLiteralConvertible.swift in Sources */, - 03F8F7871D5B75600021630C /* JSONParsing.swift in Sources */, - 03F8F7861D5B75600021630C /* JSONParser.swift in Sources */, - 03F8F7831D5B75600021630C /* JSONEncodable.swift in Sources */, - 03D84ABB1D5B0A1000776402 /* main.swift in Sources */, - 03F8F7811D5B75600021630C /* JSON.swift in Sources */, - 03F8F7891D5B75600021630C /* JSONSubscripting.swift in Sources */, - 03F8F7841D5B75600021630C /* JSONEncodingDetector.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03D84ABC1D5B0A1000776402 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 03D84ABD1D5B0A1000776402 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03D84ABF1D5B0A1000776402 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; - }; - name = Debug; - }; - 03D84AC01D5B0A1000776402 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03D84AB21D5B0A1000776402 /* Build configuration list for PBXProject "test_Freddy" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03D84ABC1D5B0A1000776402 /* Debug */, - 03D84ABD1D5B0A1000776402 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03D84ABE1D5B0A1000776402 /* Build configuration list for PBXNativeTarget "test_Freddy" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03D84ABF1D5B0A1000776402 /* Debug */, - 03D84AC01D5B0A1000776402 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03D84AAF1D5B0A1000776402 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 95e4cc57e..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint deleted file mode 100644 index fcf13a138..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint +++ /dev/null @@ -1,30 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" : 0, - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : 0 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7B3DFA55-F9BF-41D8-8FD5-204D3162EB03", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" : "dropbox\/JSON\/test_Freddy\/Vendor\/Freddy\/", - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : "dropbox\/" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "test_Freddy", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "JSON\/test_Freddy\/test_Freddy.xcodeproj", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/bignerdranch\/Freddy.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "\/Users\/nst\/Dropbox\/dropbox.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" - } - ] -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index d241da9da..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme deleted file mode 100644 index e31043938..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index b27bc09bd..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_Freddy.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03D84AB61D5B0A1000776402 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSON.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSON.swift deleted file mode 100644 index c8adae8ca..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSON.swift +++ /dev/null @@ -1,95 +0,0 @@ -// -// JSON.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/17/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -/// An enum to describe the structure of JSON. -public enum JSON { - /// A case for denoting an array with an associated value of `[JSON]` - case Array([JSON]) - /// A case for denoting a dictionary with an associated value of `[Swift.String: JSON]` - case Dictionary([Swift.String: JSON]) - /// A case for denoting a double with an associated value of `Swift.Double`. - case Double(Swift.Double) - /// A case for denoting an integer with an associated value of `Swift.Int`. - case Int(Swift.Int) - /// A case for denoting a string with an associated value of `Swift.String`. - case String(Swift.String) - /// A case for denoting a boolean with an associated value of `Swift.Bool`. - case Bool(Swift.Bool) - /// A case for denoting null. - case Null -} - -// MARK: - Errors - -extension JSON { - - /// An enum to encapsulate errors that may arise in working with `JSON`. - public enum Error: ErrorType { - /// The `index` is out of bounds for a JSON array - case IndexOutOfBounds(index: Swift.Int) - - /// The `key` was not found in the JSON dictionary - case KeyNotFound(key: Swift.String) - - /// The JSON is not subscriptable with `type` - case UnexpectedSubscript(type: JSONPathType.Type) - - /// Unexpected JSON `value` was found that is not convertible `to` type - case ValueNotConvertible(value: JSON, to: Any.Type) - } - -} - -// MARK: - Test Equality - -/// Return `true` if `lhs` is equal to `rhs`. -public func ==(lhs: JSON, rhs: JSON) -> Bool { - switch (lhs, rhs) { - case (.Array(let arrL), .Array(let arrR)): - return arrL == arrR - case (.Dictionary(let dictL), .Dictionary(let dictR)): - return dictL == dictR - case (.String(let strL), .String(let strR)): - return strL == strR - case (.Double(let dubL), .Double(let dubR)): - return dubL == dubR - case (.Double(let dubL), .Int(let intR)): - return dubL == Double(intR) - case (.Int(let intL), .Int(let intR)): - return intL == intR - case (.Int(let intL), .Double(let dubR)): - return Double(intL) == dubR - case (.Bool(let bL), .Bool(let bR)): - return bL == bR - case (.Null, .Null): - return true - default: - return false - } -} - -extension JSON: Equatable {} - -// MARK: - Printing - -extension JSON: CustomStringConvertible { - - /// A textual representation of `self`. - public var description: Swift.String { - switch self { - case .Array(let arr): return Swift.String(arr) - case .Dictionary(let dict): return Swift.String(dict) - case .String(let string): return string - case .Double(let double): return Swift.String(double) - case .Int(let int): return Swift.String(int) - case .Bool(let bool): return Swift.String(bool) - case .Null: return "null" - } - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONDecodable.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONDecodable.swift deleted file mode 100644 index 2da9bae04..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONDecodable.swift +++ /dev/null @@ -1,177 +0,0 @@ -// -// JSONDecodable.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/24/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -/// A protocol to provide functionality for creating a model object with a `JSON` -/// value. -public protocol JSONDecodable { - - /// Creates an instance of the model with a `JSON` instance. - /// - parameter json: An instance of a `JSON` value from which to - /// construct an instance of the implementing type. - /// - throws: Any `JSON.Error` for errors derived from inspecting the - /// `JSON` value, or any other error involved in decoding. - init(json: JSON) throws - -} - -extension Double: JSONDecodable { - - /// An initializer to create an instance of `Double` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Double` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - switch json { - case let .Double(double): - self = double - case let .Int(int): - self = Swift.Double(int) - default: - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.Double) - } - } - -} - -extension Int: JSONDecodable { - - /// An initializer to create an instance of `Int` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Int` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - switch json { - case let .Double(double) where double <= Double(Swift.Int.max): - self = Swift.Int(double) - case let .Int(int): - self = int - default: - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.Int) - } - } - -} - -extension String: JSONDecodable { - - /// An initializer to create an instance of `String` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `String` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - - switch json { - case let .String(string): - self = string - case let .Int(int): - self = String(int) - case let .Bool(bool): - self = String(bool) - case let .Double(double): - self = String(double) - default: - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.String) - } - } - -} - -extension Bool: JSONDecodable { - - /// An initializer to create an instance of `Bool` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Bool` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - guard case let .Bool(bool) = json else { - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.Bool) - } - self = bool - } - -} - -extension RawRepresentable where RawValue: JSONDecodable { - - /// An initializer to create an instance of `RawRepresentable` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `RawRepresentable` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - let raw = try json.decode(type: RawValue.self) - guard let value = Self(rawValue: raw) else { - throw JSON.Error.ValueNotConvertible(value: json, to: Self.self) - } - self = value - } -} - -internal extension JSON { - - /// Retrieves a `[JSON]` from the JSON. - /// - parameter: A `JSON` to be used to create the returned `Array`. - /// - returns: An `Array` of `JSON` elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`. - /// - seealso: `JSON.decode(_:type:)` - static func getArray(json: JSON) throws -> [JSON] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Array. - guard case let .Array(array) = json else { - throw Error.ValueNotConvertible(value: json, to: Swift.Array) - } - return array - } - - /// Retrieves a `[String: JSON]` from the JSON. - /// - parameter: A `JSON` to be used to create the returned `Dictionary`. - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`. - /// - seealso: `JSON.decode(_:type:)` - static func getDictionary(json: JSON) throws -> [Swift.String: JSON] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Dictionary. - guard case let .Dictionary(dictionary) = json else { - throw Error.ValueNotConvertible(value: json, to: Swift.Dictionary) - } - return dictionary - } - - /// Attempts to decode many values from a descendant JSON array at a path - /// into JSON. - /// - parameter: A `JSON` to be used to create the returned `Array` of some type conforming to `JSONDecodable`. - /// - returns: An `Array` of `Decoded` elements. - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`, as - /// well as any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - static func getArrayOf(json: JSON) throws -> [Decoded] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Dictionary. - // This implementation also doesn't do the `type = Type.self` trick. - return try getArray(json).map(Decoded.init) - } - - /// Attempts to decode many values from a descendant JSON object at a path - /// into JSON. - /// - returns: A `Dictionary` of string keys and `Decoded` values. - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)` or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - static func getDictionaryOf(json: JSON) throws -> [Swift.String: Decoded] { - guard case let .Dictionary(dictionary) = json else { - throw Error.ValueNotConvertible(value: json, to: Swift.Dictionary) - } - var decodedDictionary = Swift.Dictionary(minimumCapacity: dictionary.count) - for (key, value) in dictionary { - decodedDictionary[key] = try Decoded(json: value) - } - return decodedDictionary - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONEncodable.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONEncodable.swift deleted file mode 100644 index 480c57bce..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONEncodable.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// JSONEncodable.swift -// Freddy -// -// Created by Matthew Mathias on 1/4/16. -// Copyright © 2016 Big Nerd Ranch. All rights reserved. -// - -import Foundation - -/// A protocol to facilitate encoding and decoding of `JSON`. -public protocol JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON`. - /// - Note: If conforming to `JSONEncodable` with a custom type of your own, you should return an instance of - /// `JSON.Dictionary`. - func toJSON() -> JSON -} - -extension Array where Element: JSONEncodable { - /// Converts an instance of `Array` whose elements conform to `JSONEncodable` to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Array`. - public func toJSON() -> JSON { - let arrayOfJSON = self.map { $0.toJSON() } - return .Array(arrayOfJSON) - } -} - -extension Dictionary where Value: JSONEncodable { - /// Converts an instance of `Dictionary` whose values conform to `JSONEncodable` to `JSON`. The keys in the resulting - /// `JSON.Dictionary` will be of type `String`. - /// - returns: An instance of `JSON` where the enum case is `.Dictionary`. - public func toJSON() -> JSON { - var jsonDictionary = [String: JSON]() - - for (k, v) in self { - let key = String(k) - jsonDictionary[key] = v.toJSON() - } - - return .Dictionary(jsonDictionary) - } -} - -extension Int: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Int`. - public func toJSON() -> JSON { - return .Int(self) - } -} - -extension Double: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Double`. - public func toJSON() -> JSON { - return .Double(self) - } -} - -extension String: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.String`. - public func toJSON() -> JSON { - return .String(self) - } -} - -extension Bool: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Bool`. - public func toJSON() -> JSON { - return .Bool(self) - } -} - -extension RawRepresentable where RawValue: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is whatever the underlying `RawValue` converts to. - public func toJSON() -> JSON { - return rawValue.toJSON() - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONEncodingDetector.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONEncodingDetector.swift deleted file mode 100644 index 933bc0c29..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONEncodingDetector.swift +++ /dev/null @@ -1,110 +0,0 @@ -// -// JSONEncodingDetector.swift -// Freddy -// -// Created by Robert Edwards on 1/27/16. -// Copyright © 2016 Big Nerd Ranch. All rights reserved. -// - -/// Struct for attempting to detect the Unicode encoding used with the data supplied to the JSONParser -public struct JSONEncodingDetector { - - //// The Unicode encodings looked for during detection - public enum Encoding { - //// UTF-8 - case UTF8 - //// UTF-16 Little Endian - case UTF16LE - //// UTF-16 Big Endian - case UTF16BE - //// UTF-32 Little Endian - case UTF32LE - //// UTF-32 Big Endian - case UTF32BE - } - - //// The Unicode encodings supported by JSONParser.swift - public static let supportedEncodings: [Encoding] = [.UTF8] - - typealias ByteStreamPrefixInformation = (encoding: Encoding, byteOrderMarkLength: Int) - - //// Attempts to detect the Unicode encoding used for a given set of data. - //// - //// This function initially looks for a Byte Order Mark in the following form: - //// - //// Bytes | Encoding Form - //// --------------|---------------- - //// 00 00 FE FF | UTF-32, big-endian - //// FF FE 00 00 | UTF-32, little-endian - //// FE FF | UTF-16, big-endian - //// FF FE | UTF-16, little-endian - //// EF BB BF | UTF-8 - //// - //// If a BOM is not found then we detect using the following approach described in - //// the JSON RFC http://www.ietf.org/rfc/rfc4627.txt: - //// - //// Since the first two characters of a JSON text will always be ASCII - //// characters [RFC0020], it is possible to determine whether an octet - //// stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking - //// at the pattern of nulls in the first four octets. - //// - //// 00 00 00 xx UTF-32BE - //// 00 xx 00 xx UTF-16BE - //// xx 00 00 00 UTF-32LE - //// xx 00 xx 00 UTF-16LE - //// xx xx xx xx UTF-8 - //// - //// - parameter header: The front Slice of data being read and evaluated. - //// - returns: A tuple containing the detected Unicode encoding and the lenght of the byte order mark. - static func detectEncoding(header: Slice>) -> ByteStreamPrefixInformation { - - guard let prefix = prefixFromHeader(header) else { - return (.UTF8, 0) - } - - if let prefixInfo = JSONEncodingDetector.encodingFromBOM(prefix) { - return prefixInfo - } else { - switch prefix { - case(0, 0, 0?, _): - return (.UTF32BE, 0) - case(_, 0, 0?, 0?): - return (.UTF32LE, 0) - case (0, _, 0?, _), (0, _, _, _): - return (.UTF16BE, 0) - case (_, 0, _, 0?), (_, 0, _, _): - return (.UTF16LE, 0) - default: - return (.UTF8, 0) - } - } - } - - private typealias EncodingBytePrefix = (UInt8, UInt8, UInt8?, UInt8?) - - private static func prefixFromHeader(header: Slice>) -> EncodingBytePrefix? { - if header.count >= 4 { - return(header[0], header[1], header[2], header[3]) - } else if header.count >= 2 { - return (header[0], header[1], nil, nil) - } - return nil - } - - private static func encodingFromBOM(prefix: EncodingBytePrefix) -> ByteStreamPrefixInformation? { - switch prefix { - case(0xFE, 0xFF, _, _): - return (.UTF16BE, 2) - case(0x00, 0x00, 0xFE?, 0xFF?): - return (.UTF32BE, 4) - case(0xEF, 0xBB, 0xBF?, _): - return (.UTF8, 3) - case(0xFF, 0xFE, 0?, 0?): - return (.UTF32LE, 4) - case(0xFF, 0xFE, _, _): - return (.UTF16LE, 2) - default: - return nil - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONLiteralConvertible.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONLiteralConvertible.swift deleted file mode 100644 index b90e05264..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONLiteralConvertible.swift +++ /dev/null @@ -1,130 +0,0 @@ -// -// JSONLiteralConvertible.swift -// Freddy -// -// Created by Zachary Waldowski on 5/11/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -// MARK: - ArrayLiteralConvertible - -extension JSON: ArrayLiteralConvertible { - - /// Create an instance by copying each element of the `collection` into a - /// new `Array`. - public init(_ collection: Collection) { - self = .Array(Swift.Array(collection)) - } - - /// Create an instance initialized with `elements`. - public init(arrayLiteral elements: JSON...) { - self.init(elements) - } - -} - -// MARK: - DictionaryLiteralConvertible - -extension JSON: DictionaryLiteralConvertible { - - /// Create an instance by copying each key/value pair of the `pairs` into - /// a new `Dictionary`. - public init(_ pairs: Dictionary) { - var dictionary = Swift.Dictionary(minimumCapacity: pairs.underestimateCount()) - for (key, value) in pairs { - dictionary[key] = value - } - self = .Dictionary(dictionary) - } - - /// Create an instance initialized with `pairs`. - public init(dictionaryLiteral pairs: (Swift.String, JSON)...) { - self.init(pairs) - } - -} - -// MARK: - FloatLiteralConvertible - -extension JSON: FloatLiteralConvertible { - - /// Create an instance initialized to `Double` `value`. - public init(_ value: Swift.Double) { - self = .Double(value) - } - - /// Create a literal instance initialized to `value`. - public init(floatLiteral value: Swift.Double) { - self.init(value) - } - -} - -// MARK: - IntegerLiteralConvertible - -extension JSON: IntegerLiteralConvertible { - - /// Create an instance initialized to `Int` by `value`. - public init(_ value: Swift.Int) { - self = .Int(value) - } - - /// Create a literal instance initialized to `value`. - public init(integerLiteral value: Swift.Int) { - self.init(value) - } - -} - -// MARK: - StringLiteralConvertible - -extension JSON: StringLiteralConvertible { - - /// Create an instance initialized to `String` by `text`. - public init(_ text: Swift.String) { - self = .String(text) - } - - /// Create a literal instance initialized to `value`. - public init(stringLiteral value: StringLiteralType) { - self.init(value) - } - - /// Create a literal instance initialized to `value`. - public init(extendedGraphemeClusterLiteral value: StringLiteralType) { - self.init(value) - } - - /// Create a literal instance initialized to `value`. - public init(unicodeScalarLiteral value: StringLiteralType) { - self.init(value) - } - -} - -// MARK: - BooleanLiteralConvertible - -extension JSON: BooleanLiteralConvertible { - - /// Create an instance initialized to `Bool` by `value`. - public init(_ value: Swift.Bool) { - self = .Bool(value) - } - - /// Create a literal instance initialized to `value`. - public init(booleanLiteral value: Swift.Bool) { - self.init(value) - } - -} - -// MARK: - NilLiteralConvertible - -extension JSON: NilLiteralConvertible { - - /// Create an instance initialized with `nil`. - public init(nilLiteral: ()) { - self = .Null - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONParser.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONParser.swift deleted file mode 100644 index 31797c3af..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONParser.swift +++ /dev/null @@ -1,907 +0,0 @@ -// -// JSONParser.swift -// Freddy -// -// Created by John Gallagher on 4/18/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -import Foundation - -private struct Literal { - static let BACKSLASH = UInt8(ascii: "\\") - static let BACKSPACE = UInt8(ascii: "\u{0008}") - static let COLON = UInt8(ascii: ":") - static let COMMA = UInt8(ascii: ",") - static let DOUBLE_QUOTE = UInt8(ascii: "\"") - static let FORMFEED = UInt8(ascii: "\u{000c}") - static let LEFT_BRACE = UInt8(ascii: "{") - static let LEFT_BRACKET = UInt8(ascii: "[") - static let MINUS = UInt8(ascii: "-") - static let NEWLINE = UInt8(ascii: "\n") - static let PERIOD = UInt8(ascii: ".") - static let PLUS = UInt8(ascii: "+") - static let RETURN = UInt8(ascii: "\r") - static let RIGHT_BRACE = UInt8(ascii: "}") - static let RIGHT_BRACKET = UInt8(ascii: "]") - static let SLASH = UInt8(ascii: "/") - static let SPACE = UInt8(ascii: " ") - static let TAB = UInt8(ascii: "\t") - - static let a = UInt8(ascii: "a") - static let b = UInt8(ascii: "b") - static let c = UInt8(ascii: "c") - static let d = UInt8(ascii: "d") - static let e = UInt8(ascii: "e") - static let f = UInt8(ascii: "f") - static let l = UInt8(ascii: "l") - static let n = UInt8(ascii: "n") - static let r = UInt8(ascii: "r") - static let s = UInt8(ascii: "s") - static let t = UInt8(ascii: "t") - static let u = UInt8(ascii: "u") - - static let A = UInt8(ascii: "A") - static let B = UInt8(ascii: "B") - static let C = UInt8(ascii: "C") - static let D = UInt8(ascii: "D") - static let E = UInt8(ascii: "E") - static let F = UInt8(ascii: "F") - - static let zero = UInt8(ascii: "0") - static let one = UInt8(ascii: "1") - static let two = UInt8(ascii: "2") - static let three = UInt8(ascii: "3") - static let four = UInt8(ascii: "4") - static let five = UInt8(ascii: "5") - static let six = UInt8(ascii: "6") - static let seven = UInt8(ascii: "7") - static let eight = UInt8(ascii: "8") - static let nine = UInt8(ascii: "9") -} - -private let ParserMaximumDepth = 512 - - -/// A pure Swift JSON parser. This parser is much faster than the -/// `NSJSONSerialization`-based parser (due to the overhead of having to -/// dynamically cast the Objective-C objects to determine their type); however, -/// it is much newer and has restrictions that the `NSJSONSerialization` parser -/// does not. Two restrictions in particular are that it requires UTF-8 data as -/// input and it does not allow trailing commas in arrays or dictionaries. -public struct JSONParser { - - private enum Sign: Int { - case Positive = 1 - case Negative = -1 - } - - private let input: UnsafeBufferPointer - private let owner: Any? - private var loc = 0 - private var depth = 0 - - private init(buffer: UnsafeBufferPointer, owner: T) { - self.input = buffer - self.owner = owner - } - - /// Decode the root element of the `JSON` stream. This may be any fragment - /// or a structural element, per RFC 7159. - /// - /// The beginning bytes are used to determine the stream's encoding. - /// `JSONParser` currently only supports UTF-8 encoding, with or without - /// a byte-order mark. - /// - /// - throws: `JSONParser.Error` for any decoding failures, including a - /// source location if needed. - public mutating func parse() throws -> JSON { - try guardAgainstUnsupportedEncodings() - let value = try parseValue() - skipWhitespace() - guard loc == input.count else { - throw Error.EndOfStreamGarbage(offset: loc) - } - return value - } - - private mutating func parseValue() throws -> JSON { - guard depth <= ParserMaximumDepth else { - throw Error.ExceededNestingLimit(offset: loc) - } - - guard input.count > 0 else { - throw Error.EndOfStreamUnexpected - } - - advancing: while loc < input.count { - do { - switch input[loc] { - case Literal.LEFT_BRACKET: - depth += 1 - defer { depth -= 1 } - return try decodeArray() - - case Literal.LEFT_BRACE: - depth += 1 - defer { depth -= 1 } - return try decodeObject() - - case Literal.DOUBLE_QUOTE: - return try decodeString() - - case Literal.f: - return try decodeFalse() - - case Literal.n: - return try decodeNull() - - case Literal.t: - return try decodeTrue() - - case Literal.MINUS: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .LeadingMinus)) - - case Literal.zero: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .LeadingZero)) - - case Literal.one...Literal.nine: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .PreDecimalDigits)) - - case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE: - loc = loc.successor() - - default: - break advancing - } - } catch let InternalError.NumberOverflow(offset: start) { - return try decodeNumberAsString(start) - } - } - - if loc < input.count { - throw Error.ValueInvalid(offset: loc, character: UnicodeScalar(input[loc])) - } else { - throw Error.EndOfStreamUnexpected - } - } - - private mutating func skipWhitespace() { - while loc < input.count { - switch input[loc] { - case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE: - loc = loc.successor() - - default: - return - } - } - } - - private mutating func guardAgainstUnsupportedEncodings() throws { - let header = input.prefix(4) - let encodingPrefixInformation = JSONEncodingDetector.detectEncoding(header) - guard JSONEncodingDetector.supportedEncodings.contains(encodingPrefixInformation.encoding) else { - throw Error.InvalidUnicodeStreamEncoding(detectedEncoding: encodingPrefixInformation.encoding) - } - loc = loc.advancedBy(encodingPrefixInformation.byteOrderMarkLength) - } - - private mutating func decodeNull() throws -> JSON { - guard loc.advancedBy(3, limit: input.count) != input.count else { - throw Error.LiteralNilMisspelled(offset: loc) - } - - if input[loc+1] != Literal.u - || input[loc+2] != Literal.l - || input[loc+3] != Literal.l { - throw Error.LiteralNilMisspelled(offset: loc) - } - - loc += 4 - return .Null - } - - private mutating func decodeTrue() throws -> JSON { - guard loc.advancedBy(3, limit: input.count) != input.count else { - throw Error.LiteralTrueMisspelled(offset: loc) - } - - if input[loc+1] != Literal.r - || input[loc+2] != Literal.u - || input[loc+3] != Literal.e { - throw Error.LiteralTrueMisspelled(offset: loc) - } - - loc += 4 - return .Bool(true) - } - - private mutating func decodeFalse() throws -> JSON { - guard loc.advancedBy(4, limit: input.count) != input.count else { - throw Error.LiteralFalseMisspelled(offset: loc) - } - - if input[loc+1] != Literal.a - || input[loc+2] != Literal.l - || input[loc+3] != Literal.s - || input[loc+4] != Literal.e { - throw Error.LiteralFalseMisspelled(offset: loc) - } - - loc += 5 - return .Bool(false) - } - - private var stringDecodingBuffer = [UInt8]() - private mutating func decodeString() throws -> JSON { - let start = loc - loc = loc.successor() - stringDecodingBuffer.removeAll(keepCapacity: true) - while loc < input.count { - switch input[loc] { - case Literal.BACKSLASH: - loc = loc.successor() - switch input[loc] { - case Literal.DOUBLE_QUOTE: stringDecodingBuffer.append(Literal.DOUBLE_QUOTE) - case Literal.BACKSLASH: stringDecodingBuffer.append(Literal.BACKSLASH) - case Literal.SLASH: stringDecodingBuffer.append(Literal.SLASH) - case Literal.b: stringDecodingBuffer.append(Literal.BACKSPACE) - case Literal.f: stringDecodingBuffer.append(Literal.FORMFEED) - case Literal.r: stringDecodingBuffer.append(Literal.RETURN) - case Literal.t: stringDecodingBuffer.append(Literal.TAB) - case Literal.n: stringDecodingBuffer.append(Literal.NEWLINE) - case Literal.u: - loc = loc.successor() - try readUnicodeEscape(start: loc - 2) - - // readUnicodeEscape() advances loc on its own, so we'll `continue` now - // to skip the typical "advance past this character" for all the other escapes - continue - - default: - throw Error.ControlCharacterUnrecognized(offset: loc) - } - loc = loc.successor() - - case Literal.DOUBLE_QUOTE: - loc = loc.successor() - stringDecodingBuffer.append(0) - - guard let string = (stringDecodingBuffer.withUnsafeBufferPointer { - String.fromCString(UnsafePointer($0.baseAddress)) - }) else { - throw Error.UnicodeEscapeInvalid(offset: start) - } - - return .String(string) - - case let other: - stringDecodingBuffer.append(other) - loc = loc.successor() - } - } - - throw Error.EndOfStreamUnexpected - } - - private mutating func readCodeUnit() -> UInt16? { - guard loc + 4 <= input.count else { - return nil - } - var codeUnit: UInt16 = 0 - for c in input[loc.. JSON { - let start = loc - loc = loc.successor() - var items = [JSON]() - - while loc < input.count { - skipWhitespace() - - if loc < input.count && input[loc] == Literal.RIGHT_BRACKET { - loc = loc.successor() - return .Array(items) - } - - if !items.isEmpty { - guard loc < input.count && input[loc] == Literal.COMMA else { - throw Error.CollectionMissingSeparator(offset: start) - } - loc = loc.successor() - } - - items.append(try parseValue()) - } - - throw Error.EndOfStreamUnexpected - } - - // Decoding objects can be recursive, so we have to keep more than one - // buffer around for building up key/value pairs (to reduce allocations - // when parsing large JSON documents). - // - // Rough estimate of the difference between this and using a fresh - // [(String,JSON)] for the `pairs` variable in decodeObject() below is - // about 12% on an iPhone 5. - private struct DecodeObjectBuffers { - var buffers = [[(String,JSON)]]() - - mutating func getBuffer() -> [(String,JSON)] { - if !buffers.isEmpty { - var buffer = buffers.removeLast() - buffer.removeAll(keepCapacity: true) - return buffer - } - return [(String,JSON)]() - } - - mutating func putBuffer(buffer: [(String,JSON)]) { - buffers.append(buffer) - } - } - - private var decodeObjectBuffers = DecodeObjectBuffers() - - private mutating func decodeObject() throws -> JSON { - let start = loc - loc = loc.successor() - var pairs = decodeObjectBuffers.getBuffer() - - while loc < input.count { - skipWhitespace() - - if loc < input.count && input[loc] == Literal.RIGHT_BRACE { - loc = loc.successor() - var obj = [String:JSON](minimumCapacity: pairs.count) - for (k, v) in pairs { - obj[k] = v - } - decodeObjectBuffers.putBuffer(pairs) - return .Dictionary(obj) - } - - if !pairs.isEmpty { - guard loc < input.count && input[loc] == Literal.COMMA else { - throw Error.CollectionMissingSeparator(offset: start) - } - loc = loc.successor() - - skipWhitespace() - } - - guard loc < input.count && input[loc] == Literal.DOUBLE_QUOTE else { - throw Error.DictionaryMissingKey(offset: start) - } - - let key = try decodeString().string() - skipWhitespace() - - guard loc < input.count && input[loc] == Literal.COLON else { - throw Error.CollectionMissingSeparator(offset: start) - } - loc = loc.successor() - - pairs.append((key, try parseValue())) - } - - throw Error.EndOfStreamUnexpected - } - - private mutating func decodeIntegralValue(parser: NumberParser) throws -> JSON { - var sign = Sign.Positive - var parser = parser - var value = 0 - - // This would be more natural as `while true { ... }` with a meaningful .Done case, - // but that causes compile time explosion in Swift 2.2. :-| - while parser.state != .Done { - switch parser.state { - case .LeadingMinus: - sign = .Negative - try parser.parseNegative() - - case .LeadingZero: - parser.parseLeadingZero() - - case .PreDecimalDigits: - try parser.parsePreDecimalDigits { c in - guard case let (exponent, false) = Int.multiplyWithOverflow(10, value) else { - throw InternalError.NumberOverflow(offset: parser.start) - } - - guard case let (newValue, false) = Int.addWithOverflow(exponent, Int(c - Literal.zero)) else { - throw InternalError.NumberOverflow(offset: parser.start) - } - - value = newValue - } - - case .Decimal, .Exponent: - return try detectingFloatingPointErrors(parser.start) { - try decodeFloatingPointValue(parser, sign: sign, value: Double(value)) - } - - case .PostDecimalDigits, .ExponentSign, .ExponentDigits: - assertionFailure("Invalid internal state while parsing number") - - case .Done: - fatalError("impossible condition") - } - } - - guard case let (signedValue, false) = Int.multiplyWithOverflow(sign.rawValue, value) else { - throw InternalError.NumberOverflow(offset: parser.start) - } - - loc = parser.loc - return .Int(signedValue) - } - - private mutating func decodeFloatingPointValue(parser: NumberParser, sign: Sign, value: Double) throws -> JSON { - var parser = parser - var value = value - var exponentSign = Sign.Positive - var exponent = Double(0) - var position = 0.1 - - // This would be more natural as `while true { ... }` with a meaningful .Done case, - // but that causes compile time explosion in Swift 2.2. :-| - while parser.state != .Done { - switch parser.state { - case .LeadingMinus, .LeadingZero, .PreDecimalDigits: - assertionFailure("Invalid internal state while parsing number") - - case .Decimal: - try parser.parseDecimal() - - case .PostDecimalDigits: - parser.parsePostDecimalDigits { c in - value += position * Double(c - Literal.zero) - position /= 10 - } - - case .Exponent: - exponentSign = try parser.parseExponent() - - case .ExponentSign: - try parser.parseExponentSign() - - case .ExponentDigits: - parser.parseExponentDigits { c in - exponent = exponent * 10 + Double(c - Literal.zero) - } - - case .Done: - fatalError("impossible condition") - } - } - - loc = parser.loc - return .Double(Double(sign.rawValue) * value * pow(10, Double(exponentSign.rawValue) * exponent)) - } - - private mutating func decodeNumberAsString(start: Int) throws -> JSON { - var parser: NumberParser = { - let state: NumberParser.State - switch input[start] { - case Literal.MINUS: state = .LeadingMinus - case Literal.zero: state = .LeadingZero - case Literal.one...Literal.nine: state = .PreDecimalDigits - default: - fatalError("Internal error: decodeNumber called on not-a-number") - } - return NumberParser(loc: start, input: input, state: state) - }() - - stringDecodingBuffer.removeAll(keepCapacity: true) - - while true { - switch parser.state { - case .LeadingMinus: - try parser.parseNegative() - stringDecodingBuffer.append(Literal.MINUS) - - case .LeadingZero: - parser.parseLeadingZero() - stringDecodingBuffer.append(Literal.zero) - - case .PreDecimalDigits: - parser.parsePreDecimalDigits { stringDecodingBuffer.append($0) } - - case .Decimal: - try parser.parseDecimal() - stringDecodingBuffer.append(Literal.PERIOD) - - case .PostDecimalDigits: - parser.parsePostDecimalDigits { stringDecodingBuffer.append($0) } - - case .Exponent: - stringDecodingBuffer.append(input[parser.loc]) - _ = try parser.parseExponent() - - case .ExponentSign: - stringDecodingBuffer.append(input[parser.loc]) - try parser.parseExponentSign() - - case .ExponentDigits: - parser.parseExponentDigits { stringDecodingBuffer.append($0) } - - case .Done: - stringDecodingBuffer.append(0) - guard let string = (stringDecodingBuffer.withUnsafeBufferPointer { - String.fromCString(UnsafePointer($0.baseAddress)) - }) else { - // Should never fail - any problems with the number string should - // result in thrown errors above - fatalError("Internal error: Invalid numeric string") - } - - loc = parser.loc - return .String(string) - } - } - } - - private func detectingFloatingPointErrors(loc: Int, @noescape _ f: () throws -> T) throws -> T { - let flags = FE_UNDERFLOW | FE_OVERFLOW - feclearexcept(flags) - let value = try f() - guard fetestexcept(flags) == 0 else { - throw InternalError.NumberOverflow(offset: loc) - } - return value - } -} - -private struct NumberParser { - enum State { - case LeadingMinus - case LeadingZero - case PreDecimalDigits - case Decimal - case PostDecimalDigits - case Exponent - case ExponentSign - case ExponentDigits - case Done - } - - let start: Int - var loc = 0 - var state: State - let input: UnsafeBufferPointer - - init(loc: Int, input: UnsafeBufferPointer, state: State) { - assert(loc < input.count, "Invalid input to NumberParser") - self.start = loc - self.loc = loc - self.input = input - self.state = state - } - - mutating func parseNegative() throws { - assert(state == .LeadingMinus, "Unexpected state entering parseNegative") - - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero: - state = .LeadingZero - - case Literal.one...Literal.nine: - state = .PreDecimalDigits - - default: - throw JSONParser.Error.NumberSymbolMissingDigits(offset: start) - } - } - - mutating func parseLeadingZero() { - assert(state == .LeadingZero, "Unexpected state entering parseLeadingZero") - - loc = loc.successor() - guard loc < input.count else { - state = .Done - return - } - - guard input[loc] == Literal.PERIOD else { - state = .Done - return - } - - state = .Decimal - } - - mutating func parsePreDecimalDigits(@noescape f: (UInt8) throws -> Void) rethrows { - assert(state == .PreDecimalDigits, "Unexpected state entering parsePreDecimalDigits") - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = loc.successor() - - case Literal.PERIOD: - state = .Decimal - return - - case Literal.e, Literal.E: - state = .Exponent - return - - default: - break advancing - } - } - - state = .Done - } - - mutating func parseDecimal() throws { - assert(state == .Decimal, "Unexpected state entering parseDecimal") - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .PostDecimalDigits - - default: - throw JSONParser.Error.NumberMissingFractionalDigits(offset: start) - } - } - - mutating func parsePostDecimalDigits(@noescape f: (UInt8) throws -> Void) rethrows { - assert(state == .PostDecimalDigits, "Unexpected state entering parsePostDecimalDigits") - - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = loc.successor() - - case Literal.e, Literal.E: - state = .Exponent - return - - default: - break advancing - } - } - - state = .Done - } - - mutating func parseExponent() throws -> JSONParser.Sign { - assert(state == .Exponent, "Unexpected state entering parseExponent") - - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .ExponentDigits - - case Literal.PLUS: - state = .ExponentSign - - case Literal.MINUS: - state = .ExponentSign - return .Negative - - default: - throw JSONParser.Error.NumberSymbolMissingDigits(offset: start) - } - - return .Positive - } - - mutating func parseExponentSign() throws { - assert(state == .ExponentSign, "Unexpected state entering parseExponentSign") - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .ExponentDigits - - default: - throw JSONParser.Error.NumberSymbolMissingDigits(offset: start) - } - } - - mutating func parseExponentDigits(@noescape f: (UInt8) throws -> Void) rethrows { - assert(state == .ExponentDigits, "Unexpected state entering parseExponentDigits") - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = loc.successor() - - default: - break advancing - } - } - - state = .Done - } -} - -public extension JSONParser { - - /// Creates a `JSONParser` ready to parse UTF-8 encoded `NSData`. - /// - /// If the data is mutable, it is copied before parsing. The data's lifetime - /// is extended for the duration of parsing. - init(utf8Data inData: NSData) { - let data = inData.copy() as! NSData - let buffer = UnsafeBufferPointer(start: UnsafePointer(data.bytes), count: data.length) - self.init(buffer: buffer, owner: data) - } - - /// Creates a `JSONParser` from the code units represented by the `string`. - /// - /// The synthesized string is lifetime-extended for the duration of parsing. - init(string: String) { - let codePoints = string.nulTerminatedUTF8 - let buffer = codePoints.withUnsafeBufferPointer { nulTerminatedBuffer in - // don't want to include the nul termination in the buffer - trim it off - UnsafeBufferPointer(start: nulTerminatedBuffer.baseAddress, count: nulTerminatedBuffer.count - 1) - } - self.init(buffer: buffer, owner: codePoints) - } - -} - -extension JSONParser: JSONParserType { - - /// Creates an instance of `JSON` from UTF-8 encoded `NSData`. - /// - parameter data: An instance of `NSData` to parse `JSON` from. - /// - throws: Any `JSONParser.Error` that arises during decoding. - /// - seealso: JSONParser.parse() - public static func createJSONFromData(data: NSData) throws -> JSON { - var parser = JSONParser(utf8Data: data) - return try parser.parse() - } - -} - -// MARK: - Errors - -extension JSONParser { - - /// Enumeration describing possible errors that occur while parsing a JSON - /// document. Most errors include an associated `offset`, representing the - /// offset into the UTF-8 characters making up the document where the error - /// occurred. - public enum Error: ErrorType { - /// The parser ran out of data prematurely. This usually means a value - /// was not escaped, such as a string literal not ending with a double - /// quote. - case EndOfStreamUnexpected - - /// Unexpected non-whitespace data was left around `offset` after - /// parsing all valid JSON. - case EndOfStreamGarbage(offset: Int) - - /// Too many nested objects or arrays occured at the literal started - /// around `offset`. - case ExceededNestingLimit(offset: Int) - - /// A `character` was not a valid start of a value around `offset`. - case ValueInvalid(offset: Int, character: UnicodeScalar) - - /// Badly-formed Unicode escape sequence at `offset`. A Unicode escape - /// uses the text "\u" followed by 4 hex digits, such as "\uF09F\uA684" - /// to represent U+1F984, "UNICORN FACE". - case UnicodeEscapeInvalid(offset: Int) - - /// Badly-formed control character around `offset`. JSON supports - /// backslash-escaped double quotes, slashes, whitespace control codes, - /// and Unicode escape sequences. - case ControlCharacterUnrecognized(offset: Int) - - /// Invalid token, expected `null` around `offset` - case LiteralNilMisspelled(offset: Int) - - /// Invalid token, expected `true` around `offset` - case LiteralTrueMisspelled(offset: Int) - - /// Invalid token, expected `false` around `offset` - case LiteralFalseMisspelled(offset: Int) - - /// Badly-formed collection at given `offset`, expected `,` or `:` - case CollectionMissingSeparator(offset: Int) - - /// While parsing an object literal, a value was found without a key - /// around `offset`. The start of a string literal was expected. - case DictionaryMissingKey(offset: Int) - - /// Badly-formed number with no digits around `offset`. After a decimal - /// point, a number must include some number of digits. - case NumberMissingFractionalDigits(offset: Int) - - /// Badly-formed number with symbols ("-" or "e") but no following - /// digits around `offset`. - case NumberSymbolMissingDigits(offset: Int) - - /// Supplied data is encoded in an unsupported format. - case InvalidUnicodeStreamEncoding(detectedEncoding: JSONEncodingDetector.Encoding) - } - - private enum InternalError: ErrorType { - /// Attempted to parse an integer outside the range of [Int.min, Int.max] - /// or a double outside the range of representable doubles. Note that - /// for doubles, this could be an overflow or an underflow - we don't - /// get enough information from Swift here to know which it is. The number - /// causing the overflow/underflow began at `offset`. - case NumberOverflow(offset: Int) - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONParsing.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONParsing.swift deleted file mode 100644 index 90cb6be23..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONParsing.swift +++ /dev/null @@ -1,126 +0,0 @@ -// -// JSONParsing.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/17/15. -// Copyright © 2015 Big Nerd Ranch. All rights reserved. -// - -import Foundation - -// MARK: - Deserialize JSON - -/// Protocol describing a backend parser that can produce `JSON` from `NSData`. -public protocol JSONParserType { - - /// Creates an instance of `JSON` from `NSData`. - /// - parameter data: An instance of `NSData` to use to create `JSON`. - /// - throws: An error that may arise from calling `JSONObjectWithData(_:options:)` on `NSJSONSerialization` with the given data. - /// - returns: An instance of `JSON`. - static func createJSONFromData(data: NSData) throws -> JSON - -} - -extension JSON { - - /// Create `JSON` from UTF-8 `data`. By default, parses using the - /// Swift-native `JSONParser` backend. - public init(data: NSData, usingParser parser: JSONParserType.Type = JSONParser.self) throws { - self = try parser.createJSONFromData(data) - } - - /// Create `JSON` from UTF-8 `string`. - public init(jsonString: Swift.String, usingParser parser: JSONParserType.Type = JSONParser.self) throws { - self = try parser.createJSONFromData((jsonString as NSString).dataUsingEncoding(NSUTF8StringEncoding) ?? NSData()) - } -} - -// MARK: - NSJSONSerialization - -extension NSJSONSerialization: JSONParserType { - - // MARK: Decode NSData - - /// Use the built-in, Objective-C based JSON parser to create `JSON`. - /// - parameter data: An instance of `NSData`. - /// - returns: An instance of `JSON`. - /// - throws: An error that may arise if the `NSData` cannot be parsed into an object. - public static func createJSONFromData(data: NSData) throws -> JSON { - return makeJSON(try NSJSONSerialization.JSONObjectWithData(data, options: [])) - } - - // MARK: Make JSON - - /// Makes a `JSON` object by matching its argument to a case in the `JSON` enum. - /// - parameter object: The instance of `AnyObject` returned from serializing the JSON. - /// - returns: An instance of `JSON` matching the JSON given to the function. - private static func makeJSON(object: AnyObject) -> JSON { - switch object { - case let n as NSNumber: - let numberType = CFNumberGetType(n) - switch numberType { - case .CharType: - return .Bool(n.boolValue) - - case .ShortType, .IntType, .LongType, .CFIndexType, .NSIntegerType, .SInt8Type, .SInt16Type, .SInt32Type: - return .Int(n.integerValue) - - case .SInt64Type, .LongLongType /* overflows 32-bit Int */: - #if /* 32-bit arch */ arch(arm) || arch(i386) - // Why double, when the Freddy parser would bump to String? - // - // Returning Double avoids making the type depend on whether you're running - // 32-bit or 64-bit code when using the NSJSONSerialization parser. - // NSJSONSerialization appears to bump numbers larger than Int.max to Double on - // 64-bit platforms but use .SInt64Type on 32-bit platforms. - // If we returned a String here, you'd get a String value on 32-bit, - // but a Double value on 64-bit. Instead, we return Double. - // - // This means that, if you switch parsers, - // you'll have to switch from .double to .string for pulling out - // overflowing values, but if you stick with a single parser, - // you at least won't have architecture-dependent lookups! - return .Double(n.doubleValue) - #else - return .Int(n.integerValue) - #endif - - case .Float32Type, .Float64Type, .FloatType, .DoubleType, .CGFloatType: - return .Double(n.doubleValue) - } - - case let arr as [AnyObject]: - return makeJSONArray(arr) - - case let dict as [Swift.String: AnyObject]: - return makeJSONDictionary(dict) - - case let s as Swift.String: - return .String(s) - - default: - return .Null - } - } - - // MARK: Make a JSON Array - - /// Makes a `JSON` array from the object passed in. - /// - parameter jsonArray: The array to transform into a `JSON`. - /// - returns: An instance of `JSON` matching the array. - private static func makeJSONArray(jsonArray: [AnyObject]) -> JSON { - return .Array(jsonArray.map(makeJSON)) - } - - // MARK: Make a JSON Dictionary - - /// Makes a `JSON` dictionary from the Cocoa dictionary passed in. - /// - parameter jsonDict: The dictionary to transform into `JSON`. - /// - returns: An instance of `JSON` matching the dictionary. - private static func makeJSONDictionary(jsonDict: [Swift.String: AnyObject]) -> JSON { - return JSON(jsonDict.lazy.map { (key, value) in - (key, makeJSON(value)) - }) - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONSerializing.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONSerializing.swift deleted file mode 100644 index 343a5a30d..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONSerializing.swift +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2016 Big Nerd Ranch, Inc. Licensed under the MIT license WITHOUT ANY WARRANTY. - -import Foundation - -// MARK: - Serialize JSON - -extension JSON { - - /// Attempt to serialize `JSON` into an `NSData`. - /// - returns: A byte-stream containing the `JSON` ready for wire transfer. - /// - throws: Errors that arise from `NSJSONSerialization`. - /// - see: Foundation.NSJSONSerialization - public func serialize() throws -> NSData { - let obj: AnyObject = toNSJSONSerializationObject() - return try NSJSONSerialization.dataWithJSONObject(obj, options: []) - } - - /// A function to help with the serialization of `JSON`. - /// - returns: An `AnyObject` suitable for `NSJSONSerialization`'s use. - private func toNSJSONSerializationObject() -> AnyObject { - switch self { - case .Array(let jsonArray): - return jsonArray.map { $0.toNSJSONSerializationObject() } - case .Dictionary(let jsonDictionary): - var cocoaDictionary = Swift.Dictionary(minimumCapacity: jsonDictionary.count) - for (key, json) in jsonDictionary { - cocoaDictionary[key] = json.toNSJSONSerializationObject() - } - return cocoaDictionary - case .String(let str): - return str - case .Double(let num): - return num - case .Int(let int): - return int - case .Bool(let b): - return b - case .Null: - return NSNull() - } - - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONSubscripting.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONSubscripting.swift deleted file mode 100644 index 78d35f7e9..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/JSONSubscripting.swift +++ /dev/null @@ -1,705 +0,0 @@ -// -// JSONSubscripting.swift -// Freddy -// -// Created by Zachary Waldowski on 8/15/15. -// Copyright © 2015 Big Nerd Ranch. All rights reserved. -// - -// MARK: JSONPathType - -/// A protocol used to define a path within an instance of `JSON` that leads to some desired value. -/// -/// A custom type, such as a `RawRepresentable` enum, may be made to conform to `JSONPathType` -/// and used with the subscript APIs. -public protocol JSONPathType { - /// Use `self` to key into a `dictionary`. - /// - /// Unlike Swift dictionaries, failing to find a value for a key should throw - /// an error rather than convert to `nil`. - /// - /// Upon failure, implementers should throw an error from `JSON.Error`. - func valueInDictionary(dictionary: [Swift.String : JSON]) throws -> JSON - - /// Use `self` to index into an `array`. - /// - /// Unlike Swift array, attempting to index outside the collection's bounds - /// should throw an error rather than crash. - /// - /// Upon failure, implementers should throw an error from `JSON.Error`. - func valueInArray(array: [JSON]) throws -> JSON -} - -extension JSONPathType { - - /// The default behavior for keying into a dictionary is to throw - /// `JSON.Error.UnexpectedSubscript`. - public func valueInDictionary(dictionary: [Swift.String : JSON]) throws -> JSON { - throw JSON.Error.UnexpectedSubscript(type: Self.self) - } - - /// The default behavior for indexing into an array is to throw - /// `JSON.Error.UnexpectedSubscript`. - public func valueInArray(array: [JSON]) throws -> JSON { - throw JSON.Error.UnexpectedSubscript(type: Self.self) - } - -} - -extension String: JSONPathType { - - /// A method used to retrieve a value from a given dictionary for a specific key. - /// - parameter dictionary: A `Dictionary` with `String` keys and `JSON` values. - /// - throws: `.KeyNotFound` with an associated value of `self`, where `self` is a `String`, - /// should the key not be present within the `JSON`. - /// - returns: The `JSON` value associated with the given key. - public func valueInDictionary(dictionary: [Swift.String : JSON]) throws -> JSON { - guard let next = dictionary[self] else { - throw JSON.Error.KeyNotFound(key: self) - } - return next - } - -} - -extension Int: JSONPathType { - - /// A method used to retrieve a value from a given array for a specific index. - /// - parameter array: An `Array` of `JSON`. - /// - throws: `.IndexOutOfBounds` with an associated value of `self`, where `self` is an `Int`, - /// should the index not be within the valid range for the array of `JSON`. - /// - returns: The `JSON` value found at the given index. - public func valueInArray(array: [JSON]) throws -> JSON { - guard case array.indices = self else { - throw JSON.Error.IndexOutOfBounds(index: self) - } - return array[self] - } - -} - -// MARK: - Subscripting core - -private extension JSON { - - enum SubscriptError: ErrorType { - case SubscriptIntoNull(JSONPathType) - } - - func valueForPathFragment(fragment: JSONPathType, detectNull: Swift.Bool) throws -> JSON { - switch self { - case .Null where detectNull: - throw SubscriptError.SubscriptIntoNull(fragment) - case let .Dictionary(dict): - return try fragment.valueInDictionary(dict) - case let .Array(array): - return try fragment.valueInArray(array) - default: - throw Error.UnexpectedSubscript(type: fragment.dynamicType) - } - } - - func valueAtPath(path: [JSONPathType], detectNull: Swift.Bool = false) throws -> JSON { - var result = self - for fragment in path { - result = try result.valueForPathFragment(fragment, detectNull: detectNull) - } - return result - } - -} - -// MARK: - Subscripting operator - -extension JSON { - - public subscript(key: Swift.String) -> JSON? { - return try? valueForPathFragment(key, detectNull: false) - } - - public subscript(index: Swift.Int) -> JSON? { - return try? valueForPathFragment(index, detectNull: false) - } - -} - -// MARK: - Simple member unpacking - -extension JSON { - - /// Attempts to decode into the returning type from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON`. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An initialized member from the inner JSON. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A given `String` key does not exist inside a - /// descendant `JSON` dictionary. - /// * `IndexOutOfBounds`: A given `Int` index is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A given subscript cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of - /// the `JSON` instance does not match `Decoded`. - public func decode(path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> Decoded { - return try Decoded(json: valueAtPath(path)) - } - - /// Retrieves a `Double` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A floating-point `Double` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func double(path: JSONPathType...) throws -> Swift.Double { - return try Swift.Double(json: valueAtPath(path)) - } - - /// Retrieves an `Int` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A numeric `Int` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func int(path: JSONPathType...) throws -> Swift.Int { - return try Swift.Int(json: valueAtPath(path)) - } - - /// Retrieves a `String` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A textual `String` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func string(path: JSONPathType...) throws -> Swift.String { - return try Swift.String(json: valueAtPath(path)) - } - - /// Retrieves a `Bool` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A truthy `Bool` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func bool(path: JSONPathType...) throws -> Swift.Bool { - return try Swift.Bool(json: valueAtPath(path)) - } - - /// Retrieves a `[JSON]` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: An `Array` of `JSON` elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func array(path: JSONPathType...) throws -> [JSON] { - return try JSON.getArray(valueAtPath(path)) - } - - /// Attempts to decode many values from a descendant JSON array at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An `Array` of decoded elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`, or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - public func arrayOf(path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> [Decoded] { - return try JSON.getArrayOf(valueAtPath(path)) - } - - /// Retrieves a `[String: JSON]` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func dictionary(path: JSONPathType...) throws -> [Swift.String: JSON] { - return try JSON.getDictionary(valueAtPath(path)) - } - - /// Attempts to decode many values from a descendant JSON object at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the value type to decode with. - /// - returns: A `Dictionary` of `String` keys and decoded values. - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)` or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - public func dictionaryOf(path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> [Swift.String: Decoded] { - return try JSON.getDictionaryOf(valueAtPath(path)) - } - -} - -// MARK: - NotFound-Or-Null-to-Optional unpacking - -extension JSON { - - /// An `OptionSetType` used to represent the different options available for subscripting `JSON` with `null` values or missing keys. - /// * `.NullBecomesNil` - Treat `null` values as `nil`. - /// * `.MissingKeyBecomesNil` - Treat missing keys as `nil`. - public struct SubscriptingOptions: OptionSetType { - public let rawValue: Swift.Int - public init(rawValue: Swift.Int) { - self.rawValue = rawValue - } - - /// Treat `null` values as `nil`. - public static let NullBecomesNil = SubscriptingOptions(rawValue: 1 << 0) - /// Treat missing keys as `nil`. - public static let MissingKeyBecomesNil = SubscriptingOptions(rawValue: 1 << 1) - } - - private func mapOptionalAtPath(path: [JSONPathType], alongPath: SubscriptingOptions, @noescape transform: JSON throws -> Value) throws -> Value? { - let detectNull = alongPath.contains(.NullBecomesNil) - let detectNotFound = alongPath.contains(.MissingKeyBecomesNil) - var json: JSON? - do { - json = try valueAtPath(path, detectNull: detectNull) - return try json.map(transform) - } catch Error.IndexOutOfBounds where detectNotFound { - return nil - } catch Error.KeyNotFound where detectNotFound { - return nil - } catch Error.ValueNotConvertible where detectNull && json == .Null { - return nil - } catch SubscriptError.SubscriptIntoNull where detectNull { - return nil - } - } -} - -extension JSON { - - /// Optionally decodes into the returning type from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: A decoded value from the inner JSON if found, or `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decode(path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> Decoded? { - return try mapOptionalAtPath(path, alongPath: options, transform: Decoded.init) - } - - /// Optionally retrieves a `Double` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON`. - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A `Double` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func double(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.Double? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Double.init) - } - - /// Optionally retrieves a `Int` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A numeric `Int` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func int(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.Int? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Int.init) - } - - /// Optionally retrieves a `String` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A text `String` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func string(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.String? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.String.init) - } - - /// Optionally retrieves a `Bool` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A truthy `Bool` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func bool(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.Bool? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Bool.init) - } - - /// Optionally retrieves a `[JSON]` from a path into the recieving structure. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: An `Array` of `JSON` elements if a value could be found, - /// otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func array(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> [JSON]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArray) - } - - /// Optionally decodes many values from a descendant array at a path into - /// JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the value type to decode with. - /// - returns: An `Array` of decoded elements if found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func arrayOf(path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> [Decoded]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArrayOf) - } - - /// Optionally retrieves a `[String: JSON]` from a path into the recieving - /// structure. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A `Dictionary` of `String` mapping to `JSON` elements if a - /// value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func dictionary(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> [Swift.String: JSON]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionary) - } - - /// Optionally attempts to decode many values from a descendant object at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the value type to decode with. - /// - returns: A `Dictionary` of `String` mapping to decoded elements if a - /// value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func dictionaryOf(path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> [Swift.String: Decoded]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionaryOf) - } - -} - -// MARK: - Missing-with-fallback unpacking - -extension JSON { - - private func mapOptionalAtPath(path: [JSONPathType], @noescape fallback: () -> Value, @noescape transform: JSON throws -> Value) throws -> Value { - return try mapOptionalAtPath(path, alongPath: .MissingKeyBecomesNil, transform: transform) ?? fallback() - } - - /// Attempts to decode into the returning type from a path into - /// JSON, or returns a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Value to use when one is missing at the subscript. - /// - returns: An initialized member from the inner JSON. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `UnexpectedSubscript`: A given subscript cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of - /// the `JSON` instance does not match `Decoded`. - public func decode(path: JSONPathType..., @autoclosure or fallback: () -> Decoded) throws -> Decoded { - return try mapOptionalAtPath(path, fallback: fallback, transform: Decoded.init) - } - - /// Retrieves a `Double` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Double` to use when one is missing at the subscript. - /// - returns: A floating-point `Double` - /// - throws: One of the `JSON.Error` cases thrown by calling `mapOptionalAtPath(_:fallback:transform:)`. - /// - seealso: `optionalAtPath(_:ifNotFound)`. - public func double(path: JSONPathType..., @autoclosure or fallback: () -> Swift.Double) throws -> Swift.Double { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.Double.init) - } - - /// Retrieves an `Int` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Int` to use when one is missing at the subscript. - /// - returns: A numeric `Int` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func int(path: JSONPathType..., @autoclosure or fallback: () -> Swift.Int) throws -> Swift.Int { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.Int.init) - } - - /// Retrieves a `String` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `String` to use when one is missing at the subscript. - /// - returns: A textual `String` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func string(path: JSONPathType..., @autoclosure or fallback: () -> Swift.String) throws -> Swift.String { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.String.init) - } - - /// Retrieves a `Bool` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Bool` to use when one is missing at the subscript. - /// - returns: A truthy `Bool` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func bool(path: JSONPathType..., @autoclosure or fallback: () -> Swift.Bool) throws -> Swift.Bool { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.Bool.init) - } - - /// Retrieves a `[JSON]` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Array` to use when one is missing at the subscript. - /// - returns: An `Array` of `JSON` elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func array(path: JSONPathType..., @autoclosure or fallback: () -> [JSON]) throws -> [JSON] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getArray) - } - - /// Attempts to decodes many values from a desendant JSON array at a path - /// into the recieving structure, returning a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Array` to use when one is missing at the subscript. - /// - returns: An `Array` of decoded elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func arrayOf(path: JSONPathType..., @autoclosure or fallback: () -> [Decoded]) throws -> [Decoded] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getArrayOf) - } - - /// Retrieves a `[String: JSON]` from a path into JSON or a fallback if not - /// found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Dictionary` to use when one is missing at the subscript. - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func dictionary(path: JSONPathType..., @autoclosure or fallback: () -> [Swift.String: JSON]) throws -> [Swift.String: JSON] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getDictionary) - } - - /// Attempts to decode many values from a descendant JSON object at a path - /// into the receiving structure, returning a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Value to use when one is missing at the subscript - /// - returns: A `Dictionary` of `String` mapping to decoded elements. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func dictionaryOf(path: JSONPathType..., @autoclosure or fallback: () -> [Swift.String: Decoded]) throws -> [Swift.String: Decoded] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getDictionaryOf) - } - - -} - -// MARK: - Deprecated methods - -extension JSON { - - @available(*, deprecated, message="Use 'decode(_:alongPath:type:)' with options '[.MissingKeyBecomesNil]'") - public func decode(path: JSONPathType..., ifNotFound: Swift.Bool, type: Decoded.Type = Decoded.self) throws -> Decoded? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Decoded.init) - } - - @available(*, deprecated, message="Use 'decode(_:alongPath:type:)' with options '[.NullBecomesNil]'") - public func decode(path: JSONPathType..., ifNull: Swift.Bool, type: Decoded.Type = Decoded.self) throws -> Decoded? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Decoded.init) - } - - @available(*, deprecated, message="Use 'double(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func double(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.Double? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Double.init) - } - - @available(*, deprecated, message="Use 'double(_:alongPath:)' with options '[.NullBecomesNil]'") - public func double(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.Double? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Double.init) - } - - @available(*, deprecated, message="Use 'int(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func int(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.Int? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Int.init) - } - - @available(*, deprecated, message="Use 'int(_:alongPath:)' with options '[.NullBecomesNil]'") - public func int(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.Int? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Int.init) - } - - @available(*, deprecated, message="Use 'string(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func string(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.String? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.String.init) - } - - @available(*, deprecated, message="Use 'string(_:alongPath:)' with options '[.NullBecomesNil]'") - public func string(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.String? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.String.init) - } - - @available(*, deprecated, message="Use 'bool(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func bool(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.Bool? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Bool.init) - } - - @available(*, deprecated, message="Use 'bool(_:alongPath:)' with options '[.NullBecomesNil]'") - public func bool(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.Bool? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Bool.init) - } - - @available(*, deprecated, message="Use 'array(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func array(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> [JSON]? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArray) - } - - @available(*, deprecated, message="Use 'array(_:alongPath:)' with options '[.NullBecomesNil]'") - public func array(path: JSONPathType..., ifNull: Swift.Bool) throws -> [JSON]? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArray) - } - - @available(*, deprecated, message="Use 'arrayOf(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func arrayOf(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> [Decoded]? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArrayOf) - } - - @available(*, deprecated, message="Use 'arrayOf(_:alongPath:)' with options '[.NullBecomesNil]'") - public func arrayOf(path: JSONPathType..., ifNull: Swift.Bool) throws -> [Decoded]? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArrayOf) - } - - @available(*, deprecated, message="Use 'dictionary(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func dictionary(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> [Swift.String: JSON]? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionary) - } - - @available(*, deprecated, message="Use 'dictionary(_:alongPath:)' with options '[.NullBecomesNil]'") - public func dictionary(path: JSONPathType..., ifNull: Swift.Bool) throws -> [Swift.String: JSON]? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionary) - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/main.swift b/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/main.swift deleted file mode 100644 index f34af41af..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20160830/test_Freddy/main.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// main.swift -// test_Freddy -// -// Created by nst on 10/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard Process.arguments.count == 2 else { - let url = NSURL(fileURLWithPath: Process.arguments[0]) - guard let programName = url.lastPathComponent else { exit(1) } - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = Process.arguments[1] - let url = NSURL.fileURLWithPath(path) - - guard let data = NSData(contentsOfURL:url) else { - print("*** CANNOT READ DATA AT \(url)") - return - } - - var p = JSONParser(utf8Data: data) - do { - try p.parse() - exit(0) - } catch { - exit(1) - } -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/bin/test_Freddy b/tests/JSONTestSuite/parsers/test_Freddy_20161018/bin/test_Freddy deleted file mode 100755 index 5f6c85c6b..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Freddy_20161018/bin/test_Freddy and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.pbxproj deleted file mode 100644 index f4cac1cdd..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.pbxproj +++ /dev/null @@ -1,300 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03D84ABB1D5B0A1000776402 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03D84ABA1D5B0A1000776402 /* main.swift */; }; - 03F8F7811D5B75600021630C /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7781D5B75600021630C /* JSON.swift */; }; - 03F8F7821D5B75600021630C /* JSONDecodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7791D5B75600021630C /* JSONDecodable.swift */; }; - 03F8F7831D5B75600021630C /* JSONEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77A1D5B75600021630C /* JSONEncodable.swift */; }; - 03F8F7841D5B75600021630C /* JSONEncodingDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */; }; - 03F8F7851D5B75600021630C /* JSONLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */; }; - 03F8F7861D5B75600021630C /* JSONParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77D1D5B75600021630C /* JSONParser.swift */; }; - 03F8F7871D5B75600021630C /* JSONParsing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77E1D5B75600021630C /* JSONParsing.swift */; }; - 03F8F7881D5B75600021630C /* JSONSerializing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77F1D5B75600021630C /* JSONSerializing.swift */; }; - 03F8F7891D5B75600021630C /* JSONSubscripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7801D5B75600021630C /* JSONSubscripting.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03D84AB51D5B0A1000776402 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03D84AB71D5B0A1000776402 /* test_Freddy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_Freddy; sourceTree = BUILT_PRODUCTS_DIR; }; - 03D84ABA1D5B0A1000776402 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 03F8F7781D5B75600021630C /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSON.swift; path = test_Freddy/JSON.swift; sourceTree = ""; }; - 03F8F7791D5B75600021630C /* JSONDecodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONDecodable.swift; path = test_Freddy/JSONDecodable.swift; sourceTree = ""; }; - 03F8F77A1D5B75600021630C /* JSONEncodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONEncodable.swift; path = test_Freddy/JSONEncodable.swift; sourceTree = ""; }; - 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONEncodingDetector.swift; path = test_Freddy/JSONEncodingDetector.swift; sourceTree = ""; }; - 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONLiteralConvertible.swift; path = test_Freddy/JSONLiteralConvertible.swift; sourceTree = ""; }; - 03F8F77D1D5B75600021630C /* JSONParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONParser.swift; path = test_Freddy/JSONParser.swift; sourceTree = ""; }; - 03F8F77E1D5B75600021630C /* JSONParsing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONParsing.swift; path = test_Freddy/JSONParsing.swift; sourceTree = ""; }; - 03F8F77F1D5B75600021630C /* JSONSerializing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSerializing.swift; path = test_Freddy/JSONSerializing.swift; sourceTree = ""; }; - 03F8F7801D5B75600021630C /* JSONSubscripting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSubscripting.swift; path = test_Freddy/JSONSubscripting.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03D84AB41D5B0A1000776402 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03D84AAE1D5B0A1000776402 = { - isa = PBXGroup; - children = ( - 03F8F7781D5B75600021630C /* JSON.swift */, - 03F8F7791D5B75600021630C /* JSONDecodable.swift */, - 03F8F77A1D5B75600021630C /* JSONEncodable.swift */, - 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */, - 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */, - 03F8F77D1D5B75600021630C /* JSONParser.swift */, - 03F8F77E1D5B75600021630C /* JSONParsing.swift */, - 03F8F77F1D5B75600021630C /* JSONSerializing.swift */, - 03F8F7801D5B75600021630C /* JSONSubscripting.swift */, - 03D84AB91D5B0A1000776402 /* test_Freddy */, - 03D84AB81D5B0A1000776402 /* Products */, - ); - sourceTree = ""; - }; - 03D84AB81D5B0A1000776402 /* Products */ = { - isa = PBXGroup; - children = ( - 03D84AB71D5B0A1000776402 /* test_Freddy */, - ); - name = Products; - sourceTree = ""; - }; - 03D84AB91D5B0A1000776402 /* test_Freddy */ = { - isa = PBXGroup; - children = ( - 03D84ABA1D5B0A1000776402 /* main.swift */, - ); - path = test_Freddy; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03D84AB61D5B0A1000776402 /* test_Freddy */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03D84ABE1D5B0A1000776402 /* Build configuration list for PBXNativeTarget "test_Freddy" */; - buildPhases = ( - 03D84AB31D5B0A1000776402 /* Sources */, - 03D84AB41D5B0A1000776402 /* Frameworks */, - 03D84AB51D5B0A1000776402 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_Freddy; - productName = test_Freddy; - productReference = 03D84AB71D5B0A1000776402 /* test_Freddy */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03D84AAF1D5B0A1000776402 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03D84AB61D5B0A1000776402 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - DevelopmentTeamName = "Nicolas Seriot"; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03D84AB21D5B0A1000776402 /* Build configuration list for PBXProject "test_Freddy" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03D84AAE1D5B0A1000776402; - productRefGroup = 03D84AB81D5B0A1000776402 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03D84AB61D5B0A1000776402 /* test_Freddy */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03D84AB31D5B0A1000776402 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03F8F7881D5B75600021630C /* JSONSerializing.swift in Sources */, - 03F8F7821D5B75600021630C /* JSONDecodable.swift in Sources */, - 03F8F7851D5B75600021630C /* JSONLiteralConvertible.swift in Sources */, - 03F8F7871D5B75600021630C /* JSONParsing.swift in Sources */, - 03F8F7861D5B75600021630C /* JSONParser.swift in Sources */, - 03F8F7831D5B75600021630C /* JSONEncodable.swift in Sources */, - 03D84ABB1D5B0A1000776402 /* main.swift in Sources */, - 03F8F7811D5B75600021630C /* JSON.swift in Sources */, - 03F8F7891D5B75600021630C /* JSONSubscripting.swift in Sources */, - 03F8F7841D5B75600021630C /* JSONEncodingDetector.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03D84ABC1D5B0A1000776402 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 03D84ABD1D5B0A1000776402 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03D84ABF1D5B0A1000776402 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 03D84AC01D5B0A1000776402 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03D84AB21D5B0A1000776402 /* Build configuration list for PBXProject "test_Freddy" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03D84ABC1D5B0A1000776402 /* Debug */, - 03D84ABD1D5B0A1000776402 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03D84ABE1D5B0A1000776402 /* Build configuration list for PBXNativeTarget "test_Freddy" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03D84ABF1D5B0A1000776402 /* Debug */, - 03D84AC01D5B0A1000776402 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03D84AAF1D5B0A1000776402 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 95e4cc57e..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint deleted file mode 100644 index fcf13a138..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint +++ /dev/null @@ -1,30 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" : 0, - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : 0 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7B3DFA55-F9BF-41D8-8FD5-204D3162EB03", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" : "dropbox\/JSON\/test_Freddy\/Vendor\/Freddy\/", - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : "dropbox\/" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "test_Freddy", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "JSON\/test_Freddy\/test_Freddy.xcodeproj", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/bignerdranch\/Freddy.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "\/Users\/nst\/Dropbox\/dropbox.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" - } - ] -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 7282d15f6..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme deleted file mode 100644 index e31043938..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index b27bc09bd..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_Freddy.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03D84AB61D5B0A1000776402 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSON.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSON.swift deleted file mode 100755 index ebe2a9239..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSON.swift +++ /dev/null @@ -1,98 +0,0 @@ -// -// JSON.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/17/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -/// An enum to describe the structure of JSON. -public enum JSON { - /// A case for denoting an array with an associated value of `[JSON]` - case array([JSON]) - /// A case for denoting a dictionary with an associated value of `[Swift.String: JSON]` - case dictionary([String: JSON]) - /// A case for denoting a double with an associated value of `Swift.Double`. - case double(Double) - /// A case for denoting an integer with an associated value of `Swift.Int`. - case int(Int) - /// A case for denoting a string with an associated value of `Swift.String`. - case string(String) - /// A case for denoting a boolean with an associated value of `Swift.Bool`. - case bool(Bool) - /// A case for denoting null. - case null -} - -// MARK: - Errors - -extension JSON { - - /// An enum to encapsulate errors that may arise in working with `JSON`. - public enum Error: Swift.Error { - /// The `index` is out of bounds for a JSON array - case indexOutOfBounds(index: Int) - - /// The `key` was not found in the JSON dictionary - case keyNotFound(key: String) - - /// The JSON is not subscriptable with `type` - case unexpectedSubscript(type: JSONPathType.Type) - - /// Unexpected JSON `value` was found that is not convertible `to` type - case valueNotConvertible(value: JSON, to: Any.Type) - - /// The JSON is not serializable to a `String`. - case stringSerializationError - } - -} - -// MARK: - Test Equality - -/// Return `true` if `lhs` is equal to `rhs`. -public func ==(lhs: JSON, rhs: JSON) -> Bool { - switch (lhs, rhs) { - case (.array(let arrL), .array(let arrR)): - return arrL == arrR - case (.dictionary(let dictL), .dictionary(let dictR)): - return dictL == dictR - case (.string(let strL), .string(let strR)): - return strL == strR - case (.double(let dubL), .double(let dubR)): - return dubL == dubR - case (.double(let dubL), .int(let intR)): - return dubL == Double(intR) - case (.int(let intL), .int(let intR)): - return intL == intR - case (.int(let intL), .double(let dubR)): - return Double(intL) == dubR - case (.bool(let bL), .bool(let bR)): - return bL == bR - case (.null, .null): - return true - default: - return false - } -} - -extension JSON: Equatable {} - -// MARK: - Printing - -extension JSON: CustomStringConvertible { - - /// A textual representation of `self`. - public var description: Swift.String { - switch self { - case .array(let arr): return String(describing: arr) - case .dictionary(let dict): return String(describing: dict) - case .string(let string): return string - case .double(let double): return String(describing: double) - case .int(let int): return String(describing: int) - case .bool(let bool): return String(describing: bool) - case .null: return "null" - } - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONDecodable.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONDecodable.swift deleted file mode 100755 index ea4c03649..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONDecodable.swift +++ /dev/null @@ -1,186 +0,0 @@ -// -// JSONDecodable.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/24/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -/// A protocol to provide functionality for creating a model object with a `JSON` -/// value. -public protocol JSONDecodable { - - /// Creates an instance of the model with a `JSON` instance. - /// - parameter json: An instance of a `JSON` value from which to - /// construct an instance of the implementing type. - /// - throws: Any `JSON.Error` for errors derived from inspecting the - /// `JSON` value, or any other error involved in decoding. - init(json: JSON) throws - -} - -extension Double: JSONDecodable { - - /// An initializer to create an instance of `Double` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Double` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - if case let .double(double) = json { - self = double - } else if case let .int(int) = json { - self = Double(int) - } else if case let .string(string) = json, let s = Double(string) { - self = s - } else { - throw JSON.Error.valueNotConvertible(value: json, to: Double.self) - } - } - -} - -extension Int: JSONDecodable { - - /// An initializer to create an instance of `Int` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Int` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - - if case let .double(double) = json, double <= Double(Int.max) { - self = Int(double) - } else if case let .int(int) = json { - self = int - } else if case let .string(string) = json, let int = Int(string) { - self = int - } else if case let .string(string) = json, - let double = Double(string), - let decimalSeparator = string.characters.index(of: "."), - let int = Int(String(string.characters.prefix(upTo: decimalSeparator))), - double == Double(int) { - self = int - } else { - throw JSON.Error.valueNotConvertible(value: json, to: Int.self) - } - } - -} - -extension String: JSONDecodable { - - /// An initializer to create an instance of `String` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `String` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - switch json { - case let .string(string): - self = string - case let .int(int): - self = String(int) - case let .bool(bool): - self = String(bool) - case let .double(double): - self = String(double) - default: - throw JSON.Error.valueNotConvertible(value: json, to: String.self) - } - } - -} - -extension Bool: JSONDecodable { - - /// An initializer to create an instance of `Bool` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Bool` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - guard case let .bool(bool) = json else { - throw JSON.Error.valueNotConvertible(value: json, to: Bool.self) - } - self = bool - } - -} - -extension RawRepresentable where RawValue: JSONDecodable { - - /// An initializer to create an instance of `RawRepresentable` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `RawRepresentable` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - let raw = try json.decode(type: RawValue.self) - guard let value = Self(rawValue: raw) else { - throw JSON.Error.valueNotConvertible(value: json, to: Self.self) - } - self = value - } -} - -internal extension JSON { - - /// Retrieves a `[JSON]` from the JSON. - /// - parameter: A `JSON` to be used to create the returned `Array`. - /// - returns: An `Array` of `JSON` elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`. - /// - seealso: `JSON.decode(_:type:)` - static func getArray(from json: JSON) throws -> [JSON] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Array. - guard case let .array(array) = json else { - throw Error.valueNotConvertible(value: json, to: Swift.Array) - } - return array - } - - /// Retrieves a `[String: JSON]` from the JSON. - /// - parameter: A `JSON` to be used to create the returned `Dictionary`. - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`. - /// - seealso: `JSON.decode(_:type:)` - static func getDictionary(from json: JSON) throws -> [String: JSON] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Dictionary. - guard case let .dictionary(dictionary) = json else { - throw Error.valueNotConvertible(value: json, to: Swift.Dictionary) - } - return dictionary - } - - /// Attempts to decode many values from a descendant JSON array at a path - /// into JSON. - /// - parameter json: A `JSON` to be used to create the returned `Array` of some type conforming to `JSONDecodable`. - /// - returns: An `Array` of `Decoded` elements. - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`, as - /// well as any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - static func decodedArray(from json: JSON) throws -> [Decoded] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Dictionary. - // This implementation also doesn't do the `type = Type.self` trick. - return try getArray(from: json).map(Decoded.init) - } - - /// Attempts to decode many values from a descendant JSON object at a path - /// into JSON. - /// - parameter json: A `JSON` to be used to create the returned `Dictionary` of some type conforming to `JSONDecodable`. - /// - returns: A `Dictionary` of string keys and `Decoded` values. - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)` or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - static func decodedDictionary(from json: JSON) throws -> [Swift.String: Decoded] { - guard case let .dictionary(dictionary) = json else { - throw Error.valueNotConvertible(value: json, to: Swift.Dictionary) - } - var decodedDictionary = Swift.Dictionary(minimumCapacity: dictionary.count) - for (key, value) in dictionary { - decodedDictionary[key] = try Decoded(json: value) - } - return decodedDictionary - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONEncodable.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONEncodable.swift deleted file mode 100755 index 7da5fd007..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONEncodable.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// JSONEncodable.swift -// Freddy -// -// Created by Matthew Mathias on 1/4/16. -// Copyright © 2016 Big Nerd Ranch. All rights reserved. -// - -import Foundation - -/// A protocol to facilitate encoding and decoding of `JSON`. -public protocol JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON`. - /// - Note: If conforming to `JSONEncodable` with a custom type of your own, you should return an instance of - /// `JSON.dictionary`. - func toJSON() -> JSON -} - -extension Array where Element: JSONEncodable { - /// Converts an instance of `Array` whose elements conform to `JSONEncodable` to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.array`. - public func toJSON() -> JSON { - let arrayOfJSON = self.map { $0.toJSON() } - return .array(arrayOfJSON) - } -} - -extension Dictionary where Value: JSONEncodable { - /// Converts an instance of `Dictionary` whose values conform to `JSONEncodable` to `JSON`. The keys in the resulting - /// `JSON.dictionary` will be of type `String`. - /// - returns: An instance of `JSON` where the enum case is `.dictionary`. - public func toJSON() -> JSON { - var jsonDictionary = [String: JSON]() - - for (k, v) in self { - let key = String(describing: k) - jsonDictionary[key] = v.toJSON() - } - - return .dictionary(jsonDictionary) - } -} - -extension Int: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.int`. - public func toJSON() -> JSON { - return .int(self) - } -} - -extension Double: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.double`. - public func toJSON() -> JSON { - return .double(self) - } -} - -extension String: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.string`. - public func toJSON() -> JSON { - return .string(self) - } -} - -extension Bool: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.bool`. - public func toJSON() -> JSON { - return .bool(self) - } -} - -extension RawRepresentable where RawValue: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is whatever the underlying `RawValue` converts to. - public func toJSON() -> JSON { - return rawValue.toJSON() - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONEncodingDetector.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONEncodingDetector.swift deleted file mode 100755 index 84410f198..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONEncodingDetector.swift +++ /dev/null @@ -1,110 +0,0 @@ -// -// JSONEncodingDetector.swift -// Freddy -// -// Created by Robert Edwards on 1/27/16. -// Copyright © 2016 Big Nerd Ranch. All rights reserved. -// - -/// Struct for attempting to detect the Unicode encoding used with the data supplied to the JSONParser -public struct JSONEncodingDetector { - - //// The Unicode encodings looked for during detection - public enum Encoding { - //// UTF-8 - case utf8 - //// UTF-16 Little Endian - case utf16LE - //// UTF-16 Big Endian - case utf16BE - //// UTF-32 Little Endian - case utf32LE - //// UTF-32 Big Endian - case utf32BE - } - - //// The Unicode encodings supported by JSONParser.swift - public static let supportedEncodings: [Encoding] = [.utf8] - - typealias ByteStreamPrefixInformation = (encoding: Encoding, byteOrderMarkLength: Int) - - //// Attempts to detect the Unicode encoding used for a given set of data. - //// - //// This function initially looks for a Byte Order Mark in the following form: - //// - //// Bytes | Encoding Form - //// --------------|---------------- - //// 00 00 FE FF | UTF-32, big-endian - //// FF FE 00 00 | UTF-32, little-endian - //// FE FF | UTF-16, big-endian - //// FF FE | UTF-16, little-endian - //// EF BB BF | UTF-8 - //// - //// If a BOM is not found then we detect using the following approach described in - //// the JSON RFC http://www.ietf.org/rfc/rfc4627.txt: - //// - //// Since the first two characters of a JSON text will always be ASCII - //// characters [RFC0020], it is possible to determine whether an octet - //// stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking - //// at the pattern of nulls in the first four octets. - //// - //// 00 00 00 xx UTF-32BE - //// 00 xx 00 xx UTF-16BE - //// xx 00 00 00 UTF-32LE - //// xx 00 xx 00 UTF-16LE - //// xx xx xx xx UTF-8 - //// - //// - parameter header: The front Slice of data being read and evaluated. - //// - returns: A tuple containing the detected Unicode encoding and the lenght of the byte order mark. - static func detectEncoding(_ header: RandomAccessSlice>) -> ByteStreamPrefixInformation { - - guard let prefix = prefixFromHeader(header) else { - return (.utf8, 0) - } - - if let prefixInfo = JSONEncodingDetector.encodingFromBOM(prefix) { - return prefixInfo - } else { - switch prefix { - case(0, 0, 0?, _): - return (.utf32BE, 0) - case(_, 0, 0?, 0?): - return (.utf32LE, 0) - case (0, _, 0?, _), (0, _, _, _): - return (.utf16BE, 0) - case (_, 0, _, 0?), (_, 0, _, _): - return (.utf16LE, 0) - default: - return (.utf8, 0) - } - } - } - - private typealias EncodingBytePrefix = (UInt8, UInt8, UInt8?, UInt8?) - - private static func prefixFromHeader(_ header: RandomAccessSlice>) -> EncodingBytePrefix? { - if header.count >= 4 { - return(header[0], header[1], header[2], header[3]) - } else if header.count >= 2 { - return (header[0], header[1], nil, nil) - } - return nil - } - - private static func encodingFromBOM(_ prefix: EncodingBytePrefix) -> ByteStreamPrefixInformation? { - switch prefix { - case(0xFE, 0xFF, _, _): - return (.utf16BE, 2) - case(0x00, 0x00, 0xFE?, 0xFF?): - return (.utf32BE, 4) - case(0xEF, 0xBB, 0xBF?, _): - return (.utf8, 3) - case(0xFF, 0xFE, 0?, 0?): - return (.utf32LE, 4) - case(0xFF, 0xFE, _, _): - return (.utf16LE, 2) - default: - return nil - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONLiteralConvertible.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONLiteralConvertible.swift deleted file mode 100755 index 885428818..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONLiteralConvertible.swift +++ /dev/null @@ -1,134 +0,0 @@ -// -// JSONLiteralConvertible.swift -// Freddy -// -// Created by Zachary Waldowski on 5/11/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -// MARK: - ArrayLiteralConvertible - -extension JSON: ExpressibleByArrayLiteral { - - /// Create an instance by copying each element of the `collection` into a - /// new `Array`. - public init(_ collection: Collection) where Collection.Iterator.Element == JSON { - self = .array(Swift.Array(collection)) - } - - /// Create an instance initialized with `elements`. - public init(arrayLiteral elements: JSON...) { - self.init(elements) - } - -} - -// MARK: - DictionaryLiteralConvertible - -extension JSON: ExpressibleByDictionaryLiteral { - - /// Create an instance by copying each key/value pair of the `pairs` into - /// a new `Dictionary`. - public init(_ pairs: Dictionary) where Dictionary.Iterator.Element == (Swift.String, JSON) { - var dictionary = Swift.Dictionary(minimumCapacity: pairs.underestimatedCount) - for (key, value) in pairs { - dictionary[key] = value - } - self.init(dictionary) - } - - /// Create an instance initialized with `pairs`. - public init(dictionaryLiteral pairs: (Swift.String, JSON)...) { - self.init(pairs) - } - - /// Create an instance initialized to `dictionary`. - public init(_ dictionary: Swift.Dictionary) { - self = .dictionary(dictionary) - } -} - -// MARK: - FloatLiteralConvertible - -extension JSON: ExpressibleByFloatLiteral { - - /// Create an instance initialized to `Double` `value`. - public init(_ value: Swift.Double) { - self = .double(value) - } - - /// Create a literal instance initialized to `value`. - public init(floatLiteral value: Swift.Double) { - self.init(value) - } - -} - -// MARK: - IntegerLiteralConvertible - -extension JSON: ExpressibleByIntegerLiteral { - - /// Create an instance initialized to `Int` by `value`. - public init(_ value: Swift.Int) { - self = .int(value) - } - - /// Create a literal instance initialized to `value`. - public init(integerLiteral value: Swift.Int) { - self.init(value) - } - -} - -// MARK: - StringLiteralConvertible - -extension JSON: ExpressibleByStringLiteral { - - /// Create an instance initialized to `String` by `text`. - public init(_ text: Swift.String) { - self = .string(text) - } - - /// Create a literal instance initialized to `value`. - public init(stringLiteral value: StringLiteralType) { - self.init(value) - } - - /// Create a literal instance initialized to `value`. - public init(extendedGraphemeClusterLiteral value: StringLiteralType) { - self.init(value) - } - - /// Create a literal instance initialized to `value`. - public init(unicodeScalarLiteral value: StringLiteralType) { - self.init(value) - } - -} - -// MARK: - BooleanLiteralConvertible - -extension JSON: ExpressibleByBooleanLiteral { - - /// Create an instance initialized to `Bool` by `value`. - public init(_ value: Swift.Bool) { - self = .bool(value) - } - - /// Create a literal instance initialized to `value`. - public init(booleanLiteral value: Swift.Bool) { - self.init(value) - } - -} - -// MARK: - NilLiteralConvertible - -extension JSON: ExpressibleByNilLiteral { - - /// Create an instance initialized with `nil`. - public init(nilLiteral: ()) { - self = .null - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONParser.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONParser.swift deleted file mode 100755 index 31ddaa9bf..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONParser.swift +++ /dev/null @@ -1,918 +0,0 @@ -// -// JSONParser.swift -// Freddy -// -// Created by John Gallagher on 4/18/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -import Foundation - -private struct Literal { - static let BACKSLASH = UInt8(ascii: "\\") - static let BACKSPACE = UInt8(ascii: "\u{0008}") - static let COLON = UInt8(ascii: ":") - static let COMMA = UInt8(ascii: ",") - static let DOUBLE_QUOTE = UInt8(ascii: "\"") - static let FORMFEED = UInt8(ascii: "\u{000c}") - static let LEFT_BRACE = UInt8(ascii: "{") - static let LEFT_BRACKET = UInt8(ascii: "[") - static let MINUS = UInt8(ascii: "-") - static let NEWLINE = UInt8(ascii: "\n") - static let PERIOD = UInt8(ascii: ".") - static let PLUS = UInt8(ascii: "+") - static let RETURN = UInt8(ascii: "\r") - static let RIGHT_BRACE = UInt8(ascii: "}") - static let RIGHT_BRACKET = UInt8(ascii: "]") - static let SLASH = UInt8(ascii: "/") - static let SPACE = UInt8(ascii: " ") - static let TAB = UInt8(ascii: "\t") - - static let a = UInt8(ascii: "a") - static let b = UInt8(ascii: "b") - static let c = UInt8(ascii: "c") - static let d = UInt8(ascii: "d") - static let e = UInt8(ascii: "e") - static let f = UInt8(ascii: "f") - static let l = UInt8(ascii: "l") - static let n = UInt8(ascii: "n") - static let r = UInt8(ascii: "r") - static let s = UInt8(ascii: "s") - static let t = UInt8(ascii: "t") - static let u = UInt8(ascii: "u") - - static let A = UInt8(ascii: "A") - static let B = UInt8(ascii: "B") - static let C = UInt8(ascii: "C") - static let D = UInt8(ascii: "D") - static let E = UInt8(ascii: "E") - static let F = UInt8(ascii: "F") - - static let zero = UInt8(ascii: "0") - static let one = UInt8(ascii: "1") - static let two = UInt8(ascii: "2") - static let three = UInt8(ascii: "3") - static let four = UInt8(ascii: "4") - static let five = UInt8(ascii: "5") - static let six = UInt8(ascii: "6") - static let seven = UInt8(ascii: "7") - static let eight = UInt8(ascii: "8") - static let nine = UInt8(ascii: "9") -} - -private let ParserMaximumDepth = 512 - - -/// A pure Swift JSON parser. This parser is much faster than the -/// `NSJSONSerialization`-based parser (due to the overhead of having to -/// dynamically cast the Objective-C objects to determine their type); however, -/// it is much newer and has restrictions that the `NSJSONSerialization` parser -/// does not. Two restrictions in particular are that it requires UTF-8 data as -/// input and it does not allow trailing commas in arrays or dictionaries. -public struct JSONParser { - - fileprivate enum Sign: Int { - case positive = 1 - case negative = -1 - } - - private let input: UnsafeBufferPointer - private var loc = 0 - private var depth = 0 - - fileprivate init(input: UnsafeBufferPointer) { - self.input = input - } - - /// Decode the root element of the `JSON` stream. This may be any fragment - /// or a structural element, per RFC 7159. - /// - /// The beginning bytes are used to determine the stream's encoding. - /// `JSONParser` currently only supports UTF-8 encoding, with or without - /// a byte-order mark. - /// - /// - throws: `JSONParser.Error` for any decoding failures, including a - /// source location if needed. - public mutating func parse() throws -> JSON { - try guardAgainstUnsupportedEncodings() - let value = try parseValue() - skipWhitespace() - guard loc == input.count else { - throw Error.endOfStreamGarbage(offset: loc) - } - return value - } - - private mutating func parseValue() throws -> JSON { - guard depth <= ParserMaximumDepth else { - throw Error.exceededNestingLimit(offset: loc) - } - - guard input.count > 0 else { - throw Error.endOfStreamUnexpected - } - - advancing: while loc < input.count { - do { - switch input[loc] { - case Literal.LEFT_BRACKET: - depth += 1 - defer { depth -= 1 } - return try decodeArray() - - case Literal.LEFT_BRACE: - depth += 1 - defer { depth -= 1 } - return try decodeObject() - - case Literal.DOUBLE_QUOTE: - return try decodeString() - - case Literal.f: - return try decodeFalse() - - case Literal.n: - return try decodeNull() - - case Literal.t: - return try decodeTrue() - - case Literal.MINUS: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .leadingMinus)) - - case Literal.zero: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .leadingZero)) - - case Literal.one...Literal.nine: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .preDecimalDigits)) - - case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE: - loc = (loc + 1) - - default: - break advancing - } - } catch let InternalError.numberOverflow(offset: start) { - return try decodeNumberAsString(from: start) - } - } - if loc < input.count { - throw Error.valueInvalid(offset: loc, character: UnicodeScalar(input[loc])) - } else { - throw Error.endOfStreamUnexpected - } - } - - private mutating func skipWhitespace() { - while loc < input.count { - switch input[loc] { - case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE: - loc = (loc + 1) - default: - return - } - } - } - - private mutating func guardAgainstUnsupportedEncodings() throws { - let header = input.prefix(4) - let encodingPrefixInformation = JSONEncodingDetector.detectEncoding(header) - guard JSONEncodingDetector.supportedEncodings.contains(encodingPrefixInformation.encoding) else { - throw Error.invalidUnicodeStreamEncoding(detectedEncoding: encodingPrefixInformation.encoding) - } - loc = loc.advanced(by: encodingPrefixInformation.byteOrderMarkLength) - } - - private mutating func decodeNull() throws -> JSON { - guard input.index(loc, offsetBy: 3, limitedBy: input.count) != input.count else { - throw Error.literalNilMisspelled(offset: loc) - } - - if input[loc+1] != Literal.u - || input[loc+2] != Literal.l - || input[loc+3] != Literal.l { - throw Error.literalNilMisspelled(offset: loc) - } - - loc += 4 - return .null - } - - private mutating func decodeTrue() throws -> JSON { - guard input.index(loc, offsetBy: 3, limitedBy: input.count) != input.count else { - throw Error.literalNilMisspelled(offset: loc) - } - - if input[loc+1] != Literal.r - || input[loc+2] != Literal.u - || input[loc+3] != Literal.e { - throw Error.literalTrueMisspelled(offset: loc) - } - - loc += 4 - return .bool(true) - } - - private mutating func decodeFalse() throws -> JSON { - guard input.index(loc, offsetBy: 4, limitedBy: input.count) != input.count else { - throw Error.literalNilMisspelled(offset: loc) - } - - if input[loc+1] != Literal.a - || input[loc+2] != Literal.l - || input[loc+3] != Literal.s - || input[loc+4] != Literal.e { - throw Error.literalFalseMisspelled(offset: loc) - } - - loc += 5 - return .bool(false) - } - - private var stringDecodingBuffer = [UInt8]() - private mutating func decodeString() throws -> JSON { - loc = (loc + 1) - stringDecodingBuffer.removeAll(keepingCapacity: true) - while loc < input.count { - switch input[loc] { - case Literal.BACKSLASH: - loc = (loc + 1) - switch input[loc] { - case Literal.DOUBLE_QUOTE: stringDecodingBuffer.append(Literal.DOUBLE_QUOTE) - case Literal.BACKSLASH: stringDecodingBuffer.append(Literal.BACKSLASH) - case Literal.SLASH: stringDecodingBuffer.append(Literal.SLASH) - case Literal.b: stringDecodingBuffer.append(Literal.BACKSPACE) - case Literal.f: stringDecodingBuffer.append(Literal.FORMFEED) - case Literal.r: stringDecodingBuffer.append(Literal.RETURN) - case Literal.t: stringDecodingBuffer.append(Literal.TAB) - case Literal.n: stringDecodingBuffer.append(Literal.NEWLINE) - case Literal.u: - loc = (loc + 1) - try readUnicodeEscape(start: loc - 2) - - // readUnicodeEscape() advances loc on its own, so we'll `continue` now - // to skip the typical "advance past this character" for all the other escapes - continue - - default: - throw Error.controlCharacterUnrecognized(offset: loc) - } - loc = (loc + 1) - - case Literal.DOUBLE_QUOTE: - loc = (loc + 1) - stringDecodingBuffer.append(0) - - let string = stringDecodingBuffer.withUnsafeBufferPointer { - String(cString: UnsafePointer($0.baseAddress!)) - } - - return .string(string) - - case let other: - stringDecodingBuffer.append(other) - loc = (loc + 1) - } - } - - throw Error.endOfStreamUnexpected - } - - private mutating func readCodeUnit() -> UInt16? { - guard loc + 4 <= input.count else { - return nil - } - var codeUnit: UInt16 = 0 - for c in input[loc.. JSON { - let start = loc - loc = (loc + 1) - var items = [JSON]() - - while loc < input.count { - skipWhitespace() - - if loc < input.count && input[loc] == Literal.RIGHT_BRACKET { - loc = (loc + 1) - return .array(items) - } - - if !items.isEmpty { - guard loc < input.count && input[loc] == Literal.COMMA else { - throw Error.collectionMissingSeparator(offset: start) - } - loc = (loc + 1) - } - - items.append(try parseValue()) - } - - throw Error.endOfStreamUnexpected - } - - // Decoding objects can be recursive, so we have to keep more than one - // buffer around for building up key/value pairs (to reduce allocations - // when parsing large JSON documents). - // - // Rough estimate of the difference between this and using a fresh - // [(String,JSON)] for the `pairs` variable in decodeObject() below is - // about 12% on an iPhone 5. - private struct DecodeObjectBuffers { - var buffers = [[(String,JSON)]]() - - mutating func getBuffer() -> [(String,JSON)] { - if !buffers.isEmpty { - var buffer = buffers.removeLast() - buffer.removeAll(keepingCapacity: true) - return buffer - } - return [(String,JSON)]() - } - - mutating func putBuffer(_ buffer: [(String,JSON)]) { - buffers.append(buffer) - } - } - - private var decodeObjectBuffers = DecodeObjectBuffers() - - private mutating func decodeObject() throws -> JSON { - let start = loc - loc = (loc + 1) - var pairs = decodeObjectBuffers.getBuffer() - - while loc < input.count { - skipWhitespace() - - if loc < input.count && input[loc] == Literal.RIGHT_BRACE { - loc = (loc + 1) - var obj = [String:JSON](minimumCapacity: pairs.count) - for (k, v) in pairs { - obj[k] = v - } - decodeObjectBuffers.putBuffer(pairs) - return .dictionary(obj) - } - - if !pairs.isEmpty { - guard loc < input.count && input[loc] == Literal.COMMA else { - throw Error.collectionMissingSeparator(offset: start) - } - loc = (loc + 1) - - skipWhitespace() - } - - guard loc < input.count && input[loc] == Literal.DOUBLE_QUOTE else { - throw Error.dictionaryMissingKey(offset: start) - } - - let key = try decodeString().getString() - skipWhitespace() - - guard loc < input.count && input[loc] == Literal.COLON else { - throw Error.collectionMissingSeparator(offset: start) - } - loc = (loc + 1) - - pairs.append((key, try parseValue())) - } - - throw Error.endOfStreamUnexpected - } - - private mutating func decodeIntegralValue(_ parser: NumberParser) throws -> JSON { - var sign = Sign.positive - var parser = parser - var value = 0 - - // This would be more natural as `while true { ... }` with a meaningful .Done case, - // but that causes compile time explosion in Swift 2.2. :-| - while parser.state != .done { - switch parser.state { - case .leadingMinus: - sign = .negative - try parser.parseNegative() - - case .leadingZero: - parser.parseLeadingZero() - - case .preDecimalDigits: - try parser.parsePreDecimalDigits { c in - guard case let (exponent, false) = Int.multiplyWithOverflow(10, value) else { - throw InternalError.numberOverflow(offset: parser.start) - } - - guard case let (newValue, false) = Int.addWithOverflow(exponent, Int(c - Literal.zero)) else { - throw InternalError.numberOverflow(offset: parser.start) - } - - value = newValue - } - - case .decimal, .exponent: - return try detectingFloatingPointErrors(start: parser.start) { - try decodeFloatingPointValue(parser, sign: sign, value: Double(value)) - } - - case .postDecimalDigits, .exponentSign, .exponentDigits: - assertionFailure("Invalid internal state while parsing number") - - case .done: - fatalError("impossible condition") - } - } - - guard case let (signedValue, false) = Int.multiplyWithOverflow(sign.rawValue, value) else { - throw InternalError.numberOverflow(offset: parser.start) - } - - loc = parser.loc - return .int(signedValue) - } - - private mutating func decodeFloatingPointValue(_ parser: NumberParser, sign: Sign, value: Double) throws -> JSON { - var parser = parser - var value = value - var exponentSign = Sign.positive - var exponent = Double(0) - var position = 0.1 - - // This would be more natural as `while true { ... }` with a meaningful .Done case, - // but that causes compile time explosion in Swift 2.2. :-| - while parser.state != .done { - switch parser.state { - case .leadingMinus, .leadingZero, .preDecimalDigits: - assertionFailure("Invalid internal state while parsing number") - - case .decimal: - try parser.parseDecimal() - - case .postDecimalDigits: - parser.parsePostDecimalDigits { c in - value += position * Double(c - Literal.zero) - position /= 10 - } - - case .exponent: - exponentSign = try parser.parseExponent() - - case .exponentSign: - try parser.parseExponentSign() - - case .exponentDigits: - parser.parseExponentDigits { c in - exponent = exponent * 10 + Double(c - Literal.zero) - } - - case .done: - fatalError("impossible condition") - } - } - - loc = parser.loc - return .double(Double(sign.rawValue) * value * pow(10, Double(exponentSign.rawValue) * exponent)) - } - - - private mutating func decodeNumberAsString(from position: Int) throws -> JSON { - var parser: NumberParser = { - let state: NumberParser.State - switch input[position] { - case Literal.MINUS: state = .leadingMinus - case Literal.zero: state = .leadingZero - case Literal.one...Literal.nine: state = .preDecimalDigits - default: - fatalError("Internal error: decodeNumber called on not-a-number") - } - return NumberParser(loc: position, input: input, state: state) - }() - - stringDecodingBuffer.removeAll(keepingCapacity: true) - - while true { - switch parser.state { - case .leadingMinus: - try parser.parseNegative() - stringDecodingBuffer.append(Literal.MINUS) - - case .leadingZero: - parser.parseLeadingZero() - stringDecodingBuffer.append(Literal.zero) - - case .preDecimalDigits: - parser.parsePreDecimalDigits { stringDecodingBuffer.append($0) } - - case .decimal: - try parser.parseDecimal() - stringDecodingBuffer.append(Literal.PERIOD) - - case .postDecimalDigits: - parser.parsePostDecimalDigits { stringDecodingBuffer.append($0) } - - case .exponent: - stringDecodingBuffer.append(input[parser.loc]) - _ = try parser.parseExponent() - - case .exponentSign: - stringDecodingBuffer.append(input[parser.loc]) - try parser.parseExponentSign() - - case .exponentDigits: - parser.parseExponentDigits { stringDecodingBuffer.append($0) } - - case .done: - stringDecodingBuffer.append(0) - let string = stringDecodingBuffer.withUnsafeBufferPointer { - String(cString: UnsafePointer($0.baseAddress!)) - } - - loc = parser.loc - return .string(string) - } - } - } - - private func detectingFloatingPointErrors(start loc: Int, _ f: () throws -> T) throws -> T { - let flags = FE_UNDERFLOW | FE_OVERFLOW - feclearexcept(flags) - let value = try f() - guard fetestexcept(flags) == 0 else { - throw InternalError.numberOverflow(offset: loc) - } - return value - } -} - -private struct NumberParser { - enum State { - case leadingMinus - case leadingZero - case preDecimalDigits - case decimal - case postDecimalDigits - case exponent - case exponentSign - case exponentDigits - case done - } - - let start: Int - var loc = 0 - var state: State - let input: UnsafeBufferPointer - - init(loc: Int, input: UnsafeBufferPointer, state: State) { - assert(loc < input.count, "Invalid input to NumberParser") - self.start = loc - self.loc = loc - self.input = input - self.state = state - } - - mutating func parseNegative() throws { - assert(state == .leadingMinus, "Unexpected state entering parseNegative") - - loc = (loc + 1) - guard loc < input.count else { - throw JSONParser.Error.endOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero: - state = .leadingZero - - case Literal.one...Literal.nine: - state = .preDecimalDigits - - default: - throw JSONParser.Error.numberSymbolMissingDigits(offset: start) - } - } - - mutating func parseLeadingZero() { - assert(state == .leadingZero, "Unexpected state entering parseLeadingZero") - - loc = (loc + 1) - guard loc < input.count else { - state = .done - return - } - - switch input[loc] { - case Literal.PERIOD: - state = .decimal - - case Literal.e, Literal.E: - state = .exponent - - default: - state = .done - } - } - - mutating func parsePreDecimalDigits(f: (UInt8) throws -> Void) rethrows { - assert(state == .preDecimalDigits, "Unexpected state entering parsePreDecimalDigits") - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = (loc + 1) - - case Literal.PERIOD: - state = .decimal - return - - case Literal.e, Literal.E: - state = .exponent - return - - default: - break advancing - } - } - - state = .done - } - - mutating func parseDecimal() throws { - assert(state == .decimal, "Unexpected state entering parseDecimal") - loc = (loc + 1) - guard loc < input.count else { - throw JSONParser.Error.endOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .postDecimalDigits - - default: - throw JSONParser.Error.numberMissingFractionalDigits(offset: start) - } - } - - mutating func parsePostDecimalDigits(f: (UInt8) throws -> Void) rethrows { - assert(state == .postDecimalDigits, "Unexpected state entering parsePostDecimalDigits") - - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = (loc + 1) - - case Literal.e, Literal.E: - state = .exponent - return - - default: - break advancing - } - } - - state = .done - } - - mutating func parseExponent() throws -> JSONParser.Sign { - assert(state == .exponent, "Unexpected state entering parseExponent") - - loc = (loc + 1) - guard loc < input.count else { - throw JSONParser.Error.endOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .exponentDigits - - case Literal.PLUS: - state = .exponentSign - - case Literal.MINUS: - state = .exponentSign - return .negative - - default: - throw JSONParser.Error.numberSymbolMissingDigits(offset: start) - } - - return .positive - } - - mutating func parseExponentSign() throws { - assert(state == .exponentSign, "Unexpected state entering parseExponentSign") - loc = (loc + 1) - guard loc < input.count else { - throw JSONParser.Error.endOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .exponentDigits - - default: - throw JSONParser.Error.numberSymbolMissingDigits(offset: start) - } - } - - mutating func parseExponentDigits(f: (UInt8) throws -> Void) rethrows { - assert(state == .exponentDigits, "Unexpected state entering parseExponentDigits") - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = (loc + 1) - - default: - break advancing - } - } - - state = .done - } -} - -public extension JSONParser { - - /// Creates a `JSONParser` ready to parse UTF-8 encoded `Data`. - /// - /// If the data is mutable, it is copied before parsing. The data's lifetime - /// is extended for the duration of parsing. - @available(*, unavailable, message: "Replaced with parse(utf8:)") - init(utf8Data inData: Data) { - fatalError("unavailable code cannot be executed") - } - - /// Creates a `JSONParser` from the code units represented by the `string`. - /// - /// The synthesized string is lifetime-extended for the duration of parsing. - @available(*, unavailable, message: "Replaced with parse(utf8:)") - init(string: String) { - fatalError("unavailable code cannot be executed") - } - - /// Creates an instance of `JSON` from UTF-8 encoded `data`. - static func parse(utf8 data: Data) throws -> JSON { - return try data.withUnsafeBytes { (ptr: UnsafePointer) -> JSON in - let buffer = UnsafeBufferPointer(start: ptr, count: data.count) - var parser = JSONParser(input: buffer) - return try parser.parse() - } - } - - /// Creates an instance of `JSON` from `string`. - static func parse(_ string: String) throws -> JSON { - return try string.utf8CString.withUnsafeBufferPointer { (nulTerminatedBuffer) throws -> JSON in - return try nulTerminatedBuffer.baseAddress!.withMemoryRebound(to: UInt8.self, capacity: nulTerminatedBuffer.count) { (utf8Base) throws -> JSON in - // don't want to include the nul termination in the buffer - trim it off - let buffer = UnsafeBufferPointer(start: utf8Base, count: nulTerminatedBuffer.count - 1) - var parser = JSONParser(input: buffer) - return try parser.parse() - } - } - } - -} - -extension JSONParser: JSONParserType { - - /// Creates an instance of `JSON` from UTF-8 encoded `Data`. - /// - parameter data: An instance of `Data` to parse `JSON` from. - /// - throws: Any `JSONParser.Error` that arises during decoding. - /// - seealso: JSONParser.parse() - public static func createJSON(from data: Data) throws -> JSON { - return try parse(utf8: data) - } - -} - -// MARK: - Errors - -extension JSONParser { - - /// Enumeration describing possible errors that occur while parsing a JSON - /// document. Most errors include an associated `offset`, representing the - /// offset into the UTF-8 characters making up the document where the error - /// occurred. - public enum Error: Swift.Error { - /// The parser ran out of data prematurely. This usually means a value - /// was not escaped, such as a string literal not ending with a double - /// quote. - case endOfStreamUnexpected - - /// Unexpected non-whitespace data was left around `offset` after - /// parsing all valid JSON. - case endOfStreamGarbage(offset: Int) - - /// Too many nested objects or arrays occured at the literal started - /// around `offset`. - case exceededNestingLimit(offset: Int) - - /// A `character` was not a valid start of a value around `offset`. - case valueInvalid(offset: Int, character: UnicodeScalar) - - /// Badly-formed Unicode escape sequence at `offset`. A Unicode escape - /// uses the text "\u" followed by 4 hex digits, such as "\uF09F\uA684" - /// to represent U+1F984, "UNICORN FACE". - case unicodeEscapeInvalid(offset: Int) - - /// Badly-formed control character around `offset`. JSON supports - /// backslash-escaped double quotes, slashes, whitespace control codes, - /// and Unicode escape sequences. - case controlCharacterUnrecognized(offset: Int) - - /// Invalid token, expected `null` around `offset` - case literalNilMisspelled(offset: Int) - - /// Invalid token, expected `true` around `offset` - case literalTrueMisspelled(offset: Int) - - /// Invalid token, expected `false` around `offset` - case literalFalseMisspelled(offset: Int) - - /// Badly-formed collection at given `offset`, expected `,` or `:` - case collectionMissingSeparator(offset: Int) - - /// While parsing an object literal, a value was found without a key - /// around `offset`. The start of a string literal was expected. - case dictionaryMissingKey(offset: Int) - - /// Badly-formed number with no digits around `offset`. After a decimal - /// point, a number must include some number of digits. - case numberMissingFractionalDigits(offset: Int) - - /// Badly-formed number with symbols ("-" or "e") but no following - /// digits around `offset`. - case numberSymbolMissingDigits(offset: Int) - - /// Supplied data is encoded in an unsupported format. - case invalidUnicodeStreamEncoding(detectedEncoding: JSONEncodingDetector.Encoding) - } - - fileprivate enum InternalError: Swift.Error { - /// Attempted to parse an integer outside the range of [Int.min, Int.max] - /// or a double outside the range of representable doubles. Note that - /// for doubles, this could be an overflow or an underflow - we don't - /// get enough information from Swift here to know which it is. The number - /// causing the overflow/underflow began at `offset`. - case numberOverflow(offset: Int) - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONParsing.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONParsing.swift deleted file mode 100755 index 0be146cf5..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONParsing.swift +++ /dev/null @@ -1,126 +0,0 @@ -// -// JSONParsing.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/17/15. -// Copyright © 2015 Big Nerd Ranch. All rights reserved. -// - -import Foundation - -// MARK: - Deserialize JSON - -/// Protocol describing a backend parser that can produce `JSON` from `Data`. -public protocol JSONParserType { - - /// Creates an instance of `JSON` from `Data`. - /// - parameter data: An instance of `Data` to use to create `JSON`. - /// - throws: An error that may arise from calling `JSONObjectWithData(_:options:)` on `NSJSONSerialization` with the given data. - /// - returns: An instance of `JSON`. - static func createJSON(from data: Data) throws -> JSON - -} - -extension JSON { - - /// Create `JSON` from UTF-8 `data`. By default, parses using the - /// Swift-native `JSONParser` backend. - public init(data: Data, usingParser parser: JSONParserType.Type = JSONParser.self) throws { - self = try parser.createJSON(from: data) - } - - /// Create `JSON` from UTF-8 `string`. - public init(jsonString: Swift.String, usingParser parser: JSONParserType.Type = JSONParser.self) throws { - self = try parser.createJSON(from: jsonString.data(using: Swift.String.Encoding.utf8) ?? Data()) - } -} - -// MARK: - NSJSONSerialization - -extension JSONSerialization: JSONParserType { - - // MARK: Decode Data - - /// Use the built-in, Objective-C based JSON parser to create `JSON`. - /// - parameter data: An instance of `Data`. - /// - returns: An instance of `JSON`. - /// - throws: An error that may arise if the `Data` cannot be parsed into an object. - public static func createJSON(from data: Data) throws -> JSON { - return makeJSON(with: try JSONSerialization.jsonObject(with: data, options: [])) - } - - // MARK: Make JSON - - /// Makes a `JSON` object by matching its argument to a case in the `JSON` enum. - /// - parameter object: The instance of `Any` returned from serializing the JSON. - /// - returns: An instance of `JSON` matching the JSON given to the function. - private static func makeJSON(with object: Any) -> JSON { - switch object { - case let n as NSNumber: - let numberType = CFNumberGetType(n) - switch numberType { - case .charType: - return .bool(n.boolValue) - - case .shortType, .intType, .longType, .cfIndexType, .nsIntegerType, .sInt8Type, .sInt16Type, .sInt32Type: - return .int(n.intValue) - - case .sInt64Type, .longLongType /* overflows 32-bit Int */: - #if /* 32-bit arch */ arch(arm) || arch(i386) - // Why double, when the Freddy parser would bump to String? - // - // Returning Double avoids making the type depend on whether you're running - // 32-bit or 64-bit code when using the NSJSONSerialization parser. - // NSJSONSerialization appears to bump numbers larger than Int.max to Double on - // 64-bit platforms but use .SInt64Type on 32-bit platforms. - // If we returned a String here, you'd get a String value on 32-bit, - // but a Double value on 64-bit. Instead, we return Double. - // - // This means that, if you switch parsers, - // you'll have to switch from .double to .string for pulling out - // overflowing values, but if you stick with a single parser, - // you at least won't have architecture-dependent lookups! - return .double(n.doubleValue) - #else - return .int(n.intValue) - #endif - - case .float32Type, .float64Type, .floatType, .doubleType, .cgFloatType: - return .double(n.doubleValue) - } - - case let arr as [Any]: - return makeJSONArray(arr) - - case let dict as [Swift.String: Any]: - return makeJSONDictionary(dict) - - case let s as Swift.String: - return .string(s) - - default: - return .null - } - } - - // MARK: Make a JSON Array - - /// Makes a `JSON` array from the object passed in. - /// - parameter jsonArray: The array to transform into a `JSON`. - /// - returns: An instance of `JSON` matching the array. - private static func makeJSONArray(_ jsonArray: [Any]) -> JSON { - return .array(jsonArray.map(makeJSON)) - } - - // MARK: Make a JSON Dictionary - - /// Makes a `JSON` dictionary from the Cocoa dictionary passed in. - /// - parameter jsonDict: The dictionary to transform into `JSON`. - /// - returns: An instance of `JSON` matching the dictionary. - private static func makeJSONDictionary(_ jsonDict: [Swift.String: Any]) -> JSON { - return JSON(jsonDict.lazy.map { (key, value) in - (key, makeJSON(with: value)) - }) - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONSerializing.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONSerializing.swift deleted file mode 100755 index 85a6f7133..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONSerializing.swift +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2016 Big Nerd Ranch, Inc. Licensed under the MIT license WITHOUT ANY WARRANTY. - -import Foundation - -// MARK: - Serialize JSON - -extension JSON { - - /// Attempt to serialize `JSON` into an `Data`. - /// - returns: A byte-stream containing the `JSON` ready for wire transfer. - /// - throws: Errors that arise from `JSONSerialization`. - /// - see: Foundation.JSONSerialization - public func serialize() throws -> Data { - return try JSONSerialization.data(withJSONObject: toJSONSerializationValue(), options: []) - } - - /// Attempt to serialize `JSON` into a `String`. - /// - returns: A `String` containing the `JSON`. - /// - throws: A `JSON.Error.StringSerializationError` or errors that arise from `JSONSerialization`. - /// - see: Foundation.JSONSerialization - public func serializeString() throws -> String { - let data = try self.serialize() - guard let json = String(data: data, encoding: String.Encoding.utf8) else { - throw Error.stringSerializationError - } - return json - } - - /// A function to help with the serialization of `JSON`. - /// - returns: An `Any` suitable for `JSONSerialization`'s use. - private func toJSONSerializationValue() -> Any { - switch self { - case .array(let jsonArray): - return jsonArray.map { $0.toJSONSerializationValue() } - case .dictionary(let jsonDictionary): - var cocoaDictionary = Swift.Dictionary(minimumCapacity: jsonDictionary.count) - for (key, json) in jsonDictionary { - cocoaDictionary[key] = json.toJSONSerializationValue() - } - return cocoaDictionary - case .string(let str): - return str - case .double(let num): - return NSNumber(value: num) - case .int(let int): - return NSNumber(value: int) - case .bool(let b): - return NSNumber(value: b) - case .null: - return NSNull() - } - - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONSubscripting.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONSubscripting.swift deleted file mode 100755 index 6d1bd3ef3..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/JSONSubscripting.swift +++ /dev/null @@ -1,613 +0,0 @@ -// -// JSONSubscripting.swift -// Freddy -// -// Created by Zachary Waldowski on 8/15/15. -// Copyright © 2015 Big Nerd Ranch. All rights reserved. -// - -// MARK: JSONPathType - -/// A protocol used to define a path within an instance of `JSON` that leads to some desired value. -/// -/// A custom type, such as a `RawRepresentable` enum, may be made to conform to `JSONPathType` -/// and used with the subscript APIs. -public protocol JSONPathType { - /// Use `self` to key into a `dictionary`. - /// - /// Unlike Swift dictionaries, failing to find a value for a key should throw - /// an error rather than convert to `nil`. - /// - /// Upon failure, implementers should throw an error from `JSON.Error`. - func value(in dictionary: [String : JSON]) throws -> JSON - - /// Use `self` to index into an `array`. - /// - /// Unlike Swift arrays, attempting to index outside the collection's bounds - /// should throw an error rather than crash. - /// - /// Upon failure, implementers should throw an error from `JSON.Error`. - func value(in array: [JSON]) throws -> JSON -} - -extension JSONPathType { - - /// The default behavior for keying into a dictionary is to throw - /// `JSON.Error.UnexpectedSubscript`. - public func value(in dictionary: [String : JSON]) throws -> JSON { - throw JSON.Error.unexpectedSubscript(type: Self.self) - } - - /// The default behavior for indexing into an array is to throw - /// `JSON.Error.UnexpectedSubscript`. - public func value(in array: [JSON]) throws -> JSON { - throw JSON.Error.unexpectedSubscript(type: Self.self) - } - -} - -extension String: JSONPathType { - - /// A method used to retrieve a value from a given dictionary for a specific key. - /// - parameter dictionary: A `Dictionary` with `String` keys and `JSON` values. - /// - throws: `.KeyNotFound` with an associated value of `self`, where `self` is a `String`, - /// should the key not be present within the `JSON`. - /// - returns: The `JSON` value associated with the given key. - public func value(in dictionary: [String : JSON]) throws -> JSON { - guard let next = dictionary[self] else { - throw JSON.Error.keyNotFound(key: self) - } - return next - } - -} - -extension Int: JSONPathType { - - /// A method used to retrieve a value from a given array for a specific index. - /// - parameter array: An `Array` of `JSON`. - /// - throws: `.IndexOutOfBounds` with an associated value of `self`, where `self` is an `Int`, - /// should the index not be within the valid range for the array of `JSON`. - /// - returns: The `JSON` value found at the given index. - public func value(in array: [JSON]) throws -> JSON { - guard case array.indices = self else { - throw JSON.Error.indexOutOfBounds(index: self) - } - return array[self] - } - -} - -// MARK: - Subscripting core - -private extension JSON { - - enum SubscriptError: Swift.Error { - case subscriptIntoNull(JSONPathType) - } - - func value(for pathFragment: JSONPathType, detectingNull: Bool) throws -> JSON { - switch self { - case .null where detectingNull: - throw SubscriptError.subscriptIntoNull(pathFragment) - case let .dictionary(dict): - return try pathFragment.value(in: dict) - case let .array(array): - return try pathFragment.value(in: array) - default: - throw Error.unexpectedSubscript(type: type(of: pathFragment)) - } - } - - func value(at path: [JSONPathType], detectingNull: Bool = false) throws -> JSON { - var result = self - for pathFragment in path { - result = try result.value(for: pathFragment, detectingNull: detectingNull) - } - return result - } - -} - -// MARK: - Subscripting operator - -extension JSON { - - public subscript(key: String) -> JSON? { - return try? value(for: key, detectingNull: false) - } - - public subscript(index: Int) -> JSON? { - return try? value(for: index, detectingNull: false) - } - -} - -// MARK: - Simple member unpacking - -extension JSON { - - /// Attempts to decode into the returning type from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON`. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An initialized member from the inner JSON. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A given `String` key does not exist inside a - /// descendant `JSON` dictionary. - /// * `IndexOutOfBounds`: A given `Int` index is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A given subscript cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of - /// the `JSON` instance does not match `Decoded`. - public func decode(at path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> Decoded { - return try Decoded(json: value(at: path)) - } - - /// Retrieves a `Double` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A floating-point `Double` - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`. - /// - seealso: `JSON.decode(at:type:)` - public func getDouble(at path: JSONPathType...) throws -> Double { - return try Double(json: value(at: path)) - } - - /// Retrieves an `Int` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A numeric `Int` - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`. - /// - seealso: `JSON.decode(at:type:)` - public func getInt(at path: JSONPathType...) throws -> Int { - return try Int(json: value(at: path)) - } - - /// Retrieves a `String` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A textual `String` - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`. - /// - seealso: `JSON.decode(at:type:)` - public func getString(at path: JSONPathType...) throws -> String { - return try String(json: value(at: path)) - } - - /// Retrieves a `Bool` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A truthy `Bool` - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`. - /// - seealso: `JSON.decode(at:type:)` - public func getBool(at path: JSONPathType...) throws -> Bool { - return try Bool(json: value(at: path)) - } - - /// Retrieves a `[JSON]` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: An `Array` of `JSON` elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`. - /// - seealso: `JSON.decode(at:type:)` - public func getArray(at path: JSONPathType...) throws -> [JSON] { - return try JSON.getArray(from: value(at: path)) - } - - /// Attempts to decode many values from a descendant JSON array at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An `Array` of decoded elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`, or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(at:type:)` - public func decodedArray(at path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> [Decoded] { - return try JSON.decodedArray(from: value(at: path)) - } - - /// Retrieves a `[String: JSON]` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)`. - /// - seealso: `JSON.decode(at:type:)` - public func getDictionary(at path: JSONPathType...) throws -> [String: JSON] { - return try JSON.getDictionary(from: value(at: path)) - } - - /// Attempts to decode many values from a descendant JSON object at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the value type to decode with. - /// - returns: A `Dictionary` of `String` keys and decoded values. - /// - throws: One of the `JSON.Error` cases thrown by `decode(at:type:)` or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(at:type:)` - public func decodedDictionary(at path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> [String: Decoded] { - return try JSON.decodedDictionary(from: value(at: path)) - } - -} - -// MARK: - NotFound-Or-Null-to-Optional unpacking - -extension JSON { - - /// An `OptionSetType` used to represent the different options available for subscripting `JSON` with `null` values or missing keys. - /// * `.NullBecomesNil` - Treat `null` values as `nil`. - /// * `.MissingKeyBecomesNil` - Treat missing keys as `nil`. - public struct SubscriptingOptions: OptionSet { - public let rawValue: Int - public init(rawValue: Int) { - self.rawValue = rawValue - } - - /// Treat `null` values as `nil`. - public static let NullBecomesNil = SubscriptingOptions(rawValue: 1 << 0) - /// Treat missing keys as `nil`. - public static let MissingKeyBecomesNil = SubscriptingOptions(rawValue: 1 << 1) - } - - fileprivate func mapOptional(at path: [JSONPathType], alongPath options: SubscriptingOptions, transform: (JSON) throws -> Value) throws -> Value? { - let detectNull = options.contains(.NullBecomesNil) - let detectNotFound = options.contains(.MissingKeyBecomesNil) - var json: JSON? - do { - json = try value(at: path, detectingNull: detectNull) - return try json.map(transform) - } catch Error.indexOutOfBounds where detectNotFound { - return nil - } catch Error.keyNotFound where detectNotFound { - return nil - } catch Error.valueNotConvertible where detectNull && json == .null { - return nil - } catch SubscriptError.subscriptIntoNull where detectNull { - return nil - } - } -} - -extension JSON { - - /// Decodes a `JSON` instance if it is not `.Null`, throws otherwise. - /// - parameter json: An instance of `JSON`. - /// - returns: An instance of some type that conforms to `JSONDecodable`. - /// - throws: `Error.ValueNotConvertible` if the `JSON` instance is `.Null`. - private static func getDecoded(json: JSON) throws -> Decoded { - guard json != .null else { - throw Error.valueNotConvertible(value: json, to: Decoded.self) - } - return try Decoded.init(json: json) - } - - /// Optionally decodes into the returning type from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: A decoded value from the inner JSON if found, or `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decode(at path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> Decoded? { - return try mapOptional(at: path, alongPath: options, transform: JSON.getDecoded) - } - - /// Optionally retrieves a `Double` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON`. - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A `Double` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getDouble(at path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Double? { - return try mapOptional(at: path, alongPath: options, transform: Double.init) - } - - /// Optionally retrieves a `Int` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A numeric `Int` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getInt(at path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Int? { - return try mapOptional(at: path, alongPath: options, transform: Int.init) - } - - /// Optionally retrieves a `String` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A text `String` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getString(at path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> String? { - return try mapOptional(at: path, alongPath: options, transform: String.init) - } - - /// Optionally retrieves a `Bool` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A truthy `Bool` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getBool(at path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Bool? { - return try mapOptional(at: path, alongPath: options, transform: Bool.init) - } - - /// Optionally retrieves a `[JSON]` from a path into the recieving structure. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: An `Array` of `JSON` elements if a value could be found, - /// otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getArray(at path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> [JSON]? { - return try mapOptional(at: path, alongPath: options, transform: JSON.getArray) - } - - /// Optionally decodes many values from a descendant array at a path into - /// JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the value type to decode with. - /// - returns: An `Array` of decoded elements if found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decodedArray(at path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> [Decoded]? { - return try mapOptional(at: path, alongPath: options, transform: JSON.decodedArray) - } - - /// Optionally retrieves a `[String: JSON]` from a path into the recieving - /// structure. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A `Dictionary` of `String` mapping to `JSON` elements if a - /// value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getDictionary(at path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> [String: JSON]? { - return try mapOptional(at: path, alongPath: options, transform: JSON.getDictionary) - } - - /// Optionally attempts to decode many values from a descendant object at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the value type to decode with. - /// - returns: A `Dictionary` of `String` mapping to decoded elements if a - /// value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decodedDictionary(at path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> [String: Decoded]? { - return try mapOptional(at: path, alongPath: options, transform: JSON.decodedDictionary) - } - -} - -// MARK: - Missing-with-fallback unpacking - -extension JSON { - - fileprivate func mapOptional(at path: [JSONPathType], fallback: () -> Value, transform: (JSON) throws -> Value) throws -> Value { - return try mapOptional(at: path, alongPath: .MissingKeyBecomesNil, transform: transform) ?? fallback() - } - - /// Attempts to decode into the returning type from a path into - /// JSON, or returns a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Value to use when one is missing at the subscript. - /// - returns: An initialized member from the inner JSON. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `UnexpectedSubscript`: A given subscript cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of - /// the `JSON` instance does not match `Decoded`. - public func decode(at path: JSONPathType..., or fallback: @autoclosure() -> Decoded) throws -> Decoded { - return try mapOptional(at: path, fallback: fallback, transform: Decoded.init) - } - - /// Retrieves a `Double` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Double` to use when one is missing at the subscript. - /// - returns: A floating-point `Double` - /// - throws: One of the `JSON.Error` cases thrown by calling `mapOptional(at:fallback:transform:)`. - public func getDouble(at path: JSONPathType..., or fallback: @autoclosure() -> Double) throws -> Double { - return try mapOptional(at: path, fallback: fallback, transform: Double.init) - } - - /// Retrieves an `Int` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Int` to use when one is missing at the subscript. - /// - returns: A numeric `Int` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getInt(at path: JSONPathType..., or fallback: @autoclosure() -> Int) throws -> Int { - return try mapOptional(at: path, fallback: fallback, transform: Int.init) - } - - /// Retrieves a `String` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `String` to use when one is missing at the subscript. - /// - returns: A textual `String` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getString(at path: JSONPathType..., or fallback: @autoclosure() -> String) throws -> String { - return try mapOptional(at: path, fallback: fallback, transform: String.init) - } - - /// Retrieves a `Bool` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Bool` to use when one is missing at the subscript. - /// - returns: A truthy `Bool` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getBool(at path: JSONPathType..., or fallback: @autoclosure() -> Bool) throws -> Bool { - return try mapOptional(at: path, fallback: fallback, transform: Bool.init) - } - - /// Retrieves a `[JSON]` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Array` to use when one is missing at the subscript. - /// - returns: An `Array` of `JSON` elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getArray(at path: JSONPathType..., or fallback: @autoclosure() -> [JSON]) throws -> [JSON] { - return try mapOptional(at: path, fallback: fallback, transform: JSON.getArray) - } - - /// Attempts to decodes many values from a desendant JSON array at a path - /// into the recieving structure, returning a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Array` to use when one is missing at the subscript. - /// - returns: An `Array` of decoded elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decodedArray(at path: JSONPathType..., or fallback: @autoclosure() -> [Decoded]) throws -> [Decoded] { - return try mapOptional(at: path, fallback: fallback, transform: JSON.decodedArray) - } - - /// Retrieves a `[String: JSON]` from a path into JSON or a fallback if not - /// found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: `Dictionary` to use when one is missing at the subscript. - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func getDictionary(at path: JSONPathType..., or fallback: @autoclosure() -> [String: JSON]) throws -> [String: JSON] { - return try mapOptional(at: path, fallback: fallback, transform: JSON.getDictionary) - } - - /// Attempts to decode many values from a descendant JSON object at a path - /// into the receiving structure, returning a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Value to use when one is missing at the subscript - /// - returns: A `Dictionary` of `String` mapping to decoded elements. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decodedDictionary(at path: JSONPathType..., or fallback: @autoclosure() -> [String: Decoded]) throws -> [String: Decoded] { - return try mapOptional(at: path, fallback: fallback, transform: JSON.decodedDictionary) - } - - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/main.swift b/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/main.swift deleted file mode 100644 index 7f715fcbc..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_20161018/test_Freddy/main.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// main.swift -// test_Freddy -// -// Created by nst on 10/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard ProcessInfo.processInfo.arguments.count == 2 else { - let url = URL(fileURLWithPath: ProcessInfo.processInfo.arguments[0]) - let programName = url.lastPathComponent - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = ProcessInfo.processInfo.arguments[1] - let url = NSURL.fileURL(withPath:path) - - do { - let data = try Data(contentsOf:url) - do { - let o = try JSONParser.parse(utf8: data) - exit(0) - } catch { - exit(1) - } - - } catch let e { - print("*** CANNOT READ DATA AT \(url)") - print(e) - exit(1) - } - -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/bin/test_Freddy_2_1_0 b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/bin/test_Freddy_2_1_0 deleted file mode 100755 index 2a6a30c7d..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/bin/test_Freddy_2_1_0 and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.pbxproj deleted file mode 100644 index 3ed80c199..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.pbxproj +++ /dev/null @@ -1,300 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03D84ABB1D5B0A1000776402 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03D84ABA1D5B0A1000776402 /* main.swift */; }; - 03F8F7811D5B75600021630C /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7781D5B75600021630C /* JSON.swift */; }; - 03F8F7821D5B75600021630C /* JSONDecodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7791D5B75600021630C /* JSONDecodable.swift */; }; - 03F8F7831D5B75600021630C /* JSONEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77A1D5B75600021630C /* JSONEncodable.swift */; }; - 03F8F7841D5B75600021630C /* JSONEncodingDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */; }; - 03F8F7851D5B75600021630C /* JSONLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */; }; - 03F8F7861D5B75600021630C /* JSONParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77D1D5B75600021630C /* JSONParser.swift */; }; - 03F8F7871D5B75600021630C /* JSONParsing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77E1D5B75600021630C /* JSONParsing.swift */; }; - 03F8F7881D5B75600021630C /* JSONSerializing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F77F1D5B75600021630C /* JSONSerializing.swift */; }; - 03F8F7891D5B75600021630C /* JSONSubscripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F8F7801D5B75600021630C /* JSONSubscripting.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03D84AB51D5B0A1000776402 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03D84AB71D5B0A1000776402 /* test_Freddy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_Freddy; sourceTree = BUILT_PRODUCTS_DIR; }; - 03D84ABA1D5B0A1000776402 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 03F8F7781D5B75600021630C /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSON.swift; path = test_Freddy/JSON.swift; sourceTree = ""; }; - 03F8F7791D5B75600021630C /* JSONDecodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONDecodable.swift; path = test_Freddy/JSONDecodable.swift; sourceTree = ""; }; - 03F8F77A1D5B75600021630C /* JSONEncodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONEncodable.swift; path = test_Freddy/JSONEncodable.swift; sourceTree = ""; }; - 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONEncodingDetector.swift; path = test_Freddy/JSONEncodingDetector.swift; sourceTree = ""; }; - 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONLiteralConvertible.swift; path = test_Freddy/JSONLiteralConvertible.swift; sourceTree = ""; }; - 03F8F77D1D5B75600021630C /* JSONParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONParser.swift; path = test_Freddy/JSONParser.swift; sourceTree = ""; }; - 03F8F77E1D5B75600021630C /* JSONParsing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONParsing.swift; path = test_Freddy/JSONParsing.swift; sourceTree = ""; }; - 03F8F77F1D5B75600021630C /* JSONSerializing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSerializing.swift; path = test_Freddy/JSONSerializing.swift; sourceTree = ""; }; - 03F8F7801D5B75600021630C /* JSONSubscripting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONSubscripting.swift; path = test_Freddy/JSONSubscripting.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03D84AB41D5B0A1000776402 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03D84AAE1D5B0A1000776402 = { - isa = PBXGroup; - children = ( - 03F8F7781D5B75600021630C /* JSON.swift */, - 03F8F7791D5B75600021630C /* JSONDecodable.swift */, - 03F8F77A1D5B75600021630C /* JSONEncodable.swift */, - 03F8F77B1D5B75600021630C /* JSONEncodingDetector.swift */, - 03F8F77C1D5B75600021630C /* JSONLiteralConvertible.swift */, - 03F8F77D1D5B75600021630C /* JSONParser.swift */, - 03F8F77E1D5B75600021630C /* JSONParsing.swift */, - 03F8F77F1D5B75600021630C /* JSONSerializing.swift */, - 03F8F7801D5B75600021630C /* JSONSubscripting.swift */, - 03D84AB91D5B0A1000776402 /* test_Freddy */, - 03D84AB81D5B0A1000776402 /* Products */, - ); - sourceTree = ""; - }; - 03D84AB81D5B0A1000776402 /* Products */ = { - isa = PBXGroup; - children = ( - 03D84AB71D5B0A1000776402 /* test_Freddy */, - ); - name = Products; - sourceTree = ""; - }; - 03D84AB91D5B0A1000776402 /* test_Freddy */ = { - isa = PBXGroup; - children = ( - 03D84ABA1D5B0A1000776402 /* main.swift */, - ); - path = test_Freddy; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03D84AB61D5B0A1000776402 /* test_Freddy */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03D84ABE1D5B0A1000776402 /* Build configuration list for PBXNativeTarget "test_Freddy" */; - buildPhases = ( - 03D84AB31D5B0A1000776402 /* Sources */, - 03D84AB41D5B0A1000776402 /* Frameworks */, - 03D84AB51D5B0A1000776402 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_Freddy; - productName = test_Freddy; - productReference = 03D84AB71D5B0A1000776402 /* test_Freddy */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03D84AAF1D5B0A1000776402 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03D84AB61D5B0A1000776402 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - DevelopmentTeamName = "Nicolas Seriot"; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03D84AB21D5B0A1000776402 /* Build configuration list for PBXProject "test_Freddy" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03D84AAE1D5B0A1000776402; - productRefGroup = 03D84AB81D5B0A1000776402 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03D84AB61D5B0A1000776402 /* test_Freddy */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03D84AB31D5B0A1000776402 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03F8F7881D5B75600021630C /* JSONSerializing.swift in Sources */, - 03F8F7821D5B75600021630C /* JSONDecodable.swift in Sources */, - 03F8F7851D5B75600021630C /* JSONLiteralConvertible.swift in Sources */, - 03F8F7871D5B75600021630C /* JSONParsing.swift in Sources */, - 03F8F7861D5B75600021630C /* JSONParser.swift in Sources */, - 03F8F7831D5B75600021630C /* JSONEncodable.swift in Sources */, - 03D84ABB1D5B0A1000776402 /* main.swift in Sources */, - 03F8F7811D5B75600021630C /* JSON.swift in Sources */, - 03F8F7891D5B75600021630C /* JSONSubscripting.swift in Sources */, - 03F8F7841D5B75600021630C /* JSONEncodingDetector.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03D84ABC1D5B0A1000776402 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 03D84ABD1D5B0A1000776402 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03D84ABF1D5B0A1000776402 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; - }; - name = Debug; - }; - 03D84AC01D5B0A1000776402 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03D84AB21D5B0A1000776402 /* Build configuration list for PBXProject "test_Freddy" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03D84ABC1D5B0A1000776402 /* Debug */, - 03D84ABD1D5B0A1000776402 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03D84ABE1D5B0A1000776402 /* Build configuration list for PBXNativeTarget "test_Freddy" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03D84ABF1D5B0A1000776402 /* Debug */, - 03D84AC01D5B0A1000776402 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03D84AAF1D5B0A1000776402 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 95e4cc57e..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint deleted file mode 100644 index fcf13a138..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/xcshareddata/test_Freddy.xcscmblueprint +++ /dev/null @@ -1,30 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" : 0, - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : 0 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7B3DFA55-F9BF-41D8-8FD5-204D3162EB03", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" : "dropbox\/JSON\/test_Freddy\/Vendor\/Freddy\/", - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : "dropbox\/" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "test_Freddy", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "JSON\/test_Freddy\/test_Freddy.xcodeproj", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/bignerdranch\/Freddy.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6ADA245F937D8ED6D99F5A7865E19F5267A169E2" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "\/Users\/nst\/Dropbox\/dropbox.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" - } - ] -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 9f4bd58b9..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme deleted file mode 100644 index e31043938..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_Freddy.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index b27bc09bd..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_Freddy.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03D84AB61D5B0A1000776402 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSON.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSON.swift deleted file mode 100755 index c8adae8ca..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSON.swift +++ /dev/null @@ -1,95 +0,0 @@ -// -// JSON.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/17/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -/// An enum to describe the structure of JSON. -public enum JSON { - /// A case for denoting an array with an associated value of `[JSON]` - case Array([JSON]) - /// A case for denoting a dictionary with an associated value of `[Swift.String: JSON]` - case Dictionary([Swift.String: JSON]) - /// A case for denoting a double with an associated value of `Swift.Double`. - case Double(Swift.Double) - /// A case for denoting an integer with an associated value of `Swift.Int`. - case Int(Swift.Int) - /// A case for denoting a string with an associated value of `Swift.String`. - case String(Swift.String) - /// A case for denoting a boolean with an associated value of `Swift.Bool`. - case Bool(Swift.Bool) - /// A case for denoting null. - case Null -} - -// MARK: - Errors - -extension JSON { - - /// An enum to encapsulate errors that may arise in working with `JSON`. - public enum Error: ErrorType { - /// The `index` is out of bounds for a JSON array - case IndexOutOfBounds(index: Swift.Int) - - /// The `key` was not found in the JSON dictionary - case KeyNotFound(key: Swift.String) - - /// The JSON is not subscriptable with `type` - case UnexpectedSubscript(type: JSONPathType.Type) - - /// Unexpected JSON `value` was found that is not convertible `to` type - case ValueNotConvertible(value: JSON, to: Any.Type) - } - -} - -// MARK: - Test Equality - -/// Return `true` if `lhs` is equal to `rhs`. -public func ==(lhs: JSON, rhs: JSON) -> Bool { - switch (lhs, rhs) { - case (.Array(let arrL), .Array(let arrR)): - return arrL == arrR - case (.Dictionary(let dictL), .Dictionary(let dictR)): - return dictL == dictR - case (.String(let strL), .String(let strR)): - return strL == strR - case (.Double(let dubL), .Double(let dubR)): - return dubL == dubR - case (.Double(let dubL), .Int(let intR)): - return dubL == Double(intR) - case (.Int(let intL), .Int(let intR)): - return intL == intR - case (.Int(let intL), .Double(let dubR)): - return Double(intL) == dubR - case (.Bool(let bL), .Bool(let bR)): - return bL == bR - case (.Null, .Null): - return true - default: - return false - } -} - -extension JSON: Equatable {} - -// MARK: - Printing - -extension JSON: CustomStringConvertible { - - /// A textual representation of `self`. - public var description: Swift.String { - switch self { - case .Array(let arr): return Swift.String(arr) - case .Dictionary(let dict): return Swift.String(dict) - case .String(let string): return string - case .Double(let double): return Swift.String(double) - case .Int(let int): return Swift.String(int) - case .Bool(let bool): return Swift.String(bool) - case .Null: return "null" - } - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONDecodable.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONDecodable.swift deleted file mode 100755 index ff508c9e4..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONDecodable.swift +++ /dev/null @@ -1,151 +0,0 @@ -// -// JSONDecodable.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/24/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -/// A protocol to provide functionality for creating a model object with a `JSON` -/// value. -public protocol JSONDecodable { - - /// Creates an instance of the model with a `JSON` instance. - /// - parameter json: An instance of a `JSON` value from which to - /// construct an instance of the implementing type. - /// - throws: Any `JSON.Error` for errors derived from inspecting the - /// `JSON` value, or any other error involved in decoding. - init(json: JSON) throws - -} - -extension Double: JSONDecodable { - - /// An initializer to create an instance of `Double` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Double` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - switch json { - case let .Double(double): - self = double - case let .Int(int): - self = Swift.Double(int) - default: - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.Double) - } - } - -} - -extension Int: JSONDecodable { - - /// An initializer to create an instance of `Int` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Int` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - switch json { - case let .Double(double) where double <= Double(Swift.Int.max): - self = Swift.Int(double) - case let .Int(int): - self = int - default: - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.Int) - } - } - -} - -extension String: JSONDecodable { - - /// An initializer to create an instance of `String` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `String` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - guard case let .String(string) = json else { - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.String) - } - self = string - } - -} - -extension Bool: JSONDecodable { - - /// An initializer to create an instance of `Bool` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `Bool` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - guard case let .Bool(bool) = json else { - throw JSON.Error.ValueNotConvertible(value: json, to: Swift.Bool) - } - self = bool - } - -} - -extension RawRepresentable where RawValue: JSONDecodable { - - /// An initializer to create an instance of `RawRepresentable` from a `JSON` value. - /// - parameter json: An instance of `JSON`. - /// - throws: The initializer will throw an instance of `JSON.Error` if - /// an instance of `RawRepresentable` cannot be created from the `JSON` value that was - /// passed to this initializer. - public init(json: JSON) throws { - let raw = try json.decode(type: RawValue.self) - guard let value = Self(rawValue: raw) else { - throw JSON.Error.ValueNotConvertible(value: json, to: Self.self) - } - self = value - } -} - -internal extension JSON { - - /// Retrieves a `[JSON]` from the JSON. - /// - returns: An `Array` of `JSON` elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`. - /// - seealso: `JSON.decode(_:type:)` - static func getArray(json: JSON) throws -> [JSON] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Array. - guard case let .Array(array) = json else { - throw Error.ValueNotConvertible(value: json, to: Swift.Array) - } - return array - } - - /// Retrieves a `[String: JSON]` from the JSON. - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`. - /// - seealso: `JSON.decode(_:type:)` - static func getDictionary(json: JSON) throws -> [Swift.String: JSON] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Dictionary. - guard case let .Dictionary(dictionary) = json else { - throw Error.ValueNotConvertible(value: json, to: Swift.Dictionary) - } - return dictionary - } - - /// Attempts to decode many values from a descendant JSON array at a path - /// into JSON. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An `Array` of decoded elements - /// - throws: Any of the `JSON.Error` cases thrown by `decode(type:)`, as - /// well as any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - static func getArrayOf(json: JSON) throws -> [Decoded] { - // Ideally should be expressed as a conditional protocol implementation on Swift.Dictionary. - // This implementation also doesn't do the `type = Type.self` trick. - return try getArray(json).map(Decoded.init) - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONEncodable.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONEncodable.swift deleted file mode 100755 index 480c57bce..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONEncodable.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// JSONEncodable.swift -// Freddy -// -// Created by Matthew Mathias on 1/4/16. -// Copyright © 2016 Big Nerd Ranch. All rights reserved. -// - -import Foundation - -/// A protocol to facilitate encoding and decoding of `JSON`. -public protocol JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON`. - /// - Note: If conforming to `JSONEncodable` with a custom type of your own, you should return an instance of - /// `JSON.Dictionary`. - func toJSON() -> JSON -} - -extension Array where Element: JSONEncodable { - /// Converts an instance of `Array` whose elements conform to `JSONEncodable` to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Array`. - public func toJSON() -> JSON { - let arrayOfJSON = self.map { $0.toJSON() } - return .Array(arrayOfJSON) - } -} - -extension Dictionary where Value: JSONEncodable { - /// Converts an instance of `Dictionary` whose values conform to `JSONEncodable` to `JSON`. The keys in the resulting - /// `JSON.Dictionary` will be of type `String`. - /// - returns: An instance of `JSON` where the enum case is `.Dictionary`. - public func toJSON() -> JSON { - var jsonDictionary = [String: JSON]() - - for (k, v) in self { - let key = String(k) - jsonDictionary[key] = v.toJSON() - } - - return .Dictionary(jsonDictionary) - } -} - -extension Int: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Int`. - public func toJSON() -> JSON { - return .Int(self) - } -} - -extension Double: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Double`. - public func toJSON() -> JSON { - return .Double(self) - } -} - -extension String: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.String`. - public func toJSON() -> JSON { - return .String(self) - } -} - -extension Bool: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is `.Bool`. - public func toJSON() -> JSON { - return .Bool(self) - } -} - -extension RawRepresentable where RawValue: JSONEncodable { - /// Converts an instance of a conforming type to `JSON`. - /// - returns: An instance of `JSON` where the enum case is whatever the underlying `RawValue` converts to. - public func toJSON() -> JSON { - return rawValue.toJSON() - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONEncodingDetector.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONEncodingDetector.swift deleted file mode 100755 index 933bc0c29..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONEncodingDetector.swift +++ /dev/null @@ -1,110 +0,0 @@ -// -// JSONEncodingDetector.swift -// Freddy -// -// Created by Robert Edwards on 1/27/16. -// Copyright © 2016 Big Nerd Ranch. All rights reserved. -// - -/// Struct for attempting to detect the Unicode encoding used with the data supplied to the JSONParser -public struct JSONEncodingDetector { - - //// The Unicode encodings looked for during detection - public enum Encoding { - //// UTF-8 - case UTF8 - //// UTF-16 Little Endian - case UTF16LE - //// UTF-16 Big Endian - case UTF16BE - //// UTF-32 Little Endian - case UTF32LE - //// UTF-32 Big Endian - case UTF32BE - } - - //// The Unicode encodings supported by JSONParser.swift - public static let supportedEncodings: [Encoding] = [.UTF8] - - typealias ByteStreamPrefixInformation = (encoding: Encoding, byteOrderMarkLength: Int) - - //// Attempts to detect the Unicode encoding used for a given set of data. - //// - //// This function initially looks for a Byte Order Mark in the following form: - //// - //// Bytes | Encoding Form - //// --------------|---------------- - //// 00 00 FE FF | UTF-32, big-endian - //// FF FE 00 00 | UTF-32, little-endian - //// FE FF | UTF-16, big-endian - //// FF FE | UTF-16, little-endian - //// EF BB BF | UTF-8 - //// - //// If a BOM is not found then we detect using the following approach described in - //// the JSON RFC http://www.ietf.org/rfc/rfc4627.txt: - //// - //// Since the first two characters of a JSON text will always be ASCII - //// characters [RFC0020], it is possible to determine whether an octet - //// stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking - //// at the pattern of nulls in the first four octets. - //// - //// 00 00 00 xx UTF-32BE - //// 00 xx 00 xx UTF-16BE - //// xx 00 00 00 UTF-32LE - //// xx 00 xx 00 UTF-16LE - //// xx xx xx xx UTF-8 - //// - //// - parameter header: The front Slice of data being read and evaluated. - //// - returns: A tuple containing the detected Unicode encoding and the lenght of the byte order mark. - static func detectEncoding(header: Slice>) -> ByteStreamPrefixInformation { - - guard let prefix = prefixFromHeader(header) else { - return (.UTF8, 0) - } - - if let prefixInfo = JSONEncodingDetector.encodingFromBOM(prefix) { - return prefixInfo - } else { - switch prefix { - case(0, 0, 0?, _): - return (.UTF32BE, 0) - case(_, 0, 0?, 0?): - return (.UTF32LE, 0) - case (0, _, 0?, _), (0, _, _, _): - return (.UTF16BE, 0) - case (_, 0, _, 0?), (_, 0, _, _): - return (.UTF16LE, 0) - default: - return (.UTF8, 0) - } - } - } - - private typealias EncodingBytePrefix = (UInt8, UInt8, UInt8?, UInt8?) - - private static func prefixFromHeader(header: Slice>) -> EncodingBytePrefix? { - if header.count >= 4 { - return(header[0], header[1], header[2], header[3]) - } else if header.count >= 2 { - return (header[0], header[1], nil, nil) - } - return nil - } - - private static func encodingFromBOM(prefix: EncodingBytePrefix) -> ByteStreamPrefixInformation? { - switch prefix { - case(0xFE, 0xFF, _, _): - return (.UTF16BE, 2) - case(0x00, 0x00, 0xFE?, 0xFF?): - return (.UTF32BE, 4) - case(0xEF, 0xBB, 0xBF?, _): - return (.UTF8, 3) - case(0xFF, 0xFE, 0?, 0?): - return (.UTF32LE, 4) - case(0xFF, 0xFE, _, _): - return (.UTF16LE, 2) - default: - return nil - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONLiteralConvertible.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONLiteralConvertible.swift deleted file mode 100755 index b90e05264..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONLiteralConvertible.swift +++ /dev/null @@ -1,130 +0,0 @@ -// -// JSONLiteralConvertible.swift -// Freddy -// -// Created by Zachary Waldowski on 5/11/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -// MARK: - ArrayLiteralConvertible - -extension JSON: ArrayLiteralConvertible { - - /// Create an instance by copying each element of the `collection` into a - /// new `Array`. - public init(_ collection: Collection) { - self = .Array(Swift.Array(collection)) - } - - /// Create an instance initialized with `elements`. - public init(arrayLiteral elements: JSON...) { - self.init(elements) - } - -} - -// MARK: - DictionaryLiteralConvertible - -extension JSON: DictionaryLiteralConvertible { - - /// Create an instance by copying each key/value pair of the `pairs` into - /// a new `Dictionary`. - public init(_ pairs: Dictionary) { - var dictionary = Swift.Dictionary(minimumCapacity: pairs.underestimateCount()) - for (key, value) in pairs { - dictionary[key] = value - } - self = .Dictionary(dictionary) - } - - /// Create an instance initialized with `pairs`. - public init(dictionaryLiteral pairs: (Swift.String, JSON)...) { - self.init(pairs) - } - -} - -// MARK: - FloatLiteralConvertible - -extension JSON: FloatLiteralConvertible { - - /// Create an instance initialized to `Double` `value`. - public init(_ value: Swift.Double) { - self = .Double(value) - } - - /// Create a literal instance initialized to `value`. - public init(floatLiteral value: Swift.Double) { - self.init(value) - } - -} - -// MARK: - IntegerLiteralConvertible - -extension JSON: IntegerLiteralConvertible { - - /// Create an instance initialized to `Int` by `value`. - public init(_ value: Swift.Int) { - self = .Int(value) - } - - /// Create a literal instance initialized to `value`. - public init(integerLiteral value: Swift.Int) { - self.init(value) - } - -} - -// MARK: - StringLiteralConvertible - -extension JSON: StringLiteralConvertible { - - /// Create an instance initialized to `String` by `text`. - public init(_ text: Swift.String) { - self = .String(text) - } - - /// Create a literal instance initialized to `value`. - public init(stringLiteral value: StringLiteralType) { - self.init(value) - } - - /// Create a literal instance initialized to `value`. - public init(extendedGraphemeClusterLiteral value: StringLiteralType) { - self.init(value) - } - - /// Create a literal instance initialized to `value`. - public init(unicodeScalarLiteral value: StringLiteralType) { - self.init(value) - } - -} - -// MARK: - BooleanLiteralConvertible - -extension JSON: BooleanLiteralConvertible { - - /// Create an instance initialized to `Bool` by `value`. - public init(_ value: Swift.Bool) { - self = .Bool(value) - } - - /// Create a literal instance initialized to `value`. - public init(booleanLiteral value: Swift.Bool) { - self.init(value) - } - -} - -// MARK: - NilLiteralConvertible - -extension JSON: NilLiteralConvertible { - - /// Create an instance initialized with `nil`. - public init(nilLiteral: ()) { - self = .Null - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONParser.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONParser.swift deleted file mode 100755 index 00dc9af1f..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONParser.swift +++ /dev/null @@ -1,903 +0,0 @@ -// -// JSONParser.swift -// Freddy -// -// Created by John Gallagher on 4/18/15. -// Copyright © 2015 Big Nerd Ranch. Licensed under MIT. -// - -import Foundation - -private struct Literal { - static let BACKSLASH = UInt8(ascii: "\\") - static let BACKSPACE = UInt8(ascii: "\u{0008}") - static let COLON = UInt8(ascii: ":") - static let COMMA = UInt8(ascii: ",") - static let DOUBLE_QUOTE = UInt8(ascii: "\"") - static let FORMFEED = UInt8(ascii: "\u{000c}") - static let LEFT_BRACE = UInt8(ascii: "{") - static let LEFT_BRACKET = UInt8(ascii: "[") - static let MINUS = UInt8(ascii: "-") - static let NEWLINE = UInt8(ascii: "\n") - static let PERIOD = UInt8(ascii: ".") - static let PLUS = UInt8(ascii: "+") - static let RETURN = UInt8(ascii: "\r") - static let RIGHT_BRACE = UInt8(ascii: "}") - static let RIGHT_BRACKET = UInt8(ascii: "]") - static let SLASH = UInt8(ascii: "/") - static let SPACE = UInt8(ascii: " ") - static let TAB = UInt8(ascii: "\t") - - static let a = UInt8(ascii: "a") - static let b = UInt8(ascii: "b") - static let c = UInt8(ascii: "c") - static let d = UInt8(ascii: "d") - static let e = UInt8(ascii: "e") - static let f = UInt8(ascii: "f") - static let l = UInt8(ascii: "l") - static let n = UInt8(ascii: "n") - static let r = UInt8(ascii: "r") - static let s = UInt8(ascii: "s") - static let t = UInt8(ascii: "t") - static let u = UInt8(ascii: "u") - - static let A = UInt8(ascii: "A") - static let B = UInt8(ascii: "B") - static let C = UInt8(ascii: "C") - static let D = UInt8(ascii: "D") - static let E = UInt8(ascii: "E") - static let F = UInt8(ascii: "F") - - static let zero = UInt8(ascii: "0") - static let one = UInt8(ascii: "1") - static let two = UInt8(ascii: "2") - static let three = UInt8(ascii: "3") - static let four = UInt8(ascii: "4") - static let five = UInt8(ascii: "5") - static let six = UInt8(ascii: "6") - static let seven = UInt8(ascii: "7") - static let eight = UInt8(ascii: "8") - static let nine = UInt8(ascii: "9") -} - -private let ParserMaximumDepth = 512 - - -/// A pure Swift JSON parser. This parser is much faster than the -/// `NSJSONSerialization`-based parser (due to the overhead of having to -/// dynamically cast the Objective-C objects to determine their type); however, -/// it is much newer and has restrictions that the `NSJSONSerialization` parser -/// does not. Two restrictions in particular are that it requires UTF-8 data as -/// input and it does not allow trailing commas in arrays or dictionaries. -public struct JSONParser { - - private enum Sign: Int { - case Positive = 1 - case Negative = -1 - } - - private let input: UnsafeBufferPointer - private let owner: Any? - private var loc = 0 - private var depth = 0 - - private init(buffer: UnsafeBufferPointer, owner: T) { - self.input = buffer - self.owner = owner - } - - /// Decode the root element of the `JSON` stream. This may be any fragment - /// or a structural element, per RFC 7159. - /// - /// The beginning bytes are used to determine the stream's encoding. - /// `JSONParser` currently only supports UTF-8 encoding, with or without - /// a byte-order mark. - /// - /// - throws: `JSONParser.Error` for any decoding failures, including a - /// source location if needed. - public mutating func parse() throws -> JSON { - try guardAgainstUnsupportedEncodings() - let value = try parseValue() - skipWhitespace() - guard loc == input.count else { - throw Error.EndOfStreamGarbage(offset: loc) - } - return value - } - - private mutating func parseValue() throws -> JSON { - guard depth <= ParserMaximumDepth else { - throw Error.ExceededNestingLimit(offset: loc) - } - - guard input.count > 0 else { - throw Error.EndOfStreamUnexpected - } - - advancing: while loc < input.count { - do { - switch input[loc] { - case Literal.LEFT_BRACKET: - depth += 1 - defer { depth -= 1 } - return try decodeArray() - - case Literal.LEFT_BRACE: - depth += 1 - defer { depth -= 1 } - return try decodeObject() - - case Literal.DOUBLE_QUOTE: - return try decodeString() - - case Literal.f: - return try decodeFalse() - - case Literal.n: - return try decodeNull() - - case Literal.t: - return try decodeTrue() - - case Literal.MINUS: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .LeadingMinus)) - - case Literal.zero: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .LeadingZero)) - - case Literal.one...Literal.nine: - return try decodeIntegralValue(NumberParser(loc: loc, input: input, state: .PreDecimalDigits)) - - case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE: - loc = loc.successor() - - default: - break advancing - } - } catch let InternalError.NumberOverflow(offset: start) { - return try decodeNumberAsString(start) - } - } - - throw Error.ValueInvalid(offset: loc, character: UnicodeScalar(input[loc])) - } - - private mutating func skipWhitespace() { - while loc < input.count { - switch input[loc] { - case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE: - loc = loc.successor() - - default: - return - } - } - } - - private mutating func guardAgainstUnsupportedEncodings() throws { - let header = input.prefix(4) - let encodingPrefixInformation = JSONEncodingDetector.detectEncoding(header) - guard JSONEncodingDetector.supportedEncodings.contains(encodingPrefixInformation.encoding) else { - throw Error.InvalidUnicodeStreamEncoding(detectedEncoding: encodingPrefixInformation.encoding) - } - loc = loc.advancedBy(encodingPrefixInformation.byteOrderMarkLength) - } - - private mutating func decodeNull() throws -> JSON { - guard loc.advancedBy(3, limit: input.count) != input.count else { - throw Error.LiteralNilMisspelled(offset: loc) - } - - if input[loc+1] != Literal.u - || input[loc+2] != Literal.l - || input[loc+3] != Literal.l { - throw Error.LiteralNilMisspelled(offset: loc) - } - - loc += 4 - return .Null - } - - private mutating func decodeTrue() throws -> JSON { - guard loc.advancedBy(3, limit: input.count) != input.count else { - throw Error.LiteralTrueMisspelled(offset: loc) - } - - if input[loc+1] != Literal.r - || input[loc+2] != Literal.u - || input[loc+3] != Literal.e { - throw Error.LiteralTrueMisspelled(offset: loc) - } - - loc += 4 - return .Bool(true) - } - - private mutating func decodeFalse() throws -> JSON { - guard loc.advancedBy(4, limit: input.count) != input.count else { - throw Error.LiteralFalseMisspelled(offset: loc) - } - - if input[loc+1] != Literal.a - || input[loc+2] != Literal.l - || input[loc+3] != Literal.s - || input[loc+4] != Literal.e { - throw Error.LiteralFalseMisspelled(offset: loc) - } - - loc += 5 - return .Bool(false) - } - - private var stringDecodingBuffer = [UInt8]() - private mutating func decodeString() throws -> JSON { - let start = loc - loc = loc.successor() - stringDecodingBuffer.removeAll(keepCapacity: true) - while loc < input.count { - switch input[loc] { - case Literal.BACKSLASH: - loc = loc.successor() - switch input[loc] { - case Literal.DOUBLE_QUOTE: stringDecodingBuffer.append(Literal.DOUBLE_QUOTE) - case Literal.BACKSLASH: stringDecodingBuffer.append(Literal.BACKSLASH) - case Literal.SLASH: stringDecodingBuffer.append(Literal.SLASH) - case Literal.b: stringDecodingBuffer.append(Literal.BACKSPACE) - case Literal.f: stringDecodingBuffer.append(Literal.FORMFEED) - case Literal.r: stringDecodingBuffer.append(Literal.RETURN) - case Literal.t: stringDecodingBuffer.append(Literal.TAB) - case Literal.n: stringDecodingBuffer.append(Literal.NEWLINE) - case Literal.u: - loc = loc.successor() - try readUnicodeEscape(start: loc - 2) - - // readUnicodeEscape() advances loc on its own, so we'll `continue` now - // to skip the typical "advance past this character" for all the other escapes - continue - - default: - throw Error.ControlCharacterUnrecognized(offset: loc) - } - loc = loc.successor() - - case Literal.DOUBLE_QUOTE: - loc = loc.successor() - stringDecodingBuffer.append(0) - - guard let string = (stringDecodingBuffer.withUnsafeBufferPointer { - String.fromCString(UnsafePointer($0.baseAddress)) - }) else { - throw Error.UnicodeEscapeInvalid(offset: start) - } - - return .String(string) - - case let other: - stringDecodingBuffer.append(other) - loc = loc.successor() - } - } - - throw Error.EndOfStreamUnexpected - } - - private mutating func readCodeUnit() -> UInt16? { - guard loc + 4 <= input.count else { - return nil - } - var codeUnit: UInt16 = 0 - for c in input[loc.. JSON { - let start = loc - loc = loc.successor() - var items = [JSON]() - - while loc < input.count { - skipWhitespace() - - if loc < input.count && input[loc] == Literal.RIGHT_BRACKET { - loc = loc.successor() - return .Array(items) - } - - if !items.isEmpty { - guard loc < input.count && input[loc] == Literal.COMMA else { - throw Error.CollectionMissingSeparator(offset: start) - } - loc = loc.successor() - } - - items.append(try parseValue()) - } - - throw Error.EndOfStreamUnexpected - } - - // Decoding objects can be recursive, so we have to keep more than one - // buffer around for building up key/value pairs (to reduce allocations - // when parsing large JSON documents). - // - // Rough estimate of the difference between this and using a fresh - // [(String,JSON)] for the `pairs` variable in decodeObject() below is - // about 12% on an iPhone 5. - private struct DecodeObjectBuffers { - var buffers = [[(String,JSON)]]() - - mutating func getBuffer() -> [(String,JSON)] { - if !buffers.isEmpty { - var buffer = buffers.removeLast() - buffer.removeAll(keepCapacity: true) - return buffer - } - return [(String,JSON)]() - } - - mutating func putBuffer(buffer: [(String,JSON)]) { - buffers.append(buffer) - } - } - - private var decodeObjectBuffers = DecodeObjectBuffers() - - private mutating func decodeObject() throws -> JSON { - let start = loc - loc = loc.successor() - var pairs = decodeObjectBuffers.getBuffer() - - while loc < input.count { - skipWhitespace() - - if loc < input.count && input[loc] == Literal.RIGHT_BRACE { - loc = loc.successor() - var obj = [String:JSON](minimumCapacity: pairs.count) - for (k, v) in pairs { - obj[k] = v - } - decodeObjectBuffers.putBuffer(pairs) - return .Dictionary(obj) - } - - if !pairs.isEmpty { - guard loc < input.count && input[loc] == Literal.COMMA else { - throw Error.CollectionMissingSeparator(offset: start) - } - loc = loc.successor() - - skipWhitespace() - } - - guard loc < input.count && input[loc] == Literal.DOUBLE_QUOTE else { - throw Error.DictionaryMissingKey(offset: start) - } - - let key = try decodeString().string() - skipWhitespace() - - guard loc < input.count && input[loc] == Literal.COLON else { - throw Error.CollectionMissingSeparator(offset: start) - } - loc = loc.successor() - - pairs.append((key, try parseValue())) - } - - throw Error.EndOfStreamUnexpected - } - - private mutating func decodeIntegralValue(parser: NumberParser) throws -> JSON { - var sign = Sign.Positive - var parser = parser - var value = 0 - - // This would be more natural as `while true { ... }` with a meaningful .Done case, - // but that causes compile time explosion in Swift 2.2. :-| - while parser.state != .Done { - switch parser.state { - case .LeadingMinus: - sign = .Negative - try parser.parseNegative() - - case .LeadingZero: - parser.parseLeadingZero() - - case .PreDecimalDigits: - try parser.parsePreDecimalDigits { c in - guard case let (exponent, false) = Int.multiplyWithOverflow(10, value) else { - throw InternalError.NumberOverflow(offset: parser.start) - } - - guard case let (newValue, false) = Int.addWithOverflow(exponent, Int(c - Literal.zero)) else { - throw InternalError.NumberOverflow(offset: parser.start) - } - - value = newValue - } - - case .Decimal, .Exponent: - return try detectingFloatingPointErrors(parser.start) { - try decodeFloatingPointValue(parser, sign: sign, value: Double(value)) - } - - case .PostDecimalDigits, .ExponentSign, .ExponentDigits: - assertionFailure("Invalid internal state while parsing number") - - case .Done: - fatalError("impossible condition") - } - } - - guard case let (signedValue, false) = Int.multiplyWithOverflow(sign.rawValue, value) else { - throw InternalError.NumberOverflow(offset: parser.start) - } - - loc = parser.loc - return .Int(signedValue) - } - - private mutating func decodeFloatingPointValue(parser: NumberParser, sign: Sign, value: Double) throws -> JSON { - var parser = parser - var value = value - var exponentSign = Sign.Positive - var exponent = Double(0) - var position = 0.1 - - // This would be more natural as `while true { ... }` with a meaningful .Done case, - // but that causes compile time explosion in Swift 2.2. :-| - while parser.state != .Done { - switch parser.state { - case .LeadingMinus, .LeadingZero, .PreDecimalDigits: - assertionFailure("Invalid internal state while parsing number") - - case .Decimal: - try parser.parseDecimal() - - case .PostDecimalDigits: - parser.parsePostDecimalDigits { c in - value += position * Double(c - Literal.zero) - position /= 10 - } - - case .Exponent: - exponentSign = try parser.parseExponent() - - case .ExponentSign: - try parser.parseExponentSign() - - case .ExponentDigits: - parser.parseExponentDigits { c in - exponent = exponent * 10 + Double(c - Literal.zero) - } - - case .Done: - fatalError("impossible condition") - } - } - - loc = parser.loc - return .Double(Double(sign.rawValue) * value * pow(10, Double(exponentSign.rawValue) * exponent)) - } - - private mutating func decodeNumberAsString(start: Int) throws -> JSON { - var parser: NumberParser = { - let state: NumberParser.State - switch input[start] { - case Literal.MINUS: state = .LeadingMinus - case Literal.zero: state = .LeadingZero - case Literal.one...Literal.nine: state = .PreDecimalDigits - default: - fatalError("Internal error: decodeNumber called on not-a-number") - } - return NumberParser(loc: start, input: input, state: state) - }() - - stringDecodingBuffer.removeAll(keepCapacity: true) - - while true { - switch parser.state { - case .LeadingMinus: - try parser.parseNegative() - stringDecodingBuffer.append(Literal.MINUS) - - case .LeadingZero: - parser.parseLeadingZero() - stringDecodingBuffer.append(Literal.zero) - - case .PreDecimalDigits: - parser.parsePreDecimalDigits { stringDecodingBuffer.append($0) } - - case .Decimal: - try parser.parseDecimal() - stringDecodingBuffer.append(Literal.PERIOD) - - case .PostDecimalDigits: - parser.parsePostDecimalDigits { stringDecodingBuffer.append($0) } - - case .Exponent: - stringDecodingBuffer.append(input[parser.loc]) - _ = try parser.parseExponent() - - case .ExponentSign: - stringDecodingBuffer.append(input[parser.loc]) - try parser.parseExponentSign() - - case .ExponentDigits: - parser.parseExponentDigits { stringDecodingBuffer.append($0) } - - case .Done: - stringDecodingBuffer.append(0) - guard let string = (stringDecodingBuffer.withUnsafeBufferPointer { - String.fromCString(UnsafePointer($0.baseAddress)) - }) else { - // Should never fail - any problems with the number string should - // result in thrown errors above - fatalError("Internal error: Invalid numeric string") - } - - loc = parser.loc - return .String(string) - } - } - } - - private func detectingFloatingPointErrors(loc: Int, @noescape _ f: () throws -> T) throws -> T { - let flags = FE_UNDERFLOW | FE_OVERFLOW - feclearexcept(flags) - let value = try f() - guard fetestexcept(flags) == 0 else { - throw InternalError.NumberOverflow(offset: loc) - } - return value - } -} - -private struct NumberParser { - enum State { - case LeadingMinus - case LeadingZero - case PreDecimalDigits - case Decimal - case PostDecimalDigits - case Exponent - case ExponentSign - case ExponentDigits - case Done - } - - let start: Int - var loc = 0 - var state: State - let input: UnsafeBufferPointer - - init(loc: Int, input: UnsafeBufferPointer, state: State) { - assert(loc < input.count, "Invalid input to NumberParser") - self.start = loc - self.loc = loc - self.input = input - self.state = state - } - - mutating func parseNegative() throws { - assert(state == .LeadingMinus, "Unexpected state entering parseNegative") - - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero: - state = .LeadingZero - - case Literal.one...Literal.nine: - state = .PreDecimalDigits - - default: - throw JSONParser.Error.NumberSymbolMissingDigits(offset: start) - } - } - - mutating func parseLeadingZero() { - assert(state == .LeadingZero, "Unexpected state entering parseLeadingZero") - - loc = loc.successor() - guard loc < input.count else { - state = .Done - return - } - - guard input[loc] == Literal.PERIOD else { - state = .Done - return - } - - state = .Decimal - } - - mutating func parsePreDecimalDigits(@noescape f: (UInt8) throws -> Void) rethrows { - assert(state == .PreDecimalDigits, "Unexpected state entering parsePreDecimalDigits") - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = loc.successor() - - case Literal.PERIOD: - state = .Decimal - return - - case Literal.e, Literal.E: - state = .Exponent - return - - default: - break advancing - } - } - - state = .Done - } - - mutating func parseDecimal() throws { - assert(state == .Decimal, "Unexpected state entering parseDecimal") - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .PostDecimalDigits - - default: - throw JSONParser.Error.NumberMissingFractionalDigits(offset: start) - } - } - - mutating func parsePostDecimalDigits(@noescape f: (UInt8) throws -> Void) rethrows { - assert(state == .PostDecimalDigits, "Unexpected state entering parsePostDecimalDigits") - - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = loc.successor() - - case Literal.e, Literal.E: - state = .Exponent - return - - default: - break advancing - } - } - - state = .Done - } - - mutating func parseExponent() throws -> JSONParser.Sign { - assert(state == .Exponent, "Unexpected state entering parseExponent") - - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .ExponentDigits - - case Literal.PLUS: - state = .ExponentSign - - case Literal.MINUS: - state = .ExponentSign - return .Negative - - default: - throw JSONParser.Error.NumberSymbolMissingDigits(offset: start) - } - - return .Positive - } - - mutating func parseExponentSign() throws { - assert(state == .ExponentSign, "Unexpected state entering parseExponentSign") - loc = loc.successor() - guard loc < input.count else { - throw JSONParser.Error.EndOfStreamUnexpected - } - - switch input[loc] { - case Literal.zero...Literal.nine: - state = .ExponentDigits - - default: - throw JSONParser.Error.NumberSymbolMissingDigits(offset: start) - } - } - - mutating func parseExponentDigits(@noescape f: (UInt8) throws -> Void) rethrows { - assert(state == .ExponentDigits, "Unexpected state entering parseExponentDigits") - advancing: while loc < input.count { - let c = input[loc] - switch c { - case Literal.zero...Literal.nine: - try f(c) - loc = loc.successor() - - default: - break advancing - } - } - - state = .Done - } -} - -public extension JSONParser { - - /// Creates a `JSONParser` ready to parse UTF-8 encoded `NSData`. - /// - /// If the data is mutable, it is copied before parsing. The data's lifetime - /// is extended for the duration of parsing. - init(utf8Data inData: NSData) { - let data = inData.copy() as! NSData - let buffer = UnsafeBufferPointer(start: UnsafePointer(data.bytes), count: data.length) - self.init(buffer: buffer, owner: data) - } - - /// Creates a `JSONParser` from the code units represented by the `string`. - /// - /// The synthesized string is lifetime-extended for the duration of parsing. - init(string: String) { - let codePoints = string.nulTerminatedUTF8 - let buffer = codePoints.withUnsafeBufferPointer { nulTerminatedBuffer in - // don't want to include the nul termination in the buffer - trim it off - UnsafeBufferPointer(start: nulTerminatedBuffer.baseAddress, count: nulTerminatedBuffer.count - 1) - } - self.init(buffer: buffer, owner: codePoints) - } - -} - -extension JSONParser: JSONParserType { - - /// Creates an instance of `JSON` from UTF-8 encoded `NSData`. - /// - parameter data: An instance of `NSData` to parse `JSON` from. - /// - throws: Any `JSONParser.Error` that arises during decoding. - /// - seealso: JSONParser.parse() - public static func createJSONFromData(data: NSData) throws -> JSON { - var parser = JSONParser(utf8Data: data) - return try parser.parse() - } - -} - -// MARK: - Errors - -extension JSONParser { - - /// Enumeration describing possible errors that occur while parsing a JSON - /// document. Most errors include an associated `offset`, representing the - /// offset into the UTF-8 characters making up the document where the error - /// occurred. - public enum Error: ErrorType { - /// The parser ran out of data prematurely. This usually means a value - /// was not escaped, such as a string literal not ending with a double - /// quote. - case EndOfStreamUnexpected - - /// Unexpected non-whitespace data was left around `offset` after - /// parsing all valid JSON. - case EndOfStreamGarbage(offset: Int) - - /// Too many nested objects or arrays occured at the literal started - /// around `offset`. - case ExceededNestingLimit(offset: Int) - - /// A `character` was not a valid start of a value around `offset`. - case ValueInvalid(offset: Int, character: UnicodeScalar) - - /// Badly-formed Unicode escape sequence at `offset`. A Unicode escape - /// uses the text "\u" followed by 4 hex digits, such as "\uF09F\uA684" - /// to represent U+1F984, "UNICORN FACE". - case UnicodeEscapeInvalid(offset: Int) - - /// Badly-formed control character around `offset`. JSON supports - /// backslash-escaped double quotes, slashes, whitespace control codes, - /// and Unicode escape sequences. - case ControlCharacterUnrecognized(offset: Int) - - /// Invalid token, expected `null` around `offset` - case LiteralNilMisspelled(offset: Int) - - /// Invalid token, expected `true` around `offset` - case LiteralTrueMisspelled(offset: Int) - - /// Invalid token, expected `false` around `offset` - case LiteralFalseMisspelled(offset: Int) - - /// Badly-formed collection at given `offset`, expected `,` or `:` - case CollectionMissingSeparator(offset: Int) - - /// While parsing an object literal, a value was found without a key - /// around `offset`. The start of a string literal was expected. - case DictionaryMissingKey(offset: Int) - - /// Badly-formed number with no digits around `offset`. After a decimal - /// point, a number must include some number of digits. - case NumberMissingFractionalDigits(offset: Int) - - /// Badly-formed number with symbols ("-" or "e") but no following - /// digits around `offset`. - case NumberSymbolMissingDigits(offset: Int) - - /// Supplied data is encoded in an unsupported format. - case InvalidUnicodeStreamEncoding(detectedEncoding: JSONEncodingDetector.Encoding) - } - - private enum InternalError: ErrorType { - /// Attempted to parse an integer outside the range of [Int.min, Int.max] - /// or a double outside the range of representable doubles. Note that - /// for doubles, this could be an overflow or an underflow - we don't - /// get enough information from Swift here to know which it is. The number - /// causing the overflow/underflow began at `offset`. - case NumberOverflow(offset: Int) - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONParsing.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONParsing.swift deleted file mode 100755 index 90cb6be23..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONParsing.swift +++ /dev/null @@ -1,126 +0,0 @@ -// -// JSONParsing.swift -// Freddy -// -// Created by Matthew D. Mathias on 3/17/15. -// Copyright © 2015 Big Nerd Ranch. All rights reserved. -// - -import Foundation - -// MARK: - Deserialize JSON - -/// Protocol describing a backend parser that can produce `JSON` from `NSData`. -public protocol JSONParserType { - - /// Creates an instance of `JSON` from `NSData`. - /// - parameter data: An instance of `NSData` to use to create `JSON`. - /// - throws: An error that may arise from calling `JSONObjectWithData(_:options:)` on `NSJSONSerialization` with the given data. - /// - returns: An instance of `JSON`. - static func createJSONFromData(data: NSData) throws -> JSON - -} - -extension JSON { - - /// Create `JSON` from UTF-8 `data`. By default, parses using the - /// Swift-native `JSONParser` backend. - public init(data: NSData, usingParser parser: JSONParserType.Type = JSONParser.self) throws { - self = try parser.createJSONFromData(data) - } - - /// Create `JSON` from UTF-8 `string`. - public init(jsonString: Swift.String, usingParser parser: JSONParserType.Type = JSONParser.self) throws { - self = try parser.createJSONFromData((jsonString as NSString).dataUsingEncoding(NSUTF8StringEncoding) ?? NSData()) - } -} - -// MARK: - NSJSONSerialization - -extension NSJSONSerialization: JSONParserType { - - // MARK: Decode NSData - - /// Use the built-in, Objective-C based JSON parser to create `JSON`. - /// - parameter data: An instance of `NSData`. - /// - returns: An instance of `JSON`. - /// - throws: An error that may arise if the `NSData` cannot be parsed into an object. - public static func createJSONFromData(data: NSData) throws -> JSON { - return makeJSON(try NSJSONSerialization.JSONObjectWithData(data, options: [])) - } - - // MARK: Make JSON - - /// Makes a `JSON` object by matching its argument to a case in the `JSON` enum. - /// - parameter object: The instance of `AnyObject` returned from serializing the JSON. - /// - returns: An instance of `JSON` matching the JSON given to the function. - private static func makeJSON(object: AnyObject) -> JSON { - switch object { - case let n as NSNumber: - let numberType = CFNumberGetType(n) - switch numberType { - case .CharType: - return .Bool(n.boolValue) - - case .ShortType, .IntType, .LongType, .CFIndexType, .NSIntegerType, .SInt8Type, .SInt16Type, .SInt32Type: - return .Int(n.integerValue) - - case .SInt64Type, .LongLongType /* overflows 32-bit Int */: - #if /* 32-bit arch */ arch(arm) || arch(i386) - // Why double, when the Freddy parser would bump to String? - // - // Returning Double avoids making the type depend on whether you're running - // 32-bit or 64-bit code when using the NSJSONSerialization parser. - // NSJSONSerialization appears to bump numbers larger than Int.max to Double on - // 64-bit platforms but use .SInt64Type on 32-bit platforms. - // If we returned a String here, you'd get a String value on 32-bit, - // but a Double value on 64-bit. Instead, we return Double. - // - // This means that, if you switch parsers, - // you'll have to switch from .double to .string for pulling out - // overflowing values, but if you stick with a single parser, - // you at least won't have architecture-dependent lookups! - return .Double(n.doubleValue) - #else - return .Int(n.integerValue) - #endif - - case .Float32Type, .Float64Type, .FloatType, .DoubleType, .CGFloatType: - return .Double(n.doubleValue) - } - - case let arr as [AnyObject]: - return makeJSONArray(arr) - - case let dict as [Swift.String: AnyObject]: - return makeJSONDictionary(dict) - - case let s as Swift.String: - return .String(s) - - default: - return .Null - } - } - - // MARK: Make a JSON Array - - /// Makes a `JSON` array from the object passed in. - /// - parameter jsonArray: The array to transform into a `JSON`. - /// - returns: An instance of `JSON` matching the array. - private static func makeJSONArray(jsonArray: [AnyObject]) -> JSON { - return .Array(jsonArray.map(makeJSON)) - } - - // MARK: Make a JSON Dictionary - - /// Makes a `JSON` dictionary from the Cocoa dictionary passed in. - /// - parameter jsonDict: The dictionary to transform into `JSON`. - /// - returns: An instance of `JSON` matching the dictionary. - private static func makeJSONDictionary(jsonDict: [Swift.String: AnyObject]) -> JSON { - return JSON(jsonDict.lazy.map { (key, value) in - (key, makeJSON(value)) - }) - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONSerializing.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONSerializing.swift deleted file mode 100755 index 343a5a30d..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONSerializing.swift +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2016 Big Nerd Ranch, Inc. Licensed under the MIT license WITHOUT ANY WARRANTY. - -import Foundation - -// MARK: - Serialize JSON - -extension JSON { - - /// Attempt to serialize `JSON` into an `NSData`. - /// - returns: A byte-stream containing the `JSON` ready for wire transfer. - /// - throws: Errors that arise from `NSJSONSerialization`. - /// - see: Foundation.NSJSONSerialization - public func serialize() throws -> NSData { - let obj: AnyObject = toNSJSONSerializationObject() - return try NSJSONSerialization.dataWithJSONObject(obj, options: []) - } - - /// A function to help with the serialization of `JSON`. - /// - returns: An `AnyObject` suitable for `NSJSONSerialization`'s use. - private func toNSJSONSerializationObject() -> AnyObject { - switch self { - case .Array(let jsonArray): - return jsonArray.map { $0.toNSJSONSerializationObject() } - case .Dictionary(let jsonDictionary): - var cocoaDictionary = Swift.Dictionary(minimumCapacity: jsonDictionary.count) - for (key, json) in jsonDictionary { - cocoaDictionary[key] = json.toNSJSONSerializationObject() - } - return cocoaDictionary - case .String(let str): - return str - case .Double(let num): - return num - case .Int(let int): - return int - case .Bool(let b): - return b - case .Null: - return NSNull() - } - - } -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONSubscripting.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONSubscripting.swift deleted file mode 100755 index 785f8ce9b..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/JSONSubscripting.swift +++ /dev/null @@ -1,643 +0,0 @@ -// -// JSONSubscripting.swift -// Freddy -// -// Created by Zachary Waldowski on 8/15/15. -// Copyright © 2015 Big Nerd Ranch. All rights reserved. -// - -// MARK: JSONPathType - -/// A protocol used to define a path within an instance of `JSON` that leads to some desired value. -/// -/// A custom type, such as a `RawRepresentable` enum, may be made to conform to `JSONPathType` -/// and used with the subscript APIs. -public protocol JSONPathType { - /// Use `self` to key into a `dictionary`. - /// - /// Unlike Swift dictionaries, failing to find a value for a key should throw - /// an error rather than convert to `nil`. - /// - /// Upon failure, implementers should throw an error from `JSON.Error`. - func valueInDictionary(dictionary: [Swift.String : JSON]) throws -> JSON - - /// Use `self` to index into an `array`. - /// - /// Unlike Swift array, attempting to index outside the collection's bounds - /// should throw an error rather than crash. - /// - /// Upon failure, implementers should throw an error from `JSON.Error`. - func valueInArray(array: [JSON]) throws -> JSON -} - -extension JSONPathType { - - /// The default behavior for keying into a dictionary is to throw - /// `JSON.Error.UnexpectedSubscript`. - public func valueInDictionary(dictionary: [Swift.String : JSON]) throws -> JSON { - throw JSON.Error.UnexpectedSubscript(type: Self.self) - } - - /// The default behavior for indexing into an array is to throw - /// `JSON.Error.UnexpectedSubscript`. - public func valueInArray(array: [JSON]) throws -> JSON { - throw JSON.Error.UnexpectedSubscript(type: Self.self) - } - -} - -extension String: JSONPathType { - - /// A method used to retrieve a value from a given dictionary for a specific key. - /// - throws: `.KeyNotFound` with an associated value of `self`, where `self` is a `String`, - /// should the key not be present within the `JSON`. - /// - returns: The `JSON` value associated with the given key. - public func valueInDictionary(dictionary: [Swift.String : JSON]) throws -> JSON { - guard let next = dictionary[self] else { - throw JSON.Error.KeyNotFound(key: self) - } - return next - } - -} - -extension Int: JSONPathType { - - /// A method used to retrieve a value from a given array for a specific index. - /// - throws: `.IndexOutOfBounds` with an associated value of `self`, where `self` is an `Int`, - /// should the index not be within the valid range for the array of `JSON`. - /// - returns: The `JSON` value found at the given index. - public func valueInArray(array: [JSON]) throws -> JSON { - guard case array.indices = self else { - throw JSON.Error.IndexOutOfBounds(index: self) - } - return array[self] - } - -} - -// MARK: - Subscripting core - -private extension JSON { - - enum SubscriptError: ErrorType { - case SubscriptIntoNull(JSONPathType) - } - - func valueForPathFragment(fragment: JSONPathType, detectNull: Swift.Bool) throws -> JSON { - switch self { - case .Null where detectNull: - throw SubscriptError.SubscriptIntoNull(fragment) - case let .Dictionary(dict): - return try fragment.valueInDictionary(dict) - case let .Array(array): - return try fragment.valueInArray(array) - default: - throw Error.UnexpectedSubscript(type: fragment.dynamicType) - } - } - - func valueAtPath(path: [JSONPathType], detectNull: Swift.Bool = false) throws -> JSON { - var result = self - for fragment in path { - result = try result.valueForPathFragment(fragment, detectNull: detectNull) - } - return result - } - -} - -// MARK: - Subscripting operator - -extension JSON { - - public subscript(key: Swift.String) -> JSON? { - return try? valueForPathFragment(key, detectNull: false) - } - - public subscript(index: Swift.Int) -> JSON? { - return try? valueForPathFragment(index, detectNull: false) - } - -} - -// MARK: - Simple member unpacking - -extension JSON { - - /// Attempts to decode into the returning type from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON`. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An initialized member from the inner JSON. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A given `String` key does not exist inside a - /// descendant `JSON` dictionary. - /// * `IndexOutOfBounds`: A given `Int` index is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A given subscript cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of - /// the `JSON` instance does not match `Decoded`. - public func decode(path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> Decoded { - return try Decoded(json: valueAtPath(path)) - } - - /// Retrieves a `Double` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A floating-point `Double` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func double(path: JSONPathType...) throws -> Swift.Double { - return try Swift.Double(json: valueAtPath(path)) - } - - /// Retrieves an `Int` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A numeric `Int` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func int(path: JSONPathType...) throws -> Swift.Int { - return try Swift.Int(json: valueAtPath(path)) - } - - /// Retrieves a `String` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A textual `String` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func string(path: JSONPathType...) throws -> Swift.String { - return try Swift.String(json: valueAtPath(path)) - } - - /// Retrieves a `Bool` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: A truthy `Bool` - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func bool(path: JSONPathType...) throws -> Swift.Bool { - return try Swift.Bool(json: valueAtPath(path)) - } - - /// Retrieves a `[JSON]` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: An `Array` of `JSON` elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func array(path: JSONPathType...) throws -> [JSON] { - return try JSON.getArray(valueAtPath(path)) - } - - /// Attempts to decodes many values from a desendant JSON array at a path - /// into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: An `Array` of decoded elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`, or - /// any error that arises from decoding the contained values. - /// - seealso: `JSON.decode(_:type:)` - public func arrayOf(path: JSONPathType..., type: Decoded.Type = Decoded.self) throws -> [Decoded] { - return try JSON.getArrayOf(valueAtPath(path)) - } - - /// Retrieves a `[String: JSON]` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: One of the `JSON.Error` cases thrown by `decode(_:type:)`. - /// - seealso: `JSON.decode(_:type:)` - public func dictionary(path: JSONPathType...) throws -> [Swift.String: JSON] { - return try JSON.getDictionary(valueAtPath(path)) - } - -} - -// MARK: - NotFound-Or-Null-to-Optional unpacking - -extension JSON { - - /// An `OptionSetType` used to represent the different options available for subscripting `JSON` with `null` values or missing keys. - /// * `.NullBecomesNil` - Treat `null` values as `nil`. - /// * `.MissingKeyBecomesNil` - Treat missing keys as `nil`. - public struct SubscriptingOptions: OptionSetType { - public let rawValue: Swift.Int - public init(rawValue: Swift.Int) { - self.rawValue = rawValue - } - - /// Treat `null` values as `nil`. - public static let NullBecomesNil = SubscriptingOptions(rawValue: 1 << 0) - /// Treat missing keys as `nil`. - public static let MissingKeyBecomesNil = SubscriptingOptions(rawValue: 1 << 1) - } - - private func mapOptionalAtPath(path: [JSONPathType], alongPath: SubscriptingOptions, @noescape transform: JSON throws -> Value) throws -> Value? { - let detectNull = alongPath.contains(.NullBecomesNil) - let detectNotFound = alongPath.contains(.MissingKeyBecomesNil) - var json: JSON? - do { - json = try valueAtPath(path, detectNull: detectNull) - return try json.map(transform) - } catch Error.IndexOutOfBounds where detectNotFound { - return nil - } catch Error.KeyNotFound where detectNotFound { - return nil - } catch Error.ValueNotConvertible where detectNull && json == .Null { - return nil - } catch SubscriptError.SubscriptIntoNull where detectNull { - return nil - } - } -} - -extension JSON { - - /// Optionally decodes into the returning type from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - parameter type: If the context this method is called from does not - /// make the return type clear, pass a type implementing `JSONDecodable` - /// to disambiguate the type to decode with. - /// - returns: A decoded value from the inner JSON if found, or `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func decode(path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> Decoded? { - return try mapOptionalAtPath(path, alongPath: options, transform: Decoded.init) - } - - /// Optionally retrieves a `Double` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON`. - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A `Double` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func double(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.Double? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Double.init) - } - - /// Optionally retrieves a `Int` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A numeric `Int` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func int(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.Int? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Int.init) - } - - /// Optionally retrieves a `String` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A text `String` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func string(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.String? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.String.init) - } - - /// Optionally retrieves a `Bool` from a path into JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A truthy `Bool` if a value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func bool(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> Swift.Bool? { - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Bool.init) - } - - /// Optionally retrieves a `[JSON]` from a path into the recieving structure. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: An `Array` of `JSON` elements if a value could be found, - /// otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func array(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> [JSON]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArray) - } - - /// Optionally decodes many values from a descendant array at a path into - /// JSON. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: An `Array` of decoded elements if found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func arrayOf(path: JSONPathType..., alongPath options: SubscriptingOptions, type: Decoded.Type = Decoded.self) throws -> [Decoded]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArrayOf) - } - - /// Optionally retrieves a `[String: JSON]` from a path into the recieving - /// structure. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter alongPath: Options that control what should be done with values that are `null` or keys that are missing. - /// - returns: A `Dictionary` of `String` mapping to `JSON` elements if a - /// value could be found, otherwise `nil`. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func dictionary(path: JSONPathType..., alongPath options: SubscriptingOptions) throws -> [Swift.String: JSON]? { - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionary) - } - -} - -// MARK: - Missing-with-fallback unpacking - -extension JSON { - - private func mapOptionalAtPath(path: [JSONPathType], @noescape fallback: () -> Value, @noescape transform: JSON throws -> Value) throws -> Value { - return try mapOptionalAtPath(path, alongPath: .MissingKeyBecomesNil, transform: transform) ?? fallback() - } - - /// Attempts to decode into the returning type from a path into - /// JSON, or returns a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Value to use when one is missing at the subscript. - /// - returns: An initialized member from the inner JSON. - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `UnexpectedSubscript`: A given subscript cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of - /// the `JSON` instance does not match `Decoded`. - public func decode(path: JSONPathType..., @autoclosure or fallback: () -> Decoded) throws -> Decoded { - return try mapOptionalAtPath(path, fallback: fallback, transform: Decoded.init) - } - - /// Retrieves a `Double` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Array to use when one is missing at the subscript. - /// - returns: A floating-point `Double` - /// - throws: One of the `JSON.Error` cases thrown by calling `mapOptionalAtPath(_:fallback:transform:)`. - /// - seealso: `optionalAtPath(_:ifNotFound)`. - public func double(path: JSONPathType..., @autoclosure or fallback: () -> Swift.Double) throws -> Swift.Double { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.Double.init) - } - - /// Retrieves an `Int` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Array to use when one is missing at the subscript. - /// - returns: A numeric `Int` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func int(path: JSONPathType..., @autoclosure or fallback: () -> Swift.Int) throws -> Swift.Int { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.Int.init) - } - - /// Retrieves a `String` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Array to use when one is missing at the subscript. - /// - returns: A textual `String` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func string(path: JSONPathType..., @autoclosure or fallback: () -> Swift.String) throws -> Swift.String { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.String.init) - } - - /// Retrieves a `Bool` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Array to use when one is missing at the subscript. - /// - returns: A truthy `Bool` - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func bool(path: JSONPathType..., @autoclosure or fallback: () -> Swift.Bool) throws -> Swift.Bool { - return try mapOptionalAtPath(path, fallback: fallback, transform: Swift.Bool.init) - } - - /// Retrieves a `[JSON]` from a path into JSON or a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Array to use when one is missing at the subscript. - /// - returns: An `Array` of `JSON` elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func array(path: JSONPathType..., @autoclosure or fallback: () -> [JSON]) throws -> [JSON] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getArray) - } - - /// Attempts to decodes many values from a desendant JSON array at a path - /// into the recieving structure, returning a fallback if not found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Array to use when one is missing at the subscript. - /// - returns: An `Array` of decoded elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - /// * Any error that arises from decoding the value. - public func arrayOf(path: JSONPathType..., @autoclosure or fallback: () -> [Decoded]) throws -> [Decoded] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getArrayOf) - } - - /// Retrieves a `[String: JSON]` from a path into JSON or a fallback if not - /// found. - /// - parameter path: 0 or more `String` or `Int` that subscript the `JSON` - /// - parameter fallback: Value to use when one is missing at the subscript - /// - returns: An `Dictionary` of `String` mapping to `JSON` elements - /// - throws: One of the following errors contained in `JSON.Error`: - /// * `KeyNotFound`: A key `path` does not exist inside a descendant - /// `JSON` dictionary. - /// * `IndexOutOfBounds`: An index `path` is outside the bounds of a - /// descendant `JSON` array. - /// * `UnexpectedSubscript`: A `path` item cannot be used with the - /// corresponding `JSON` value. - /// * `TypeNotConvertible`: The target value's type inside of the `JSON` - /// instance does not match the decoded value. - public func dictionary(path: JSONPathType..., @autoclosure or fallback: () -> [Swift.String: JSON]) throws -> [Swift.String: JSON] { - return try mapOptionalAtPath(path, fallback: fallback, transform: JSON.getDictionary) - } - -} - -// MARK: - Deprecated methods - -extension JSON { - - @available(*, deprecated, message="Use 'decode(_:alongPath:type:)' with options '[.MissingKeyBecomesNil]'") - public func decode(path: JSONPathType..., ifNotFound: Swift.Bool, type: Decoded.Type = Decoded.self) throws -> Decoded? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Decoded.init) - } - - @available(*, deprecated, message="Use 'decode(_:alongPath:type:)' with options '[.NullBecomesNil]'") - public func decode(path: JSONPathType..., ifNull: Swift.Bool, type: Decoded.Type = Decoded.self) throws -> Decoded? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Decoded.init) - } - - @available(*, deprecated, message="Use 'double(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func double(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.Double? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Double.init) - } - - @available(*, deprecated, message="Use 'double(_:alongPath:)' with options '[.NullBecomesNil]'") - public func double(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.Double? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Double.init) - } - - @available(*, deprecated, message="Use 'int(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func int(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.Int? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Int.init) - } - - @available(*, deprecated, message="Use 'int(_:alongPath:)' with options '[.NullBecomesNil]'") - public func int(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.Int? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Int.init) - } - - @available(*, deprecated, message="Use 'string(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func string(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.String? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.String.init) - } - - @available(*, deprecated, message="Use 'string(_:alongPath:)' with options '[.NullBecomesNil]'") - public func string(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.String? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.String.init) - } - - @available(*, deprecated, message="Use 'bool(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func bool(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> Swift.Bool? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Bool.init) - } - - @available(*, deprecated, message="Use 'bool(_:alongPath:)' with options '[.NullBecomesNil]'") - public func bool(path: JSONPathType..., ifNull: Swift.Bool) throws -> Swift.Bool? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: Swift.Bool.init) - } - - @available(*, deprecated, message="Use 'array(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func array(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> [JSON]? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArray) - } - - @available(*, deprecated, message="Use 'array(_:alongPath:)' with options '[.NullBecomesNil]'") - public func array(path: JSONPathType..., ifNull: Swift.Bool) throws -> [JSON]? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArray) - } - - @available(*, deprecated, message="Use 'arrayOf(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func arrayOf(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> [Decoded]? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArrayOf) - } - - @available(*, deprecated, message="Use 'arrayOf(_:alongPath:)' with options '[.NullBecomesNil]'") - public func arrayOf(path: JSONPathType..., ifNull: Swift.Bool) throws -> [Decoded]? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getArrayOf) - } - - @available(*, deprecated, message="Use 'dictionary(_:alongPath:)' with options '[.MissingKeyBecomesNil]'") - public func dictionary(path: JSONPathType..., ifNotFound: Swift.Bool) throws -> [Swift.String: JSON]? { - let options: SubscriptingOptions = ifNotFound ? [.MissingKeyBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionary) - } - - @available(*, deprecated, message="Use 'dictionary(_:alongPath:)' with options '[.NullBecomesNil]'") - public func dictionary(path: JSONPathType..., ifNull: Swift.Bool) throws -> [Swift.String: JSON]? { - let options: SubscriptingOptions = ifNull ? [.NullBecomesNil] : [] - return try mapOptionalAtPath(path, alongPath: options, transform: JSON.getDictionary) - } - -} diff --git a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/main.swift b/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/main.swift deleted file mode 100644 index f34af41af..000000000 --- a/tests/JSONTestSuite/parsers/test_Freddy_2_1_0/test_Freddy/main.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// main.swift -// test_Freddy -// -// Created by nst on 10/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard Process.arguments.count == 2 else { - let url = NSURL(fileURLWithPath: Process.arguments[0]) - guard let programName = url.lastPathComponent else { exit(1) } - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = Process.arguments[1] - let url = NSURL.fileURLWithPath(path) - - guard let data = NSData(contentsOfURL:url) else { - print("*** CANNOT READ DATA AT \(url)") - return - } - - var p = JSONParser(utf8Data: data) - do { - try p.parse() - exit(0) - } catch { - exit(1) - } -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/JSONKit.h b/tests/JSONTestSuite/parsers/test_JSONKit/JSONKit.h deleted file mode 100644 index 71bd0c3b7..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/JSONKit.h +++ /dev/null @@ -1,251 +0,0 @@ -// -// JSONKit.h -// http://github.com/johnezang/JSONKit -// Dual licensed under either the terms of the BSD License, or alternatively -// under the terms of the Apache License, Version 2.0, as specified below. -// - -/* - Copyright (c) 2011, John Engelhart - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the Zang Industries nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - Copyright 2011 John Engelhart - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#ifdef __OBJC__ -#import -#import -#import -#import -#import -#import -#endif // __OBJC__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// For Mac OS X < 10.5. -#ifndef NSINTEGER_DEFINED -#define NSINTEGER_DEFINED -#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef long NSInteger; -typedef unsigned long NSUInteger; -#define NSIntegerMin LONG_MIN -#define NSIntegerMax LONG_MAX -#define NSUIntegerMax ULONG_MAX -#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef int NSInteger; -typedef unsigned int NSUInteger; -#define NSIntegerMin INT_MIN -#define NSIntegerMax INT_MAX -#define NSUIntegerMax UINT_MAX -#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -#endif // NSINTEGER_DEFINED - - -#ifndef _JSONKIT_H_ -#define _JSONKIT_H_ - -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465) -#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) -#else -#define JK_DEPRECATED_ATTRIBUTE -#endif - -#define JSONKIT_VERSION_MAJOR 1 -#define JSONKIT_VERSION_MINOR 4 - -typedef NSUInteger JKFlags; - -/* - JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON. - JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines. - JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode. - This option allows JSON with malformed Unicode to be parsed without reporting an error. - Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER". - */ - -enum { - JKParseOptionNone = 0, - JKParseOptionStrict = 0, - JKParseOptionComments = (1 << 0), - JKParseOptionUnicodeNewlines = (1 << 1), - JKParseOptionLooseUnicode = (1 << 2), - JKParseOptionPermitTextAfterValidJSON = (1 << 3), - JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON), -}; -typedef JKFlags JKParseOptionFlags; - -enum { - JKSerializeOptionNone = 0, - JKSerializeOptionPretty = (1 << 0), - JKSerializeOptionEscapeUnicode = (1 << 1), - JKSerializeOptionEscapeForwardSlashes = (1 << 4), - JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes), -}; -typedef JKFlags JKSerializeOptionFlags; - -#ifdef __OBJC__ - -typedef struct JKParseState JKParseState; // Opaque internal, private type. - -// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict - -@interface JSONDecoder : NSObject { - JKParseState *parseState; -} -+ (id)decoder; -+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (void)clearCache; - -// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead. -// The NSData MUST be UTF8 encoded JSON. -- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead. -- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead. - -// Methods that return immutable collection objects. -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length; -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error; -// The NSData MUST be UTF8 encoded JSON. -- (id)objectWithData:(NSData *)jsonData; -- (id)objectWithData:(NSData *)jsonData error:(NSError **)error; - -// Methods that return mutable collection objects. -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length; -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error; -// The NSData MUST be UTF8 encoded JSON. -- (id)mutableObjectWithData:(NSData *)jsonData; -- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error; - -@end - -//////////// -#pragma mark Deserializing methods -//////////// - -@interface NSString (JSONKitDeserializing) -- (id)objectFromJSONString; -- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -- (id)mutableObjectFromJSONString; -- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -@end - -@interface NSData (JSONKitDeserializing) -// The NSData MUST be UTF8 encoded JSON. -- (id)objectFromJSONData; -- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -- (id)mutableObjectFromJSONData; -- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -@end - -//////////// -#pragma mark Serializing methods -//////////// - -@interface NSString (JSONKitSerializing) -// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString). -// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes: -// includeQuotes:YES `a "test"...` -> `"a \"test\"..."` -// includeQuotes:NO `a "test"...` -> `a \"test\"...` -- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; -- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; -@end - -@interface NSArray (JSONKitSerializing) -- (NSData *)JSONData; -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (NSString *)JSONString; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -@end - -@interface NSDictionary (JSONKitSerializing) -- (NSData *)JSONData; -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (NSString *)JSONString; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -@end - -#ifdef __BLOCKS__ - -@interface NSArray (JSONKitSerializingBlockAdditions) -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -@end - -@interface NSDictionary (JSONKitSerializingBlockAdditions) -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -@end - -#endif - - -#endif // __OBJC__ - -#endif // _JSONKIT_H_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/JSONKit.m b/tests/JSONTestSuite/parsers/test_JSONKit/JSONKit.m deleted file mode 100644 index 4994caf97..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/JSONKit.m +++ /dev/null @@ -1,3065 +0,0 @@ -// -// JSONKit.m -// http://github.com/johnezang/JSONKit -// Dual licensed under either the terms of the BSD License, or alternatively -// under the terms of the Apache License, Version 2.0, as specified below. -// - -/* - Copyright (c) 2011, John Engelhart - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the Zang Industries nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - Copyright 2011 John Engelhart - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - - -/* - Acknowledgments: - - The bulk of the UTF8 / UTF32 conversion and verification comes - from ConvertUTF.[hc]. It has been modified from the original sources. - - The original sources were obtained from http://www.unicode.org/. - However, the web site no longer seems to host the files. Instead, - the Unicode FAQ http://www.unicode.org/faq//utf_bom.html#gen4 - points to International Components for Unicode (ICU) - http://site.icu-project.org/ as an example of how to write a UTF - converter. - - The decision to use the ConvertUTF.[ch] code was made to leverage - "proven" code. Hopefully the local modifications are bug free. - - The code in isValidCodePoint() is derived from the ICU code in - utf.h for the macros U_IS_UNICODE_NONCHAR and U_IS_UNICODE_CHAR. - - From the original ConvertUTF.[ch]: - - * Copyright 2001-2004 Unicode, Inc. - * - * Disclaimer - * - * This source code is provided as is by Unicode, Inc. No claims are - * made as to fitness for any particular purpose. No warranties of any - * kind are expressed or implied. The recipient agrees to determine - * applicability of information provided. If this file has been - * purchased on magnetic or optical media from Unicode, Inc., the - * sole remedy for any claim will be exchange of defective media - * within 90 days of receipt. - * - * Limitations on Rights to Redistribute This Code - * - * Unicode, Inc. hereby grants the right to freely use the information - * supplied in this file in the creation of products supporting the - * Unicode Standard, and to make copies of this file in any form - * for internal or external distribution as long as this notice - * remains attached. - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#import "JSONKit.h" - -//#include -#include -#include -#include -#include - -//#import -#import -#import -#import -#import -#import -#import -#import - -#ifndef __has_feature -#define __has_feature(x) 0 -#endif - -#ifdef JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS -#warning As of JSONKit v1.4, JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS is no longer required. It is no longer a valid option. -#endif - -#ifdef __OBJC_GC__ -#error JSONKit does not support Objective-C Garbage Collection -#endif - -#if __has_feature(objc_arc) -#error JSONKit does not support Objective-C Automatic Reference Counting (ARC) -#endif - -// The following checks are really nothing more than sanity checks. -// JSONKit technically has a few problems from a "strictly C99 conforming" standpoint, though they are of the pedantic nitpicking variety. -// In practice, though, for the compilers and architectures we can reasonably expect this code to be compiled for, these pedantic nitpicks aren't really a problem. -// Since we're limited as to what we can do with pre-processor #if checks, these checks are not nearly as through as they should be. - -#if (UINT_MAX != 0xffffffffU) || (INT_MIN != (-0x7fffffff-1)) || (ULLONG_MAX != 0xffffffffffffffffULL) || (LLONG_MIN != (-0x7fffffffffffffffLL-1LL)) -#error JSONKit requires the C 'int' and 'long long' types to be 32 and 64 bits respectively. -#endif - -#if !defined(__LP64__) && ((UINT_MAX != ULONG_MAX) || (INT_MAX != LONG_MAX) || (INT_MIN != LONG_MIN) || (WORD_BIT != LONG_BIT)) -#error JSONKit requires the C 'int' and 'long' types to be the same on 32-bit architectures. -#endif - -// Cocoa / Foundation uses NS*Integer as the type for a lot of arguments. We make sure that NS*Integer is something we are expecting and is reasonably compatible with size_t / ssize_t - -#if (NSUIntegerMax != ULONG_MAX) || (NSIntegerMax != LONG_MAX) || (NSIntegerMin != LONG_MIN) -#error JSONKit requires NSInteger and NSUInteger to be the same size as the C 'long' type. -#endif - -#if (NSUIntegerMax != SIZE_MAX) || (NSIntegerMax != SSIZE_MAX) -#error JSONKit requires NSInteger and NSUInteger to be the same size as the C 'size_t' type. -#endif - - -// For DJB hash. -#define JK_HASH_INIT (1402737925UL) - -// Use __builtin_clz() instead of trailingBytesForUTF8[] table lookup. -#define JK_FAST_TRAILING_BYTES - -// JK_CACHE_SLOTS must be a power of 2. Default size is 1024 slots. -#define JK_CACHE_SLOTS_BITS (10) -#define JK_CACHE_SLOTS (1UL << JK_CACHE_SLOTS_BITS) -// JK_CACHE_PROBES is the number of probe attempts. -#define JK_CACHE_PROBES (4UL) -// JK_INIT_CACHE_AGE must be < (1 << AGE) - 1, where AGE is sizeof(typeof(AGE)) * 8. -#define JK_INIT_CACHE_AGE (0) - -// JK_TOKENBUFFER_SIZE is the default stack size for the temporary buffer used to hold "non-simple" strings (i.e., contains \ escapes) -#define JK_TOKENBUFFER_SIZE (1024UL * 2UL) - -// JK_STACK_OBJS is the default number of spaces reserved on the stack for temporarily storing pointers to Obj-C objects before they can be transferred to a NSArray / NSDictionary. -#define JK_STACK_OBJS (1024UL * 1UL) - -#define JK_JSONBUFFER_SIZE (1024UL * 4UL) -#define JK_UTF8BUFFER_SIZE (1024UL * 16UL) - -#define JK_ENCODE_CACHE_SLOTS (1024UL) - - -#if defined (__GNUC__) && (__GNUC__ >= 4) -#define JK_ATTRIBUTES(attr, ...) __attribute__((attr, ##__VA_ARGS__)) -#define JK_EXPECTED(cond, expect) __builtin_expect((long)(cond), (expect)) -#define JK_EXPECT_T(cond) JK_EXPECTED(cond, 1U) -#define JK_EXPECT_F(cond) JK_EXPECTED(cond, 0U) -#define JK_PREFETCH(ptr) __builtin_prefetch(ptr) -#else // defined (__GNUC__) && (__GNUC__ >= 4) -#define JK_ATTRIBUTES(attr, ...) -#define JK_EXPECTED(cond, expect) (cond) -#define JK_EXPECT_T(cond) (cond) -#define JK_EXPECT_F(cond) (cond) -#define JK_PREFETCH(ptr) -#endif // defined (__GNUC__) && (__GNUC__ >= 4) - -#define JK_STATIC_INLINE static __inline__ JK_ATTRIBUTES(always_inline) -#define JK_ALIGNED(arg) JK_ATTRIBUTES(aligned(arg)) -#define JK_UNUSED_ARG JK_ATTRIBUTES(unused) -#define JK_WARN_UNUSED JK_ATTRIBUTES(warn_unused_result) -#define JK_WARN_UNUSED_CONST JK_ATTRIBUTES(warn_unused_result, const) -#define JK_WARN_UNUSED_PURE JK_ATTRIBUTES(warn_unused_result, pure) -#define JK_WARN_UNUSED_SENTINEL JK_ATTRIBUTES(warn_unused_result, sentinel) -#define JK_NONNULL_ARGS(arg, ...) JK_ATTRIBUTES(nonnull(arg, ##__VA_ARGS__)) -#define JK_WARN_UNUSED_NONNULL_ARGS(arg, ...) JK_ATTRIBUTES(warn_unused_result, nonnull(arg, ##__VA_ARGS__)) -#define JK_WARN_UNUSED_CONST_NONNULL_ARGS(arg, ...) JK_ATTRIBUTES(warn_unused_result, const, nonnull(arg, ##__VA_ARGS__)) -#define JK_WARN_UNUSED_PURE_NONNULL_ARGS(arg, ...) JK_ATTRIBUTES(warn_unused_result, pure, nonnull(arg, ##__VA_ARGS__)) - -#if defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) -#define JK_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) JK_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__), alloc_size(as)) -#else // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) -#define JK_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) JK_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__)) -#endif // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) - - -@class JKArray, JKDictionaryEnumerator, JKDictionary; - -enum { - JSONNumberStateStart = 0, - JSONNumberStateFinished = 1, - JSONNumberStateError = 2, - JSONNumberStateWholeNumberStart = 3, - JSONNumberStateWholeNumberMinus = 4, - JSONNumberStateWholeNumberZero = 5, - JSONNumberStateWholeNumber = 6, - JSONNumberStatePeriod = 7, - JSONNumberStateFractionalNumberStart = 8, - JSONNumberStateFractionalNumber = 9, - JSONNumberStateExponentStart = 10, - JSONNumberStateExponentPlusMinus = 11, - JSONNumberStateExponent = 12, -}; - -enum { - JSONStringStateStart = 0, - JSONStringStateParsing = 1, - JSONStringStateFinished = 2, - JSONStringStateError = 3, - JSONStringStateEscape = 4, - JSONStringStateEscapedUnicode1 = 5, - JSONStringStateEscapedUnicode2 = 6, - JSONStringStateEscapedUnicode3 = 7, - JSONStringStateEscapedUnicode4 = 8, - JSONStringStateEscapedUnicodeSurrogate1 = 9, - JSONStringStateEscapedUnicodeSurrogate2 = 10, - JSONStringStateEscapedUnicodeSurrogate3 = 11, - JSONStringStateEscapedUnicodeSurrogate4 = 12, - JSONStringStateEscapedNeedEscapeForSurrogate = 13, - JSONStringStateEscapedNeedEscapedUForSurrogate = 14, -}; - -enum { - JKParseAcceptValue = (1 << 0), - JKParseAcceptComma = (1 << 1), - JKParseAcceptEnd = (1 << 2), - JKParseAcceptValueOrEnd = (JKParseAcceptValue | JKParseAcceptEnd), - JKParseAcceptCommaOrEnd = (JKParseAcceptComma | JKParseAcceptEnd), -}; - -enum { - JKClassUnknown = 0, - JKClassString = 1, - JKClassNumber = 2, - JKClassArray = 3, - JKClassDictionary = 4, - JKClassNull = 5, -}; - -enum { - JKManagedBufferOnStack = 1, - JKManagedBufferOnHeap = 2, - JKManagedBufferLocationMask = (0x3), - JKManagedBufferLocationShift = (0), - - JKManagedBufferMustFree = (1 << 2), -}; -typedef JKFlags JKManagedBufferFlags; - -enum { - JKObjectStackOnStack = 1, - JKObjectStackOnHeap = 2, - JKObjectStackLocationMask = (0x3), - JKObjectStackLocationShift = (0), - - JKObjectStackMustFree = (1 << 2), -}; -typedef JKFlags JKObjectStackFlags; - -enum { - JKTokenTypeInvalid = 0, - JKTokenTypeNumber = 1, - JKTokenTypeString = 2, - JKTokenTypeObjectBegin = 3, - JKTokenTypeObjectEnd = 4, - JKTokenTypeArrayBegin = 5, - JKTokenTypeArrayEnd = 6, - JKTokenTypeSeparator = 7, - JKTokenTypeComma = 8, - JKTokenTypeTrue = 9, - JKTokenTypeFalse = 10, - JKTokenTypeNull = 11, - JKTokenTypeWhiteSpace = 12, -}; -typedef NSUInteger JKTokenType; - -// These are prime numbers to assist with hash slot probing. -enum { - JKValueTypeNone = 0, - JKValueTypeString = 5, - JKValueTypeLongLong = 7, - JKValueTypeUnsignedLongLong = 11, - JKValueTypeDouble = 13, -}; -typedef NSUInteger JKValueType; - -enum { - JKEncodeOptionAsData = 1, - JKEncodeOptionAsString = 2, - JKEncodeOptionAsTypeMask = 0x7, - JKEncodeOptionCollectionObj = (1 << 3), - JKEncodeOptionStringObj = (1 << 4), - JKEncodeOptionStringObjTrimQuotes = (1 << 5), - -}; -typedef NSUInteger JKEncodeOptionType; - -typedef NSUInteger JKHash; - -typedef struct JKTokenCacheItem JKTokenCacheItem; -typedef struct JKTokenCache JKTokenCache; -typedef struct JKTokenValue JKTokenValue; -typedef struct JKParseToken JKParseToken; -typedef struct JKPtrRange JKPtrRange; -typedef struct JKObjectStack JKObjectStack; -typedef struct JKBuffer JKBuffer; -typedef struct JKConstBuffer JKConstBuffer; -typedef struct JKConstPtrRange JKConstPtrRange; -typedef struct JKRange JKRange; -typedef struct JKManagedBuffer JKManagedBuffer; -typedef struct JKFastClassLookup JKFastClassLookup; -typedef struct JKEncodeCache JKEncodeCache; -typedef struct JKEncodeState JKEncodeState; -typedef struct JKObjCImpCache JKObjCImpCache; -typedef struct JKHashTableEntry JKHashTableEntry; - -typedef id (*NSNumberAllocImp)(id receiver, SEL selector); -typedef id (*NSNumberInitWithUnsignedLongLongImp)(id receiver, SEL selector, unsigned long long value); -typedef id (*JKClassFormatterIMP)(id receiver, SEL selector, id object); -#ifdef __BLOCKS__ -typedef id (^JKClassFormatterBlock)(id formatObject); -#endif - - -struct JKPtrRange { - unsigned char *ptr; - size_t length; -}; - -struct JKConstPtrRange { - const unsigned char *ptr; - size_t length; -}; - -struct JKRange { - size_t location, length; -}; - -struct JKManagedBuffer { - JKPtrRange bytes; - JKManagedBufferFlags flags; - size_t roundSizeUpToMultipleOf; -}; - -struct JKObjectStack { - void **objects, **keys; - CFHashCode *cfHashes; - size_t count, index, roundSizeUpToMultipleOf; - JKObjectStackFlags flags; -}; - -struct JKBuffer { - JKPtrRange bytes; -}; - -struct JKConstBuffer { - JKConstPtrRange bytes; -}; - -struct JKTokenValue { - JKConstPtrRange ptrRange; - JKValueType type; - JKHash hash; - union { - long long longLongValue; - unsigned long long unsignedLongLongValue; - double doubleValue; - } number; - JKTokenCacheItem *cacheItem; -}; - -struct JKParseToken { - JKConstPtrRange tokenPtrRange; - JKTokenType type; - JKTokenValue value; - JKManagedBuffer tokenBuffer; -}; - -struct JKTokenCacheItem { - void *object; - JKHash hash; - CFHashCode cfHash; - size_t size; - unsigned char *bytes; - JKValueType type; -}; - -struct JKTokenCache { - JKTokenCacheItem *items; - size_t count; - unsigned int prng_lfsr; - unsigned char age[JK_CACHE_SLOTS]; -}; - -struct JKObjCImpCache { - Class NSNumberClass; - NSNumberAllocImp NSNumberAlloc; - NSNumberInitWithUnsignedLongLongImp NSNumberInitWithUnsignedLongLong; -}; - -struct JKParseState { - JKParseOptionFlags parseOptionFlags; - JKConstBuffer stringBuffer; - size_t atIndex, lineNumber, lineStartIndex; - size_t prev_atIndex, prev_lineNumber, prev_lineStartIndex; - JKParseToken token; - JKObjectStack objectStack; - JKTokenCache cache; - JKObjCImpCache objCImpCache; - NSError *error; - int errorIsPrev; - BOOL mutableCollections; -}; - -struct JKFastClassLookup { - void *stringClass; - void *numberClass; - void *arrayClass; - void *dictionaryClass; - void *nullClass; -}; - -struct JKEncodeCache { - id object; - size_t offset; - size_t length; -}; - -struct JKEncodeState { - JKManagedBuffer utf8ConversionBuffer; - JKManagedBuffer stringBuffer; - size_t atIndex; - JKFastClassLookup fastClassLookup; - JKEncodeCache cache[JK_ENCODE_CACHE_SLOTS]; - JKSerializeOptionFlags serializeOptionFlags; - JKEncodeOptionType encodeOption; - size_t depth; - NSError *error; - id classFormatterDelegate; - SEL classFormatterSelector; - JKClassFormatterIMP classFormatterIMP; -#ifdef __BLOCKS__ - JKClassFormatterBlock classFormatterBlock; -#endif -}; - -// This is a JSONKit private class. -@interface JKSerializer : NSObject { - JKEncodeState *encodeState; -} - -#ifdef __BLOCKS__ -#define JKSERIALIZER_BLOCKS_PROTO id(^)(id object) -#else -#define JKSERIALIZER_BLOCKS_PROTO id -#endif - -+ (id)serializeObject:(id)object options:(JKSerializeOptionFlags)optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (id)serializeObject:(id)object options:(JKSerializeOptionFlags)optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (void)releaseState; - -@end - -struct JKHashTableEntry { - NSUInteger keyHash; - id key, object; -}; - - -typedef uint32_t UTF32; /* at least 32 bits */ -typedef uint16_t UTF16; /* at least 16 bits */ -typedef uint8_t UTF8; /* typically 8 bits */ - -typedef enum { - conversionOK, /* conversion successful */ - sourceExhausted, /* partial character in source, but hit end */ - targetExhausted, /* insuff. room in target for conversion */ - sourceIllegal /* source sequence is illegal/malformed */ -} ConversionResult; - -#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD -#define UNI_MAX_BMP (UTF32)0x0000FFFF -#define UNI_MAX_UTF16 (UTF32)0x0010FFFF -#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF -#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF -#define UNI_SUR_HIGH_START (UTF32)0xD800 -#define UNI_SUR_HIGH_END (UTF32)0xDBFF -#define UNI_SUR_LOW_START (UTF32)0xDC00 -#define UNI_SUR_LOW_END (UTF32)0xDFFF - - -#if !defined(JK_FAST_TRAILING_BYTES) -static const char trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; -#endif - -static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; -static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - -#define JK_AT_STRING_PTR(x) (&((x)->stringBuffer.bytes.ptr[(x)->atIndex])) -#define JK_END_STRING_PTR(x) (&((x)->stringBuffer.bytes.ptr[(x)->stringBuffer.bytes.length])) - - -static JKArray *_JKArrayCreate(id *objects, NSUInteger count, BOOL mutableCollection); -static void _JKArrayInsertObjectAtIndex(JKArray *array, id newObject, NSUInteger objectIndex); -static void _JKArrayReplaceObjectAtIndexWithObject(JKArray *array, NSUInteger objectIndex, id newObject); -static void _JKArrayRemoveObjectAtIndex(JKArray *array, NSUInteger objectIndex); - - -static NSUInteger _JKDictionaryCapacityForCount(NSUInteger count); -static JKDictionary *_JKDictionaryCreate(id *keys, NSUInteger *keyHashes, id *objects, NSUInteger count, BOOL mutableCollection); -static JKHashTableEntry *_JKDictionaryHashEntry(JKDictionary *dictionary); -static NSUInteger _JKDictionaryCapacity(JKDictionary *dictionary); -static void _JKDictionaryResizeIfNeccessary(JKDictionary *dictionary); -static void _JKDictionaryRemoveObjectWithEntry(JKDictionary *dictionary, JKHashTableEntry *entry); -static void _JKDictionaryAddObject(JKDictionary *dictionary, NSUInteger keyHash, id key, id object); -static JKHashTableEntry *_JKDictionaryHashTableEntryForKey(JKDictionary *dictionary, id aKey); - - -static void _JSONDecoderCleanup(JSONDecoder *decoder); - -static id _NSStringObjectFromJSONString(NSString *jsonString, JKParseOptionFlags parseOptionFlags, NSError **error, BOOL mutableCollection); - - -static void jk_managedBuffer_release(JKManagedBuffer *managedBuffer); -static void jk_managedBuffer_setToStackBuffer(JKManagedBuffer *managedBuffer, unsigned char *ptr, size_t length); -static unsigned char *jk_managedBuffer_resize(JKManagedBuffer *managedBuffer, size_t newSize); -static void jk_objectStack_release(JKObjectStack *objectStack); -static void jk_objectStack_setToStackBuffer(JKObjectStack *objectStack, void **objects, void **keys, CFHashCode *cfHashes, size_t count); -static int jk_objectStack_resize(JKObjectStack *objectStack, size_t newCount); - -static void jk_error(JKParseState *parseState, NSString *format, ...); -static int jk_parse_string(JKParseState *parseState); -static int jk_parse_number(JKParseState *parseState); -static size_t jk_parse_is_newline(JKParseState *parseState, const unsigned char *atCharacterPtr); -JK_STATIC_INLINE int jk_parse_skip_newline(JKParseState *parseState); -JK_STATIC_INLINE void jk_parse_skip_whitespace(JKParseState *parseState); -static int jk_parse_next_token(JKParseState *parseState); -static void jk_error_parse_accept_or3(JKParseState *parseState, int state, NSString *or1String, NSString *or2String, NSString *or3String); -static void *jk_create_dictionary(JKParseState *parseState, size_t startingObjectIndex); -static void *jk_parse_dictionary(JKParseState *parseState); -static void *jk_parse_array(JKParseState *parseState); -static void *jk_object_for_token(JKParseState *parseState); -static void *jk_cachedObjects(JKParseState *parseState); -JK_STATIC_INLINE void jk_cache_age(JKParseState *parseState); -JK_STATIC_INLINE void jk_set_parsed_token(JKParseState *parseState, const unsigned char *ptr, size_t length, JKTokenType type, size_t advanceBy); - - -static void jk_encode_error(JKEncodeState *encodeState, NSString *format, ...); -static int jk_encode_printf(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, ...); -static int jk_encode_write(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format); -static int jk_encode_writePrettyPrintWhiteSpace(JKEncodeState *encodeState); -static int jk_encode_write1slow(JKEncodeState *encodeState, ssize_t depthChange, const char *format); -static int jk_encode_write1fast(JKEncodeState *encodeState, ssize_t depthChange JK_UNUSED_ARG, const char *format); -static int jk_encode_writen(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, size_t length); -JK_STATIC_INLINE JKHash jk_encode_object_hash(void *objectPtr); -JK_STATIC_INLINE void jk_encode_updateCache(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object); -static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *objectPtr); - -#define jk_encode_write1(es, dc, f) (JK_EXPECT_F(_jk_encode_prettyPrint) ? jk_encode_write1slow(es, dc, f) : jk_encode_write1fast(es, dc, f)) - - -JK_STATIC_INLINE size_t jk_min(size_t a, size_t b); -JK_STATIC_INLINE size_t jk_max(size_t a, size_t b); -JK_STATIC_INLINE JKHash jk_calculateHash(JKHash currentHash, unsigned char c); - -// JSONKit v1.4 used both a JKArray : NSArray and JKMutableArray : NSMutableArray, and the same for the dictionary collection type. -// However, Louis Gerbarg (via cocoa-dev) pointed out that Cocoa / Core Foundation actually implements only a single class that inherits from the -// mutable version, and keeps an ivar bit for whether or not that instance is mutable. This means that the immutable versions of the collection -// classes receive the mutating methods, but this is handled by having those methods throw an exception when the ivar bit is set to immutable. -// We adopt the same strategy here. It's both cleaner and gets rid of the method swizzling hackery used in JSONKit v1.4. - - -// This is a workaround for issue #23 https://github.com/johnezang/JSONKit/pull/23 -// Basically, there seem to be a problem with using +load in static libraries on iOS. However, __attribute__ ((constructor)) does work correctly. -// Since we do not require anything "special" that +load provides, and we can accomplish the same thing using __attribute__ ((constructor)), the +load logic was moved here. - -static Class _JKArrayClass = NULL; -static size_t _JKArrayInstanceSize = 0UL; -static Class _JKDictionaryClass = NULL; -static size_t _JKDictionaryInstanceSize = 0UL; - -// For JSONDecoder... -static Class _jk_NSNumberClass = NULL; -static NSNumberAllocImp _jk_NSNumberAllocImp = NULL; -static NSNumberInitWithUnsignedLongLongImp _jk_NSNumberInitWithUnsignedLongLongImp = NULL; - -extern void jk_collectionClassLoadTimeInitialization(void) __attribute__ ((constructor)); - -void jk_collectionClassLoadTimeInitialization(void) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Though technically not required, the run time environment at load time initialization may be less than ideal. - - _JKArrayClass = objc_getClass("JKArray"); - _JKArrayInstanceSize = jk_max(16UL, class_getInstanceSize(_JKArrayClass)); - - _JKDictionaryClass = objc_getClass("JKDictionary"); - _JKDictionaryInstanceSize = jk_max(16UL, class_getInstanceSize(_JKDictionaryClass)); - - // For JSONDecoder... - _jk_NSNumberClass = [NSNumber class]; - _jk_NSNumberAllocImp = (NSNumberAllocImp)[NSNumber methodForSelector:@selector(alloc)]; - - // Hacktacular. Need to do it this way due to the nature of class clusters. - id temp_NSNumber = [NSNumber alloc]; - _jk_NSNumberInitWithUnsignedLongLongImp = (NSNumberInitWithUnsignedLongLongImp)[temp_NSNumber methodForSelector:@selector(initWithUnsignedLongLong:)]; - [[temp_NSNumber init] release]; - temp_NSNumber = NULL; - - [pool release]; pool = NULL; -} - - -#pragma mark - -@interface JKArray : NSMutableArray { - id *objects; - NSUInteger count, capacity, mutations; -} -@end - -@implementation JKArray - -+ (id)allocWithZone:(NSZone *)zone -{ -#pragma unused(zone) - [NSException raise:NSInvalidArgumentException format:@"*** - [%@ %@]: The %@ class is private to JSONKit and should not be used in this fashion.", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSStringFromClass([self class])]; - return(NULL); -} - -static JKArray *_JKArrayCreate(id *objects, NSUInteger count, BOOL mutableCollection) { - NSCParameterAssert((objects != NULL) && (_JKArrayClass != NULL) && (_JKArrayInstanceSize > 0UL)); - JKArray *array = NULL; - if(JK_EXPECT_T((array = (JKArray *)calloc(1UL, _JKArrayInstanceSize)) != NULL)) { // Directly allocate the JKArray instance via calloc. - object_setClass(array, _JKArrayClass); - if((array = [array init]) == NULL) { return(NULL); } - array->capacity = count; - array->count = count; - if(JK_EXPECT_F((array->objects = (id *)malloc(sizeof(id) * array->capacity)) == NULL)) { [array autorelease]; return(NULL); } - memcpy(array->objects, objects, array->capacity * sizeof(id)); - array->mutations = (mutableCollection == NO) ? 0UL : 1UL; - } - return(array); -} - -// Note: The caller is responsible for -retaining the object that is to be added. -static void _JKArrayInsertObjectAtIndex(JKArray *array, id newObject, NSUInteger objectIndex) { - NSCParameterAssert((array != NULL) && (array->objects != NULL) && (array->count <= array->capacity) && (objectIndex <= array->count) && (newObject != NULL)); - if(!((array != NULL) && (array->objects != NULL) && (objectIndex <= array->count) && (newObject != NULL))) { [newObject autorelease]; return; } - if((array->count + 1UL) >= array->capacity) { - id *newObjects = NULL; - if((newObjects = (id *)realloc(array->objects, sizeof(id) * (array->capacity + 16UL))) == NULL) { [NSException raise:NSMallocException format:@"Unable to resize objects array."]; } - array->objects = newObjects; - array->capacity += 16UL; - memset(&array->objects[array->count], 0, sizeof(id) * (array->capacity - array->count)); - } - array->count++; - if((objectIndex + 1UL) < array->count) { memmove(&array->objects[objectIndex + 1UL], &array->objects[objectIndex], sizeof(id) * ((array->count - 1UL) - objectIndex)); array->objects[objectIndex] = NULL; } - array->objects[objectIndex] = newObject; -} - -// Note: The caller is responsible for -retaining the object that is to be added. -static void _JKArrayReplaceObjectAtIndexWithObject(JKArray *array, NSUInteger objectIndex, id newObject) { - NSCParameterAssert((array != NULL) && (array->objects != NULL) && (array->count <= array->capacity) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL) && (newObject != NULL)); - if(!((array != NULL) && (array->objects != NULL) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL) && (newObject != NULL))) { [newObject autorelease]; return; } - CFRelease(array->objects[objectIndex]); - array->objects[objectIndex] = NULL; - array->objects[objectIndex] = newObject; -} - -static void _JKArrayRemoveObjectAtIndex(JKArray *array, NSUInteger objectIndex) { - NSCParameterAssert((array != NULL) && (array->objects != NULL) && (array->count > 0UL) && (array->count <= array->capacity) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL)); - if(!((array != NULL) && (array->objects != NULL) && (array->count > 0UL) && (array->count <= array->capacity) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL))) { return; } - CFRelease(array->objects[objectIndex]); - array->objects[objectIndex] = NULL; - if((objectIndex + 1UL) < array->count) { memmove(&array->objects[objectIndex], &array->objects[objectIndex + 1UL], sizeof(id) * ((array->count - 1UL) - objectIndex)); array->objects[array->count - 1UL] = NULL; } - array->count--; -} - -- (void)dealloc -{ - if(JK_EXPECT_T(objects != NULL)) { - NSUInteger atObject = 0UL; - for(atObject = 0UL; atObject < count; atObject++) { if(JK_EXPECT_T(objects[atObject] != NULL)) { CFRelease(objects[atObject]); objects[atObject] = NULL; } } - free(objects); objects = NULL; - } - - [super dealloc]; -} - -- (NSUInteger)count -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - return(count); -} - -- (void)getObjects:(id *)objectsPtr range:(NSRange)range -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - if((objectsPtr == NULL) && (NSMaxRange(range) > 0UL)) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: pointer to objects array is NULL but range length is %lu", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)NSMaxRange(range)]; } - if((range.location > count) || (NSMaxRange(range) > count)) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)NSMaxRange(range), (unsigned long)count]; } -#ifndef __clang_analyzer__ - memcpy(objectsPtr, objects + range.location, range.length * sizeof(id)); -#endif -} - -- (id)objectAtIndex:(NSUInteger)objectIndex -{ - if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)count]; } - NSParameterAssert((objects != NULL) && (count <= capacity) && (objects[objectIndex] != NULL)); - return(objects[objectIndex]); -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len -{ - NSParameterAssert((state != NULL) && (stackbuf != NULL) && (len > 0UL) && (objects != NULL) && (count <= capacity)); - if(JK_EXPECT_F(state->state == 0UL)) { state->mutationsPtr = (unsigned long *)&mutations; state->itemsPtr = stackbuf; } - if(JK_EXPECT_F(state->state >= count)) { return(0UL); } - - NSUInteger enumeratedCount = 0UL; - while(JK_EXPECT_T(enumeratedCount < len) && JK_EXPECT_T(state->state < count)) { NSParameterAssert(objects[state->state] != NULL); stackbuf[enumeratedCount++] = objects[state->state++]; } - - return(enumeratedCount); -} - -- (void)insertObject:(id)anObject atIndex:(NSUInteger)objectIndex -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(objectIndex > count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)(count + 1UL)]; } -#ifdef __clang_analyzer__ - [anObject retain]; // Stupid clang analyzer... Issue #19. -#else - anObject = [anObject retain]; -#endif - _JKArrayInsertObjectAtIndex(self, anObject, objectIndex); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (void)removeObjectAtIndex:(NSUInteger)objectIndex -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)count]; } - _JKArrayRemoveObjectAtIndex(self, objectIndex); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (void)replaceObjectAtIndex:(NSUInteger)objectIndex withObject:(id)anObject -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)count]; } -#ifdef __clang_analyzer__ - [anObject retain]; // Stupid clang analyzer... Issue #19. -#else - anObject = [anObject retain]; -#endif - _JKArrayReplaceObjectAtIndexWithObject(self, objectIndex, anObject); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (id)copyWithZone:(NSZone *)zone -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - return((mutations == 0UL) ? [self retain] : [(NSArray *)[NSArray allocWithZone:zone] initWithObjects:objects count:count]); -} - -- (id)mutableCopyWithZone:(NSZone *)zone -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - return([(NSMutableArray *)[NSMutableArray allocWithZone:zone] initWithObjects:objects count:count]); -} - -@end - - -#pragma mark - -@interface JKDictionaryEnumerator : NSEnumerator { - id collection; - NSUInteger nextObject; -} - -- (id)initWithJKDictionary:(JKDictionary *)initDictionary; -- (NSArray *)allObjects; -- (id)nextObject; - -@end - -@implementation JKDictionaryEnumerator - -- (id)initWithJKDictionary:(JKDictionary *)initDictionary -{ - NSParameterAssert(initDictionary != NULL); - if((self = [super init]) == NULL) { return(NULL); } - if((collection = (id)CFRetain(initDictionary)) == NULL) { [self autorelease]; return(NULL); } - return(self); -} - -- (void)dealloc -{ - if(collection != NULL) { CFRelease(collection); collection = NULL; } - [super dealloc]; -} - -- (NSArray *)allObjects -{ - NSParameterAssert(collection != NULL); - NSUInteger count = [(NSDictionary *)collection count], atObject = 0UL; - id objects[count]; - - while((objects[atObject] = [self nextObject]) != NULL) { NSParameterAssert(atObject < count); atObject++; } - - return([NSArray arrayWithObjects:objects count:atObject]); -} - -- (id)nextObject -{ - NSParameterAssert((collection != NULL) && (_JKDictionaryHashEntry(collection) != NULL)); - JKHashTableEntry *entry = _JKDictionaryHashEntry(collection); - NSUInteger capacity = _JKDictionaryCapacity(collection); - id returnObject = NULL; - - if(entry != NULL) { while((nextObject < capacity) && ((returnObject = entry[nextObject++].key) == NULL)) { /* ... */ } } - - return(returnObject); -} - -@end - -#pragma mark - -@interface JKDictionary : NSMutableDictionary { - NSUInteger count, capacity, mutations; - JKHashTableEntry *entry; -} -@end - -@implementation JKDictionary - -+ (id)allocWithZone:(NSZone *)zone -{ -#pragma unused(zone) - [NSException raise:NSInvalidArgumentException format:@"*** - [%@ %@]: The %@ class is private to JSONKit and should not be used in this fashion.", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSStringFromClass([self class])]; - return(NULL); -} - -// These values are taken from Core Foundation CF-550 CFBasicHash.m. As a bonus, they align very well with our JKHashTableEntry struct too. -static const NSUInteger jk_dictionaryCapacities[] = { - 0UL, 3UL, 7UL, 13UL, 23UL, 41UL, 71UL, 127UL, 191UL, 251UL, 383UL, 631UL, 1087UL, 1723UL, - 2803UL, 4523UL, 7351UL, 11959UL, 19447UL, 31231UL, 50683UL, 81919UL, 132607UL, - 214519UL, 346607UL, 561109UL, 907759UL, 1468927UL, 2376191UL, 3845119UL, - 6221311UL, 10066421UL, 16287743UL, 26354171UL, 42641881UL, 68996069UL, - 111638519UL, 180634607UL, 292272623UL, 472907251UL -}; - -static NSUInteger _JKDictionaryCapacityForCount(NSUInteger count) { - NSUInteger bottom = 0UL, top = sizeof(jk_dictionaryCapacities) / sizeof(NSUInteger), mid = 0UL, tableSize = (NSUInteger)lround(floor(((double)count) * 1.33)); - while(top > bottom) { mid = (top + bottom) / 2UL; if(jk_dictionaryCapacities[mid] < tableSize) { bottom = mid + 1UL; } else { top = mid; } } - return(jk_dictionaryCapacities[bottom]); -} - -static void _JKDictionaryResizeIfNeccessary(JKDictionary *dictionary) { - NSCParameterAssert((dictionary != NULL) && (dictionary->entry != NULL) && (dictionary->count <= dictionary->capacity)); - - NSUInteger capacityForCount = 0UL; - if(dictionary->capacity < (capacityForCount = _JKDictionaryCapacityForCount(dictionary->count + 1UL))) { // resize - NSUInteger oldCapacity = dictionary->capacity; -#ifndef NS_BLOCK_ASSERTIONS - NSUInteger oldCount = dictionary->count; -#endif - JKHashTableEntry *oldEntry = dictionary->entry; - if(JK_EXPECT_F((dictionary->entry = (JKHashTableEntry *)calloc(1UL, sizeof(JKHashTableEntry) * capacityForCount)) == NULL)) { [NSException raise:NSMallocException format:@"Unable to allocate memory for hash table."]; } - dictionary->capacity = capacityForCount; - dictionary->count = 0UL; - - NSUInteger idx = 0UL; - for(idx = 0UL; idx < oldCapacity; idx++) { if(oldEntry[idx].key != NULL) { _JKDictionaryAddObject(dictionary, oldEntry[idx].keyHash, oldEntry[idx].key, oldEntry[idx].object); oldEntry[idx].keyHash = 0UL; oldEntry[idx].key = NULL; oldEntry[idx].object = NULL; } } - NSCParameterAssert((oldCount == dictionary->count)); - free(oldEntry); oldEntry = NULL; - } -} - -static JKDictionary *_JKDictionaryCreate(id *keys, NSUInteger *keyHashes, id *objects, NSUInteger count, BOOL mutableCollection) { - NSCParameterAssert((keys != NULL) && (keyHashes != NULL) && (objects != NULL) && (_JKDictionaryClass != NULL) && (_JKDictionaryInstanceSize > 0UL)); - JKDictionary *dictionary = NULL; - if(JK_EXPECT_T((dictionary = (JKDictionary *)calloc(1UL, _JKDictionaryInstanceSize)) != NULL)) { // Directly allocate the JKDictionary instance via calloc. - object_setClass(dictionary, _JKDictionaryClass); - if((dictionary = [dictionary init]) == NULL) { return(NULL); } - dictionary->capacity = _JKDictionaryCapacityForCount(count); - dictionary->count = 0UL; - - if(JK_EXPECT_F((dictionary->entry = (JKHashTableEntry *)calloc(1UL, sizeof(JKHashTableEntry) * dictionary->capacity)) == NULL)) { [dictionary autorelease]; return(NULL); } - - NSUInteger idx = 0UL; - for(idx = 0UL; idx < count; idx++) { _JKDictionaryAddObject(dictionary, keyHashes[idx], keys[idx], objects[idx]); } - - dictionary->mutations = (mutableCollection == NO) ? 0UL : 1UL; - } - return(dictionary); -} - -- (void)dealloc -{ - if(JK_EXPECT_T(entry != NULL)) { - NSUInteger atEntry = 0UL; - for(atEntry = 0UL; atEntry < capacity; atEntry++) { - if(JK_EXPECT_T(entry[atEntry].key != NULL)) { CFRelease(entry[atEntry].key); entry[atEntry].key = NULL; } - if(JK_EXPECT_T(entry[atEntry].object != NULL)) { CFRelease(entry[atEntry].object); entry[atEntry].object = NULL; } - } - - free(entry); entry = NULL; - } - - [super dealloc]; -} - -static JKHashTableEntry *_JKDictionaryHashEntry(JKDictionary *dictionary) { - NSCParameterAssert(dictionary != NULL); - return(dictionary->entry); -} - -static NSUInteger _JKDictionaryCapacity(JKDictionary *dictionary) { - NSCParameterAssert(dictionary != NULL); - return(dictionary->capacity); -} - -static void _JKDictionaryRemoveObjectWithEntry(JKDictionary *dictionary, JKHashTableEntry *entry) { - NSCParameterAssert((dictionary != NULL) && (entry != NULL) && (entry->key != NULL) && (entry->object != NULL) && (dictionary->count > 0UL) && (dictionary->count <= dictionary->capacity)); - CFRelease(entry->key); entry->key = NULL; - CFRelease(entry->object); entry->object = NULL; - entry->keyHash = 0UL; - dictionary->count--; - // In order for certain invariants that are used to speed up the search for a particular key, we need to "re-add" all the entries in the hash table following this entry until we hit a NULL entry. - NSUInteger removeIdx = entry - dictionary->entry, idx = 0UL; - NSCParameterAssert((removeIdx < dictionary->capacity)); - for(idx = 0UL; idx < dictionary->capacity; idx++) { - NSUInteger entryIdx = (removeIdx + idx + 1UL) % dictionary->capacity; - JKHashTableEntry *atEntry = &dictionary->entry[entryIdx]; - if(atEntry->key == NULL) { break; } - NSUInteger keyHash = atEntry->keyHash; - id key = atEntry->key, object = atEntry->object; - NSCParameterAssert(object != NULL); - atEntry->keyHash = 0UL; - atEntry->key = NULL; - atEntry->object = NULL; - NSUInteger addKeyEntry = keyHash % dictionary->capacity, addIdx = 0UL; - for(addIdx = 0UL; addIdx < dictionary->capacity; addIdx++) { - JKHashTableEntry *atAddEntry = &dictionary->entry[((addKeyEntry + addIdx) % dictionary->capacity)]; - if(JK_EXPECT_T(atAddEntry->key == NULL)) { NSCParameterAssert((atAddEntry->keyHash == 0UL) && (atAddEntry->object == NULL)); atAddEntry->key = key; atAddEntry->object = object; atAddEntry->keyHash = keyHash; break; } - } - } -} - -static void _JKDictionaryAddObject(JKDictionary *dictionary, NSUInteger keyHash, id key, id object) { - NSCParameterAssert((dictionary != NULL) && (key != NULL) && (object != NULL) && (dictionary->count < dictionary->capacity) && (dictionary->entry != NULL)); - NSUInteger keyEntry = keyHash % dictionary->capacity, idx = 0UL; - for(idx = 0UL; idx < dictionary->capacity; idx++) { - NSUInteger entryIdx = (keyEntry + idx) % dictionary->capacity; - JKHashTableEntry *atEntry = &dictionary->entry[entryIdx]; - if(JK_EXPECT_F(atEntry->keyHash == keyHash) && JK_EXPECT_T(atEntry->key != NULL) && (JK_EXPECT_F(key == atEntry->key) || JK_EXPECT_F(CFEqual(atEntry->key, key)))) { _JKDictionaryRemoveObjectWithEntry(dictionary, atEntry); } - if(JK_EXPECT_T(atEntry->key == NULL)) { NSCParameterAssert((atEntry->keyHash == 0UL) && (atEntry->object == NULL)); atEntry->key = key; atEntry->object = object; atEntry->keyHash = keyHash; dictionary->count++; return; } - } - - // We should never get here. If we do, we -release the key / object because it's our responsibility. - CFRelease(key); - CFRelease(object); -} - -- (NSUInteger)count -{ - return(count); -} - -static JKHashTableEntry *_JKDictionaryHashTableEntryForKey(JKDictionary *dictionary, id aKey) { - NSCParameterAssert((dictionary != NULL) && (dictionary->entry != NULL) && (dictionary->count <= dictionary->capacity)); - if((aKey == NULL) || (dictionary->capacity == 0UL)) { return(NULL); } - NSUInteger keyHash = CFHash(aKey), keyEntry = (keyHash % dictionary->capacity), idx = 0UL; - JKHashTableEntry *atEntry = NULL; - for(idx = 0UL; idx < dictionary->capacity; idx++) { - atEntry = &dictionary->entry[(keyEntry + idx) % dictionary->capacity]; - if(JK_EXPECT_T(atEntry->keyHash == keyHash) && JK_EXPECT_T(atEntry->key != NULL) && ((atEntry->key == aKey) || CFEqual(atEntry->key, aKey))) { NSCParameterAssert(atEntry->object != NULL); return(atEntry); break; } - if(JK_EXPECT_F(atEntry->key == NULL)) { NSCParameterAssert(atEntry->object == NULL); return(NULL); break; } // If the key was in the table, we would have found it by now. - } - return(NULL); -} - -- (id)objectForKey:(id)aKey -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - JKHashTableEntry *entryForKey = _JKDictionaryHashTableEntryForKey(self, aKey); - return((entryForKey != NULL) ? entryForKey->object : NULL); -} - -- (void)getObjects:(id *)objects andKeys:(id *)keys -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - NSUInteger atEntry = 0UL; NSUInteger arrayIdx = 0UL; - for(atEntry = 0UL; atEntry < capacity; atEntry++) { - if(JK_EXPECT_T(entry[atEntry].key != NULL)) { - NSCParameterAssert((entry[atEntry].object != NULL) && (arrayIdx < count)); - if(JK_EXPECT_T(keys != NULL)) { keys[arrayIdx] = entry[atEntry].key; } - if(JK_EXPECT_T(objects != NULL)) { objects[arrayIdx] = entry[atEntry].object; } - arrayIdx++; - } - } -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len -{ - NSParameterAssert((state != NULL) && (stackbuf != NULL) && (len > 0UL) && (entry != NULL) && (count <= capacity)); - if(JK_EXPECT_F(state->state == 0UL)) { state->mutationsPtr = (unsigned long *)&mutations; state->itemsPtr = stackbuf; } - if(JK_EXPECT_F(state->state >= capacity)) { return(0UL); } - - NSUInteger enumeratedCount = 0UL; - while(JK_EXPECT_T(enumeratedCount < len) && JK_EXPECT_T(state->state < capacity)) { if(JK_EXPECT_T(entry[state->state].key != NULL)) { stackbuf[enumeratedCount++] = entry[state->state].key; } state->state++; } - - return(enumeratedCount); -} - -- (NSEnumerator *)keyEnumerator -{ - return([[[JKDictionaryEnumerator alloc] initWithJKDictionary:self] autorelease]); -} - -- (void)setObject:(id)anObject forKey:(id)aKey -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(aKey == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil key", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil value (key: %@)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), aKey]; } - - _JKDictionaryResizeIfNeccessary(self); -#ifndef __clang_analyzer__ - aKey = [aKey copy]; // Why on earth would clang complain that this -copy "might leak", - anObject = [anObject retain]; // but this -retain doesn't!? -#endif // __clang_analyzer__ - _JKDictionaryAddObject(self, CFHash(aKey), aKey, anObject); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (void)removeObjectForKey:(id)aKey -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(aKey == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to remove nil key", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - JKHashTableEntry *entryForKey = _JKDictionaryHashTableEntryForKey(self, aKey); - if(entryForKey != NULL) { - _JKDictionaryRemoveObjectWithEntry(self, entryForKey); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; - } -} - -- (id)copyWithZone:(NSZone *)zone -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - return((mutations == 0UL) ? [self retain] : [[NSDictionary allocWithZone:zone] initWithDictionary:self]); -} - -- (id)mutableCopyWithZone:(NSZone *)zone -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - return([[NSMutableDictionary allocWithZone:zone] initWithDictionary:self]); -} - -@end - - - -#pragma mark - - -JK_STATIC_INLINE size_t jk_min(size_t a, size_t b) { return((a < b) ? a : b); } -JK_STATIC_INLINE size_t jk_max(size_t a, size_t b) { return((a > b) ? a : b); } - -JK_STATIC_INLINE JKHash jk_calculateHash(JKHash currentHash, unsigned char c) { return((((currentHash << 5) + currentHash) + (c - 29)) ^ (currentHash >> 19)); } - - -static void jk_error(JKParseState *parseState, NSString *format, ...) { - NSCParameterAssert((parseState != NULL) && (format != NULL)); - - va_list varArgsList; - va_start(varArgsList, format); - NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; - va_end(varArgsList); - -#if 0 - const unsigned char *lineStart = parseState->stringBuffer.bytes.ptr + parseState->lineStartIndex; - const unsigned char *lineEnd = lineStart; - const unsigned char *atCharacterPtr = NULL; - - for(atCharacterPtr = lineStart; atCharacterPtr < JK_END_STRING_PTR(parseState); atCharacterPtr++) { lineEnd = atCharacterPtr; if(jk_parse_is_newline(parseState, atCharacterPtr)) { break; } } - - NSString *lineString = @"", *carretString = @""; - if(lineStart < JK_END_STRING_PTR(parseState)) { - lineString = [[[NSString alloc] initWithBytes:lineStart length:(lineEnd - lineStart) encoding:NSUTF8StringEncoding] autorelease]; - carretString = [NSString stringWithFormat:@"%*.*s^", (int)(parseState->atIndex - parseState->lineStartIndex), (int)(parseState->atIndex - parseState->lineStartIndex), " "]; - } -#endif - - if(parseState->error == NULL) { - parseState->error = [NSError errorWithDomain:@"JKErrorDomain" code:-1L userInfo: - [NSDictionary dictionaryWithObjectsAndKeys: - formatString, NSLocalizedDescriptionKey, - [NSNumber numberWithUnsignedLong:parseState->atIndex], @"JKAtIndexKey", - [NSNumber numberWithUnsignedLong:parseState->lineNumber], @"JKLineNumberKey", - //lineString, @"JKErrorLine0Key", - //carretString, @"JKErrorLine1Key", - NULL]]; - } -} - -#pragma mark - -#pragma mark Buffer and Object Stack management functions - -static void jk_managedBuffer_release(JKManagedBuffer *managedBuffer) { - if((managedBuffer->flags & JKManagedBufferMustFree)) { - if(managedBuffer->bytes.ptr != NULL) { free(managedBuffer->bytes.ptr); managedBuffer->bytes.ptr = NULL; } - managedBuffer->flags &= ~JKManagedBufferMustFree; - } - - managedBuffer->bytes.ptr = NULL; - managedBuffer->bytes.length = 0UL; - managedBuffer->flags &= ~JKManagedBufferLocationMask; -} - -static void jk_managedBuffer_setToStackBuffer(JKManagedBuffer *managedBuffer, unsigned char *ptr, size_t length) { - jk_managedBuffer_release(managedBuffer); - managedBuffer->bytes.ptr = ptr; - managedBuffer->bytes.length = length; - managedBuffer->flags = (managedBuffer->flags & ~JKManagedBufferLocationMask) | JKManagedBufferOnStack; -} - -static unsigned char *jk_managedBuffer_resize(JKManagedBuffer *managedBuffer, size_t newSize) { - size_t roundedUpNewSize = newSize; - - if(managedBuffer->roundSizeUpToMultipleOf > 0UL) { roundedUpNewSize = newSize + ((managedBuffer->roundSizeUpToMultipleOf - (newSize % managedBuffer->roundSizeUpToMultipleOf)) % managedBuffer->roundSizeUpToMultipleOf); } - - if((roundedUpNewSize != managedBuffer->bytes.length) && (roundedUpNewSize > managedBuffer->bytes.length)) { - if((managedBuffer->flags & JKManagedBufferLocationMask) == JKManagedBufferOnStack) { - NSCParameterAssert((managedBuffer->flags & JKManagedBufferMustFree) == 0); - unsigned char *newBuffer = NULL, *oldBuffer = managedBuffer->bytes.ptr; - - if((newBuffer = (unsigned char *)malloc(roundedUpNewSize)) == NULL) { return(NULL); } - memcpy(newBuffer, oldBuffer, jk_min(managedBuffer->bytes.length, roundedUpNewSize)); - managedBuffer->flags = (managedBuffer->flags & ~JKManagedBufferLocationMask) | (JKManagedBufferOnHeap | JKManagedBufferMustFree); - managedBuffer->bytes.ptr = newBuffer; - managedBuffer->bytes.length = roundedUpNewSize; - } else { - NSCParameterAssert(((managedBuffer->flags & JKManagedBufferMustFree) != 0) && ((managedBuffer->flags & JKManagedBufferLocationMask) == JKManagedBufferOnHeap)); - if((managedBuffer->bytes.ptr = (unsigned char *)reallocf(managedBuffer->bytes.ptr, roundedUpNewSize)) == NULL) { return(NULL); } - managedBuffer->bytes.length = roundedUpNewSize; - } - } - - return(managedBuffer->bytes.ptr); -} - - - -static void jk_objectStack_release(JKObjectStack *objectStack) { - NSCParameterAssert(objectStack != NULL); - - NSCParameterAssert(objectStack->index <= objectStack->count); - size_t atIndex = 0UL; - for(atIndex = 0UL; atIndex < objectStack->index; atIndex++) { - if(objectStack->objects[atIndex] != NULL) { CFRelease(objectStack->objects[atIndex]); objectStack->objects[atIndex] = NULL; } - if(objectStack->keys[atIndex] != NULL) { CFRelease(objectStack->keys[atIndex]); objectStack->keys[atIndex] = NULL; } - } - objectStack->index = 0UL; - - if(objectStack->flags & JKObjectStackMustFree) { - NSCParameterAssert((objectStack->flags & JKObjectStackLocationMask) == JKObjectStackOnHeap); - if(objectStack->objects != NULL) { free(objectStack->objects); objectStack->objects = NULL; } - if(objectStack->keys != NULL) { free(objectStack->keys); objectStack->keys = NULL; } - if(objectStack->cfHashes != NULL) { free(objectStack->cfHashes); objectStack->cfHashes = NULL; } - objectStack->flags &= ~JKObjectStackMustFree; - } - - objectStack->objects = NULL; - objectStack->keys = NULL; - objectStack->cfHashes = NULL; - - objectStack->count = 0UL; - objectStack->flags &= ~JKObjectStackLocationMask; -} - -static void jk_objectStack_setToStackBuffer(JKObjectStack *objectStack, void **objects, void **keys, CFHashCode *cfHashes, size_t count) { - NSCParameterAssert((objectStack != NULL) && (objects != NULL) && (keys != NULL) && (cfHashes != NULL) && (count > 0UL)); - jk_objectStack_release(objectStack); - objectStack->objects = objects; - objectStack->keys = keys; - objectStack->cfHashes = cfHashes; - objectStack->count = count; - objectStack->flags = (objectStack->flags & ~JKObjectStackLocationMask) | JKObjectStackOnStack; -#ifndef NS_BLOCK_ASSERTIONS - size_t idx; - for(idx = 0UL; idx < objectStack->count; idx++) { objectStack->objects[idx] = NULL; objectStack->keys[idx] = NULL; objectStack->cfHashes[idx] = 0UL; } -#endif -} - -static int jk_objectStack_resize(JKObjectStack *objectStack, size_t newCount) { - size_t roundedUpNewCount = newCount; - int returnCode = 0; - - void **newObjects = NULL, **newKeys = NULL; - CFHashCode *newCFHashes = NULL; - - if(objectStack->roundSizeUpToMultipleOf > 0UL) { roundedUpNewCount = newCount + ((objectStack->roundSizeUpToMultipleOf - (newCount % objectStack->roundSizeUpToMultipleOf)) % objectStack->roundSizeUpToMultipleOf); } - - if((roundedUpNewCount != objectStack->count) && (roundedUpNewCount > objectStack->count)) { - if((objectStack->flags & JKObjectStackLocationMask) == JKObjectStackOnStack) { - NSCParameterAssert((objectStack->flags & JKObjectStackMustFree) == 0); - - if((newObjects = (void ** )calloc(1UL, roundedUpNewCount * sizeof(void * ))) == NULL) { returnCode = 1; goto errorExit; } - memcpy(newObjects, objectStack->objects, jk_min(objectStack->count, roundedUpNewCount) * sizeof(void *)); - if((newKeys = (void ** )calloc(1UL, roundedUpNewCount * sizeof(void * ))) == NULL) { returnCode = 1; goto errorExit; } - memcpy(newKeys, objectStack->keys, jk_min(objectStack->count, roundedUpNewCount) * sizeof(void *)); - - if((newCFHashes = (CFHashCode *)calloc(1UL, roundedUpNewCount * sizeof(CFHashCode))) == NULL) { returnCode = 1; goto errorExit; } - memcpy(newCFHashes, objectStack->cfHashes, jk_min(objectStack->count, roundedUpNewCount) * sizeof(CFHashCode)); - - objectStack->flags = (objectStack->flags & ~JKObjectStackLocationMask) | (JKObjectStackOnHeap | JKObjectStackMustFree); - objectStack->objects = newObjects; newObjects = NULL; - objectStack->keys = newKeys; newKeys = NULL; - objectStack->cfHashes = newCFHashes; newCFHashes = NULL; - objectStack->count = roundedUpNewCount; - } else { - NSCParameterAssert(((objectStack->flags & JKObjectStackMustFree) != 0) && ((objectStack->flags & JKObjectStackLocationMask) == JKObjectStackOnHeap)); - if((newObjects = (void ** )realloc(objectStack->objects, roundedUpNewCount * sizeof(void * ))) != NULL) { objectStack->objects = newObjects; newObjects = NULL; } else { returnCode = 1; goto errorExit; } - if((newKeys = (void ** )realloc(objectStack->keys, roundedUpNewCount * sizeof(void * ))) != NULL) { objectStack->keys = newKeys; newKeys = NULL; } else { returnCode = 1; goto errorExit; } - if((newCFHashes = (CFHashCode *)realloc(objectStack->cfHashes, roundedUpNewCount * sizeof(CFHashCode))) != NULL) { objectStack->cfHashes = newCFHashes; newCFHashes = NULL; } else { returnCode = 1; goto errorExit; } - -#ifndef NS_BLOCK_ASSERTIONS - size_t idx; - for(idx = objectStack->count; idx < roundedUpNewCount; idx++) { objectStack->objects[idx] = NULL; objectStack->keys[idx] = NULL; objectStack->cfHashes[idx] = 0UL; } -#endif - objectStack->count = roundedUpNewCount; - } - } - - errorExit: - if(newObjects != NULL) { free(newObjects); newObjects = NULL; } - if(newKeys != NULL) { free(newKeys); newKeys = NULL; } - if(newCFHashes != NULL) { free(newCFHashes); newCFHashes = NULL; } - - return(returnCode); -} - -//////////// -#pragma mark - -#pragma mark Unicode related functions - -JK_STATIC_INLINE ConversionResult isValidCodePoint(UTF32 *u32CodePoint) { - ConversionResult result = conversionOK; - UTF32 ch = *u32CodePoint; - - if(JK_EXPECT_F(ch >= UNI_SUR_HIGH_START) && (JK_EXPECT_T(ch <= UNI_SUR_LOW_END))) { result = sourceIllegal; ch = UNI_REPLACEMENT_CHAR; goto finished; } - if(JK_EXPECT_F(ch >= 0xFDD0U) && (JK_EXPECT_F(ch <= 0xFDEFU) || JK_EXPECT_F((ch & 0xFFFEU) == 0xFFFEU)) && JK_EXPECT_T(ch <= 0x10FFFFU)) { result = sourceIllegal; ch = UNI_REPLACEMENT_CHAR; goto finished; } - if(JK_EXPECT_F(ch == 0U)) { result = sourceIllegal; ch = UNI_REPLACEMENT_CHAR; goto finished; } - - finished: - *u32CodePoint = ch; - return(result); -} - - -static int isLegalUTF8(const UTF8 *source, size_t length) { - const UTF8 *srcptr = source + length; - UTF8 a; - - switch(length) { - default: return(0); // Everything else falls through when "true"... - case 4: if(JK_EXPECT_F(((a = (*--srcptr)) < 0x80) || (a > 0xBF))) { return(0); } - case 3: if(JK_EXPECT_F(((a = (*--srcptr)) < 0x80) || (a > 0xBF))) { return(0); } - case 2: if(JK_EXPECT_F( (a = (*--srcptr)) > 0xBF )) { return(0); } - - switch(*source) { // no fall-through in this inner switch - case 0xE0: if(JK_EXPECT_F(a < 0xA0)) { return(0); } break; - case 0xED: if(JK_EXPECT_F(a > 0x9F)) { return(0); } break; - case 0xF0: if(JK_EXPECT_F(a < 0x90)) { return(0); } break; - case 0xF4: if(JK_EXPECT_F(a > 0x8F)) { return(0); } break; - default: if(JK_EXPECT_F(a < 0x80)) { return(0); } - } - - case 1: if(JK_EXPECT_F((JK_EXPECT_T(*source < 0xC2)) && JK_EXPECT_F(*source >= 0x80))) { return(0); } - } - - if(JK_EXPECT_F(*source > 0xF4)) { return(0); } - - return(1); -} - -static ConversionResult ConvertSingleCodePointInUTF8(const UTF8 *sourceStart, const UTF8 *sourceEnd, UTF8 const **nextUTF8, UTF32 *convertedUTF32) { - ConversionResult result = conversionOK; - const UTF8 *source = sourceStart; - UTF32 ch = 0UL; - -#if !defined(JK_FAST_TRAILING_BYTES) - unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; -#else - unsigned short extraBytesToRead = __builtin_clz(((*source)^0xff) << 25); -#endif - - if(JK_EXPECT_F((source + extraBytesToRead + 1) > sourceEnd) || JK_EXPECT_F(!isLegalUTF8(source, extraBytesToRead + 1))) { - source++; - while((source < sourceEnd) && (((*source) & 0xc0) == 0x80) && ((source - sourceStart) < (extraBytesToRead + 1))) { source++; } - NSCParameterAssert(source <= sourceEnd); - result = ((source < sourceEnd) && (((*source) & 0xc0) != 0x80)) ? sourceIllegal : ((sourceStart + extraBytesToRead + 1) > sourceEnd) ? sourceExhausted : sourceIllegal; - ch = UNI_REPLACEMENT_CHAR; - goto finished; - } - - switch(extraBytesToRead) { // The cases all fall through. - case 5: ch += *source++; ch <<= 6; - case 4: ch += *source++; ch <<= 6; - case 3: ch += *source++; ch <<= 6; - case 2: ch += *source++; ch <<= 6; - case 1: ch += *source++; ch <<= 6; - case 0: ch += *source++; - } - ch -= offsetsFromUTF8[extraBytesToRead]; - - result = isValidCodePoint(&ch); - - finished: - *nextUTF8 = source; - *convertedUTF32 = ch; - - return(result); -} - - -static ConversionResult ConvertUTF32toUTF8 (UTF32 u32CodePoint, UTF8 **targetStart, UTF8 *targetEnd) { - const UTF32 byteMask = 0xBF, byteMark = 0x80; - ConversionResult result = conversionOK; - UTF8 *target = *targetStart; - UTF32 ch = u32CodePoint; - unsigned short bytesToWrite = 0; - - result = isValidCodePoint(&ch); - - // Figure out how many bytes the result will require. Turn any illegally large UTF32 things (> Plane 17) into replacement chars. - if(ch < (UTF32)0x80) { bytesToWrite = 1; } - else if(ch < (UTF32)0x800) { bytesToWrite = 2; } - else if(ch < (UTF32)0x10000) { bytesToWrite = 3; } - else if(ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4; } - else { bytesToWrite = 3; ch = UNI_REPLACEMENT_CHAR; result = sourceIllegal; } - - target += bytesToWrite; - if (target > targetEnd) { target -= bytesToWrite; result = targetExhausted; goto finished; } - - switch (bytesToWrite) { // note: everything falls through. - case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]); - } - - target += bytesToWrite; - - finished: - *targetStart = target; - return(result); -} - -JK_STATIC_INLINE int jk_string_add_unicodeCodePoint(JKParseState *parseState, uint32_t unicodeCodePoint, size_t *tokenBufferIdx, JKHash *stringHash) { - UTF8 *u8s = &parseState->token.tokenBuffer.bytes.ptr[*tokenBufferIdx]; - ConversionResult result; - - if((result = ConvertUTF32toUTF8(unicodeCodePoint, &u8s, (parseState->token.tokenBuffer.bytes.ptr + parseState->token.tokenBuffer.bytes.length))) != conversionOK) { if(result == targetExhausted) { return(1); } } - size_t utf8len = u8s - &parseState->token.tokenBuffer.bytes.ptr[*tokenBufferIdx], nextIdx = (*tokenBufferIdx) + utf8len; - - while(*tokenBufferIdx < nextIdx) { *stringHash = jk_calculateHash(*stringHash, parseState->token.tokenBuffer.bytes.ptr[(*tokenBufferIdx)++]); } - - return(0); -} - -//////////// -#pragma mark - -#pragma mark Decoding / parsing / deserializing functions - -static int jk_parse_string(JKParseState *parseState) { - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *stringStart = JK_AT_STRING_PTR(parseState) + 1; - const unsigned char *endOfBuffer = JK_END_STRING_PTR(parseState); - const unsigned char *atStringCharacter = stringStart; - unsigned char *tokenBuffer = parseState->token.tokenBuffer.bytes.ptr; - size_t tokenStartIndex = parseState->atIndex; - size_t tokenBufferIdx = 0UL; - - int onlySimpleString = 1, stringState = JSONStringStateStart; - uint16_t escapedUnicode1 = 0U, escapedUnicode2 = 0U; - uint32_t escapedUnicodeCodePoint = 0U; - JKHash stringHash = JK_HASH_INIT; - - while(1) { - unsigned long currentChar; - - if(JK_EXPECT_F(atStringCharacter == endOfBuffer)) { /* XXX Add error message */ stringState = JSONStringStateError; goto finishedParsing; } - - if(JK_EXPECT_F((currentChar = *atStringCharacter++) >= 0x80UL)) { - const unsigned char *nextValidCharacter = NULL; - UTF32 u32ch = 0U; - ConversionResult result; - - if(JK_EXPECT_F((result = ConvertSingleCodePointInUTF8(atStringCharacter - 1, endOfBuffer, (UTF8 const **)&nextValidCharacter, &u32ch)) != conversionOK)) { goto switchToSlowPath; } - stringHash = jk_calculateHash(stringHash, currentChar); - while(atStringCharacter < nextValidCharacter) { NSCParameterAssert(JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState)); stringHash = jk_calculateHash(stringHash, *atStringCharacter++); } - continue; - } else { - if(JK_EXPECT_F(currentChar == (unsigned long)'"')) { stringState = JSONStringStateFinished; goto finishedParsing; } - - if(JK_EXPECT_F(currentChar == (unsigned long)'\\')) { - switchToSlowPath: - onlySimpleString = 0; - stringState = JSONStringStateParsing; - tokenBufferIdx = (atStringCharacter - stringStart) - 1L; - if(JK_EXPECT_F((tokenBufferIdx + 16UL) > parseState->token.tokenBuffer.bytes.length)) { if((tokenBuffer = jk_managedBuffer_resize(&parseState->token.tokenBuffer, tokenBufferIdx + 1024UL)) == NULL) { jk_error(parseState, @"Internal error: Unable to resize temporary buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - memcpy(tokenBuffer, stringStart, tokenBufferIdx); - goto slowMatch; - } - - if(JK_EXPECT_F(currentChar < 0x20UL)) { jk_error(parseState, @"Invalid character < 0x20 found in string: 0x%2.2x.", currentChar); stringState = JSONStringStateError; goto finishedParsing; } - - stringHash = jk_calculateHash(stringHash, currentChar); - } - } - - slowMatch: - - for(atStringCharacter = (stringStart + ((atStringCharacter - stringStart) - 1L)); (atStringCharacter < endOfBuffer) && (tokenBufferIdx < parseState->token.tokenBuffer.bytes.length); atStringCharacter++) { - if((tokenBufferIdx + 16UL) > parseState->token.tokenBuffer.bytes.length) { if((tokenBuffer = jk_managedBuffer_resize(&parseState->token.tokenBuffer, tokenBufferIdx + 1024UL)) == NULL) { jk_error(parseState, @"Internal error: Unable to resize temporary buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - - NSCParameterAssert(tokenBufferIdx < parseState->token.tokenBuffer.bytes.length); - - unsigned long currentChar = (*atStringCharacter), escapedChar; - - if(JK_EXPECT_T(stringState == JSONStringStateParsing)) { - if(JK_EXPECT_T(currentChar >= 0x20UL)) { - if(JK_EXPECT_T(currentChar < (unsigned long)0x80)) { // Not a UTF8 sequence - if(JK_EXPECT_F(currentChar == (unsigned long)'"')) { stringState = JSONStringStateFinished; atStringCharacter++; goto finishedParsing; } - if(JK_EXPECT_F(currentChar == (unsigned long)'\\')) { stringState = JSONStringStateEscape; continue; } - stringHash = jk_calculateHash(stringHash, currentChar); - tokenBuffer[tokenBufferIdx++] = currentChar; - continue; - } else { // UTF8 sequence - const unsigned char *nextValidCharacter = NULL; - UTF32 u32ch = 0U; - ConversionResult result; - - if(JK_EXPECT_F((result = ConvertSingleCodePointInUTF8(atStringCharacter, endOfBuffer, (UTF8 const **)&nextValidCharacter, &u32ch)) != conversionOK)) { - if((result == sourceIllegal) && ((parseState->parseOptionFlags & JKParseOptionLooseUnicode) == 0)) { jk_error(parseState, @"Illegal UTF8 sequence found in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; } - if(result == sourceExhausted) { jk_error(parseState, @"End of buffer reached while parsing UTF8 in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; } - if(jk_string_add_unicodeCodePoint(parseState, u32ch, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } - atStringCharacter = nextValidCharacter - 1; - continue; - } else { - while(atStringCharacter < nextValidCharacter) { tokenBuffer[tokenBufferIdx++] = *atStringCharacter; stringHash = jk_calculateHash(stringHash, *atStringCharacter++); } - atStringCharacter--; - continue; - } - } - } else { // currentChar < 0x20 - jk_error(parseState, @"Invalid character < 0x20 found in string: 0x%2.2x.", currentChar); stringState = JSONStringStateError; goto finishedParsing; - } - - } else { // stringState != JSONStringStateParsing - int isSurrogate = 1; - - switch(stringState) { - case JSONStringStateEscape: - switch(currentChar) { - case 'u': escapedUnicode1 = 0U; escapedUnicode2 = 0U; escapedUnicodeCodePoint = 0U; stringState = JSONStringStateEscapedUnicode1; break; - - case 'b': escapedChar = '\b'; goto parsedEscapedChar; - case 'f': escapedChar = '\f'; goto parsedEscapedChar; - case 'n': escapedChar = '\n'; goto parsedEscapedChar; - case 'r': escapedChar = '\r'; goto parsedEscapedChar; - case 't': escapedChar = '\t'; goto parsedEscapedChar; - case '\\': escapedChar = '\\'; goto parsedEscapedChar; - case '/': escapedChar = '/'; goto parsedEscapedChar; - case '"': escapedChar = '"'; goto parsedEscapedChar; - - parsedEscapedChar: - stringState = JSONStringStateParsing; - stringHash = jk_calculateHash(stringHash, escapedChar); - tokenBuffer[tokenBufferIdx++] = escapedChar; - break; - - default: jk_error(parseState, @"Invalid escape sequence found in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; break; - } - break; - - case JSONStringStateEscapedUnicode1: - case JSONStringStateEscapedUnicode2: - case JSONStringStateEscapedUnicode3: - case JSONStringStateEscapedUnicode4: isSurrogate = 0; - case JSONStringStateEscapedUnicodeSurrogate1: - case JSONStringStateEscapedUnicodeSurrogate2: - case JSONStringStateEscapedUnicodeSurrogate3: - case JSONStringStateEscapedUnicodeSurrogate4: - { - uint16_t hexValue = 0U; - - switch(currentChar) { - case '0' ... '9': hexValue = currentChar - '0'; goto parsedHex; - case 'a' ... 'f': hexValue = (currentChar - 'a') + 10U; goto parsedHex; - case 'A' ... 'F': hexValue = (currentChar - 'A') + 10U; goto parsedHex; - - parsedHex: - if(!isSurrogate) { escapedUnicode1 = (escapedUnicode1 << 4) | hexValue; } else { escapedUnicode2 = (escapedUnicode2 << 4) | hexValue; } - - if(stringState == JSONStringStateEscapedUnicode4) { - if(((escapedUnicode1 >= 0xD800U) && (escapedUnicode1 < 0xE000U))) { - if((escapedUnicode1 >= 0xD800U) && (escapedUnicode1 < 0xDC00U)) { stringState = JSONStringStateEscapedNeedEscapeForSurrogate; } - else if((escapedUnicode1 >= 0xDC00U) && (escapedUnicode1 < 0xE000U)) { - if((parseState->parseOptionFlags & JKParseOptionLooseUnicode)) { escapedUnicodeCodePoint = UNI_REPLACEMENT_CHAR; } - else { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - } - } - else { escapedUnicodeCodePoint = escapedUnicode1; } - } - - if(stringState == JSONStringStateEscapedUnicodeSurrogate4) { - if((escapedUnicode2 < 0xdc00) || (escapedUnicode2 > 0xdfff)) { - if((parseState->parseOptionFlags & JKParseOptionLooseUnicode)) { escapedUnicodeCodePoint = UNI_REPLACEMENT_CHAR; } - else { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - } - else { escapedUnicodeCodePoint = ((escapedUnicode1 - 0xd800) * 0x400) + (escapedUnicode2 - 0xdc00) + 0x10000; } - } - - if((stringState == JSONStringStateEscapedUnicode4) || (stringState == JSONStringStateEscapedUnicodeSurrogate4)) { - if((isValidCodePoint(&escapedUnicodeCodePoint) == sourceIllegal) && ((parseState->parseOptionFlags & JKParseOptionLooseUnicode) == 0)) { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - stringState = JSONStringStateParsing; - if(jk_string_add_unicodeCodePoint(parseState, escapedUnicodeCodePoint, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } - } - else if((stringState >= JSONStringStateEscapedUnicode1) && (stringState <= JSONStringStateEscapedUnicodeSurrogate4)) { stringState++; } - break; - - default: jk_error(parseState, @"Unexpected character found in \\u Unicode escape sequence. Found '%c', expected [0-9a-fA-F].", currentChar); stringState = JSONStringStateError; goto finishedParsing; break; - } - } - break; - - case JSONStringStateEscapedNeedEscapeForSurrogate: - if(currentChar == '\\') { stringState = JSONStringStateEscapedNeedEscapedUForSurrogate; } - else { - if((parseState->parseOptionFlags & JKParseOptionLooseUnicode) == 0) { jk_error(parseState, @"Required a second \\u Unicode escape sequence following a surrogate \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - else { stringState = JSONStringStateParsing; atStringCharacter--; if(jk_string_add_unicodeCodePoint(parseState, UNI_REPLACEMENT_CHAR, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - } - break; - - case JSONStringStateEscapedNeedEscapedUForSurrogate: - if(currentChar == 'u') { stringState = JSONStringStateEscapedUnicodeSurrogate1; } - else { - if((parseState->parseOptionFlags & JKParseOptionLooseUnicode) == 0) { jk_error(parseState, @"Required a second \\u Unicode escape sequence following a surrogate \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - else { stringState = JSONStringStateParsing; atStringCharacter -= 2; if(jk_string_add_unicodeCodePoint(parseState, UNI_REPLACEMENT_CHAR, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - } - break; - - default: jk_error(parseState, @"Internal error: Unknown stringState. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; break; - } - } - } - -finishedParsing: - - if(JK_EXPECT_T(stringState == JSONStringStateFinished)) { - NSCParameterAssert((parseState->stringBuffer.bytes.ptr + tokenStartIndex) < atStringCharacter); - - parseState->token.tokenPtrRange.ptr = parseState->stringBuffer.bytes.ptr + tokenStartIndex; - parseState->token.tokenPtrRange.length = (atStringCharacter - parseState->token.tokenPtrRange.ptr); - - if(JK_EXPECT_T(onlySimpleString)) { - NSCParameterAssert(((parseState->token.tokenPtrRange.ptr + 1) < endOfBuffer) && (parseState->token.tokenPtrRange.length >= 2UL) && (((parseState->token.tokenPtrRange.ptr + 1) + (parseState->token.tokenPtrRange.length - 2)) < endOfBuffer)); - parseState->token.value.ptrRange.ptr = parseState->token.tokenPtrRange.ptr + 1; - parseState->token.value.ptrRange.length = parseState->token.tokenPtrRange.length - 2UL; - } else { - parseState->token.value.ptrRange.ptr = parseState->token.tokenBuffer.bytes.ptr; - parseState->token.value.ptrRange.length = tokenBufferIdx; - } - - parseState->token.value.hash = stringHash; - parseState->token.value.type = JKValueTypeString; - parseState->atIndex = (atStringCharacter - parseState->stringBuffer.bytes.ptr); - } - - if(JK_EXPECT_F(stringState != JSONStringStateFinished)) { jk_error(parseState, @"Invalid string."); } - return(JK_EXPECT_T(stringState == JSONStringStateFinished) ? 0 : 1); -} - -static int jk_parse_number(JKParseState *parseState) { - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *numberStart = JK_AT_STRING_PTR(parseState); - const unsigned char *endOfBuffer = JK_END_STRING_PTR(parseState); - const unsigned char *atNumberCharacter = NULL; - int numberState = JSONNumberStateWholeNumberStart, isFloatingPoint = 0, isNegative = 0, backup = 0; - size_t startingIndex = parseState->atIndex; - - for(atNumberCharacter = numberStart; (JK_EXPECT_T(atNumberCharacter < endOfBuffer)) && (JK_EXPECT_T(!(JK_EXPECT_F(numberState == JSONNumberStateFinished) || JK_EXPECT_F(numberState == JSONNumberStateError)))); atNumberCharacter++) { - unsigned long currentChar = (unsigned long)(*atNumberCharacter), lowerCaseCC = currentChar | 0x20UL; - - switch(numberState) { - case JSONNumberStateWholeNumberStart: if (currentChar == '-') { numberState = JSONNumberStateWholeNumberMinus; isNegative = 1; break; } - case JSONNumberStateWholeNumberMinus: if (currentChar == '0') { numberState = JSONNumberStateWholeNumberZero; break; } - else if( (currentChar >= '1') && (currentChar <= '9')) { numberState = JSONNumberStateWholeNumber; break; } - else { /* XXX Add error message */ numberState = JSONNumberStateError; break; } - case JSONNumberStateExponentStart: if( (currentChar == '+') || (currentChar == '-')) { numberState = JSONNumberStateExponentPlusMinus; break; } - case JSONNumberStateFractionalNumberStart: - case JSONNumberStateExponentPlusMinus:if(!((currentChar >= '0') && (currentChar <= '9'))) { /* XXX Add error message */ numberState = JSONNumberStateError; break; } - else { if(numberState == JSONNumberStateFractionalNumberStart) { numberState = JSONNumberStateFractionalNumber; } - else { numberState = JSONNumberStateExponent; } break; } - case JSONNumberStateWholeNumberZero: - case JSONNumberStateWholeNumber: if (currentChar == '.') { numberState = JSONNumberStateFractionalNumberStart; isFloatingPoint = 1; break; } - case JSONNumberStateFractionalNumber: if (lowerCaseCC == 'e') { numberState = JSONNumberStateExponentStart; isFloatingPoint = 1; break; } - case JSONNumberStateExponent: if(!((currentChar >= '0') && (currentChar <= '9')) || (numberState == JSONNumberStateWholeNumberZero)) { numberState = JSONNumberStateFinished; backup = 1; break; } - break; - default: /* XXX Add error message */ numberState = JSONNumberStateError; break; - } - } - - parseState->token.tokenPtrRange.ptr = parseState->stringBuffer.bytes.ptr + startingIndex; - parseState->token.tokenPtrRange.length = (atNumberCharacter - parseState->token.tokenPtrRange.ptr) - backup; - parseState->atIndex = (parseState->token.tokenPtrRange.ptr + parseState->token.tokenPtrRange.length) - parseState->stringBuffer.bytes.ptr; - - if(JK_EXPECT_T(numberState == JSONNumberStateFinished)) { - unsigned char numberTempBuf[parseState->token.tokenPtrRange.length + 4UL]; - unsigned char *endOfNumber = NULL; - - memcpy(numberTempBuf, parseState->token.tokenPtrRange.ptr, parseState->token.tokenPtrRange.length); - numberTempBuf[parseState->token.tokenPtrRange.length] = 0; - - errno = 0; - - // Treat "-0" as a floating point number, which is capable of representing negative zeros. - if(JK_EXPECT_F(parseState->token.tokenPtrRange.length == 2UL) && JK_EXPECT_F(numberTempBuf[1] == '0') && JK_EXPECT_F(isNegative)) { isFloatingPoint = 1; } - - if(isFloatingPoint) { - parseState->token.value.number.doubleValue = strtod((const char *)numberTempBuf, (char **)&endOfNumber); // strtod is documented to return U+2261 (identical to) 0.0 on an underflow error (along with setting errno to ERANGE). - parseState->token.value.type = JKValueTypeDouble; - parseState->token.value.ptrRange.ptr = (const unsigned char *)&parseState->token.value.number.doubleValue; - parseState->token.value.ptrRange.length = sizeof(double); - parseState->token.value.hash = (JK_HASH_INIT + parseState->token.value.type); - } else { - if(isNegative) { - parseState->token.value.number.longLongValue = strtoll((const char *)numberTempBuf, (char **)&endOfNumber, 10); - parseState->token.value.type = JKValueTypeLongLong; - parseState->token.value.ptrRange.ptr = (const unsigned char *)&parseState->token.value.number.longLongValue; - parseState->token.value.ptrRange.length = sizeof(long long); - parseState->token.value.hash = (JK_HASH_INIT + parseState->token.value.type) + (JKHash)parseState->token.value.number.longLongValue; - } else { - parseState->token.value.number.unsignedLongLongValue = strtoull((const char *)numberTempBuf, (char **)&endOfNumber, 10); - parseState->token.value.type = JKValueTypeUnsignedLongLong; - parseState->token.value.ptrRange.ptr = (const unsigned char *)&parseState->token.value.number.unsignedLongLongValue; - parseState->token.value.ptrRange.length = sizeof(unsigned long long); - parseState->token.value.hash = (JK_HASH_INIT + parseState->token.value.type) + (JKHash)parseState->token.value.number.unsignedLongLongValue; - } - } - - if(JK_EXPECT_F(errno != 0)) { - numberState = JSONNumberStateError; - if(errno == ERANGE) { - switch(parseState->token.value.type) { - case JKValueTypeDouble: jk_error(parseState, @"The value '%s' could not be represented as a 'double' due to %s.", numberTempBuf, (parseState->token.value.number.doubleValue == 0.0) ? "underflow" : "overflow"); break; // see above for == 0.0. - case JKValueTypeLongLong: jk_error(parseState, @"The value '%s' exceeded the minimum value that could be represented: %lld.", numberTempBuf, parseState->token.value.number.longLongValue); break; - case JKValueTypeUnsignedLongLong: jk_error(parseState, @"The value '%s' exceeded the maximum value that could be represented: %llu.", numberTempBuf, parseState->token.value.number.unsignedLongLongValue); break; - default: jk_error(parseState, @"Internal error: Unknown token value type. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; - } - } - } - if(JK_EXPECT_F(endOfNumber != &numberTempBuf[parseState->token.tokenPtrRange.length]) && JK_EXPECT_F(numberState != JSONNumberStateError)) { numberState = JSONNumberStateError; jk_error(parseState, @"The conversion function did not consume all of the number tokens characters."); } - - size_t hashIndex = 0UL; - for(hashIndex = 0UL; hashIndex < parseState->token.value.ptrRange.length; hashIndex++) { parseState->token.value.hash = jk_calculateHash(parseState->token.value.hash, parseState->token.value.ptrRange.ptr[hashIndex]); } - } - - if(JK_EXPECT_F(numberState != JSONNumberStateFinished)) { jk_error(parseState, @"Invalid number."); } - return(JK_EXPECT_T((numberState == JSONNumberStateFinished)) ? 0 : 1); -} - -JK_STATIC_INLINE void jk_set_parsed_token(JKParseState *parseState, const unsigned char *ptr, size_t length, JKTokenType type, size_t advanceBy) { - parseState->token.tokenPtrRange.ptr = ptr; - parseState->token.tokenPtrRange.length = length; - parseState->token.type = type; - parseState->atIndex += advanceBy; -} - -static size_t jk_parse_is_newline(JKParseState *parseState, const unsigned char *atCharacterPtr) { - NSCParameterAssert((parseState != NULL) && (atCharacterPtr != NULL) && (atCharacterPtr >= parseState->stringBuffer.bytes.ptr) && (atCharacterPtr < JK_END_STRING_PTR(parseState))); - const unsigned char *endOfStringPtr = JK_END_STRING_PTR(parseState); - - if(JK_EXPECT_F(atCharacterPtr >= endOfStringPtr)) { return(0UL); } - - if(JK_EXPECT_F((*(atCharacterPtr + 0)) == '\n')) { return(1UL); } - if(JK_EXPECT_F((*(atCharacterPtr + 0)) == '\r')) { if((JK_EXPECT_T((atCharacterPtr + 1) < endOfStringPtr)) && ((*(atCharacterPtr + 1)) == '\n')) { return(2UL); } return(1UL); } - if(parseState->parseOptionFlags & JKParseOptionUnicodeNewlines) { - if((JK_EXPECT_F((*(atCharacterPtr + 0)) == 0xc2)) && (((atCharacterPtr + 1) < endOfStringPtr) && ((*(atCharacterPtr + 1)) == 0x85))) { return(2UL); } - if((JK_EXPECT_F((*(atCharacterPtr + 0)) == 0xe2)) && (((atCharacterPtr + 2) < endOfStringPtr) && ((*(atCharacterPtr + 1)) == 0x80) && (((*(atCharacterPtr + 2)) == 0xa8) || ((*(atCharacterPtr + 2)) == 0xa9)))) { return(3UL); } - } - - return(0UL); -} - -JK_STATIC_INLINE int jk_parse_skip_newline(JKParseState *parseState) { - size_t newlineAdvanceAtIndex = 0UL; - if(JK_EXPECT_F((newlineAdvanceAtIndex = jk_parse_is_newline(parseState, JK_AT_STRING_PTR(parseState))) > 0UL)) { parseState->lineNumber++; parseState->atIndex += (newlineAdvanceAtIndex - 1UL); parseState->lineStartIndex = parseState->atIndex + 1UL; return(1); } - return(0); -} - -JK_STATIC_INLINE void jk_parse_skip_whitespace(JKParseState *parseState) { -#ifndef __clang_analyzer__ - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *atCharacterPtr = NULL; - const unsigned char *endOfStringPtr = JK_END_STRING_PTR(parseState); - - for(atCharacterPtr = JK_AT_STRING_PTR(parseState); (JK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr)); parseState->atIndex++) { - if(((*(atCharacterPtr + 0)) == ' ') || ((*(atCharacterPtr + 0)) == '\t')) { continue; } - if(jk_parse_skip_newline(parseState)) { continue; } - if(parseState->parseOptionFlags & JKParseOptionComments) { - if((JK_EXPECT_F((*(atCharacterPtr + 0)) == '/')) && (JK_EXPECT_T((atCharacterPtr + 1) < endOfStringPtr))) { - if((*(atCharacterPtr + 1)) == '/') { - parseState->atIndex++; - for(atCharacterPtr = JK_AT_STRING_PTR(parseState); (JK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr)); parseState->atIndex++) { if(jk_parse_skip_newline(parseState)) { break; } } - continue; - } - if((*(atCharacterPtr + 1)) == '*') { - parseState->atIndex++; - for(atCharacterPtr = JK_AT_STRING_PTR(parseState); (JK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr)); parseState->atIndex++) { - if(jk_parse_skip_newline(parseState)) { continue; } - if(((*(atCharacterPtr + 0)) == '*') && (((atCharacterPtr + 1) < endOfStringPtr) && ((*(atCharacterPtr + 1)) == '/'))) { parseState->atIndex++; break; } - } - continue; - } - } - } - break; - } -#endif -} - -static int jk_parse_next_token(JKParseState *parseState) { - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *atCharacterPtr = NULL; - const unsigned char *endOfStringPtr = JK_END_STRING_PTR(parseState); - unsigned char currentCharacter = 0U; - int stopParsing = 0; - - parseState->prev_atIndex = parseState->atIndex; - parseState->prev_lineNumber = parseState->lineNumber; - parseState->prev_lineStartIndex = parseState->lineStartIndex; - - jk_parse_skip_whitespace(parseState); - - if((JK_AT_STRING_PTR(parseState) == endOfStringPtr)) { stopParsing = 1; } - - if((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr))) { - currentCharacter = *atCharacterPtr; - - if(JK_EXPECT_T(currentCharacter == '"')) { if(JK_EXPECT_T((stopParsing = jk_parse_string(parseState)) == 0)) { jk_set_parsed_token(parseState, parseState->token.tokenPtrRange.ptr, parseState->token.tokenPtrRange.length, JKTokenTypeString, 0UL); } } - else if(JK_EXPECT_T(currentCharacter == ':')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeSeparator, 1UL); } - else if(JK_EXPECT_T(currentCharacter == ',')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeComma, 1UL); } - else if((JK_EXPECT_T(currentCharacter >= '0') && JK_EXPECT_T(currentCharacter <= '9')) || JK_EXPECT_T(currentCharacter == '-')) { if(JK_EXPECT_T((stopParsing = jk_parse_number(parseState)) == 0)) { jk_set_parsed_token(parseState, parseState->token.tokenPtrRange.ptr, parseState->token.tokenPtrRange.length, JKTokenTypeNumber, 0UL); } } - else if(JK_EXPECT_T(currentCharacter == '{')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeObjectBegin, 1UL); } - else if(JK_EXPECT_T(currentCharacter == '}')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeObjectEnd, 1UL); } - else if(JK_EXPECT_T(currentCharacter == '[')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeArrayBegin, 1UL); } - else if(JK_EXPECT_T(currentCharacter == ']')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeArrayEnd, 1UL); } - - else if(JK_EXPECT_T(currentCharacter == 't')) { if(!((JK_EXPECT_T((atCharacterPtr + 4UL) < endOfStringPtr)) && (JK_EXPECT_T(atCharacterPtr[1] == 'r')) && (JK_EXPECT_T(atCharacterPtr[2] == 'u')) && (JK_EXPECT_T(atCharacterPtr[3] == 'e')))) { stopParsing = 1; /* XXX Add error message */ } else { jk_set_parsed_token(parseState, atCharacterPtr, 4UL, JKTokenTypeTrue, 4UL); } } - else if(JK_EXPECT_T(currentCharacter == 'f')) { if(!((JK_EXPECT_T((atCharacterPtr + 5UL) < endOfStringPtr)) && (JK_EXPECT_T(atCharacterPtr[1] == 'a')) && (JK_EXPECT_T(atCharacterPtr[2] == 'l')) && (JK_EXPECT_T(atCharacterPtr[3] == 's')) && (JK_EXPECT_T(atCharacterPtr[4] == 'e')))) { stopParsing = 1; /* XXX Add error message */ } else { jk_set_parsed_token(parseState, atCharacterPtr, 5UL, JKTokenTypeFalse, 5UL); } } - else if(JK_EXPECT_T(currentCharacter == 'n')) { if(!((JK_EXPECT_T((atCharacterPtr + 4UL) < endOfStringPtr)) && (JK_EXPECT_T(atCharacterPtr[1] == 'u')) && (JK_EXPECT_T(atCharacterPtr[2] == 'l')) && (JK_EXPECT_T(atCharacterPtr[3] == 'l')))) { stopParsing = 1; /* XXX Add error message */ } else { jk_set_parsed_token(parseState, atCharacterPtr, 4UL, JKTokenTypeNull, 4UL); } } - else { stopParsing = 1; /* XXX Add error message */ } - } - - if(JK_EXPECT_F(stopParsing)) { jk_error(parseState, @"Unexpected token, wanted '{', '}', '[', ']', ',', ':', 'true', 'false', 'null', '\"STRING\"', 'NUMBER'."); } - return(stopParsing); -} - -static void jk_error_parse_accept_or3(JKParseState *parseState, int state, NSString *or1String, NSString *or2String, NSString *or3String) { - NSString *acceptStrings[16]; - int acceptIdx = 0; - if(state & JKParseAcceptValue) { acceptStrings[acceptIdx++] = or1String; } - if(state & JKParseAcceptComma) { acceptStrings[acceptIdx++] = or2String; } - if(state & JKParseAcceptEnd) { acceptStrings[acceptIdx++] = or3String; } - if(acceptIdx == 1) { jk_error(parseState, @"Expected %@, not '%*.*s'", acceptStrings[0], (int)parseState->token.tokenPtrRange.length, (int)parseState->token.tokenPtrRange.length, parseState->token.tokenPtrRange.ptr); } - else if(acceptIdx == 2) { jk_error(parseState, @"Expected %@ or %@, not '%*.*s'", acceptStrings[0], acceptStrings[1], (int)parseState->token.tokenPtrRange.length, (int)parseState->token.tokenPtrRange.length, parseState->token.tokenPtrRange.ptr); } - else if(acceptIdx == 3) { jk_error(parseState, @"Expected %@, %@, or %@, not '%*.*s", acceptStrings[0], acceptStrings[1], acceptStrings[2], (int)parseState->token.tokenPtrRange.length, (int)parseState->token.tokenPtrRange.length, parseState->token.tokenPtrRange.ptr); } -} - -static void *jk_parse_array(JKParseState *parseState) { - size_t startingObjectIndex = parseState->objectStack.index; - int arrayState = JKParseAcceptValueOrEnd, stopParsing = 0; - void *parsedArray = NULL; - - while(JK_EXPECT_T((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T(parseState->atIndex < parseState->stringBuffer.bytes.length)))) { - if(JK_EXPECT_F(parseState->objectStack.index > (parseState->objectStack.count - 4UL))) { if(jk_objectStack_resize(&parseState->objectStack, parseState->objectStack.count + 128UL)) { jk_error(parseState, @"Internal error: [array] objectsIndex > %zu, resize failed? %@ line %#ld", (parseState->objectStack.count - 4UL), [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; } } - - if(JK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0)) { - void *object = NULL; -#ifndef NS_BLOCK_ASSERTIONS - parseState->objectStack.objects[parseState->objectStack.index] = NULL; - parseState->objectStack.keys [parseState->objectStack.index] = NULL; -#endif - switch(parseState->token.type) { - case JKTokenTypeNumber: - case JKTokenTypeString: - case JKTokenTypeTrue: - case JKTokenTypeFalse: - case JKTokenTypeNull: - case JKTokenTypeArrayBegin: - case JKTokenTypeObjectBegin: - if(JK_EXPECT_F((arrayState & JKParseAcceptValue) == 0)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected value."); stopParsing = 1; break; } - if(JK_EXPECT_F((object = jk_object_for_token(parseState)) == NULL)) { jk_error(parseState, @"Internal error: Object == NULL"); stopParsing = 1; break; } else { parseState->objectStack.objects[parseState->objectStack.index++] = object; arrayState = JKParseAcceptCommaOrEnd; } - break; - case JKTokenTypeArrayEnd: if(JK_EXPECT_T(arrayState & JKParseAcceptEnd)) { NSCParameterAssert(parseState->objectStack.index >= startingObjectIndex); parsedArray = (void *)_JKArrayCreate((id *)&parseState->objectStack.objects[startingObjectIndex], (parseState->objectStack.index - startingObjectIndex), parseState->mutableCollections); } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected ']'."); } stopParsing = 1; break; - case JKTokenTypeComma: if(JK_EXPECT_T(arrayState & JKParseAcceptComma)) { arrayState = JKParseAcceptValue; } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected ','."); stopParsing = 1; } break; - default: parseState->errorIsPrev = 1; jk_error_parse_accept_or3(parseState, arrayState, @"a value", @"a comma", @"a ']'"); stopParsing = 1; break; - } - } - } - - if(JK_EXPECT_F(parsedArray == NULL)) { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { if(parseState->objectStack.objects[idx] != NULL) { CFRelease(parseState->objectStack.objects[idx]); parseState->objectStack.objects[idx] = NULL; } } } -#if !defined(NS_BLOCK_ASSERTIONS) - else { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { parseState->objectStack.objects[idx] = NULL; parseState->objectStack.keys[idx] = NULL; } } -#endif - - parseState->objectStack.index = startingObjectIndex; - return(parsedArray); -} - -static void *jk_create_dictionary(JKParseState *parseState, size_t startingObjectIndex) { - void *parsedDictionary = NULL; - - parseState->objectStack.index--; - - parsedDictionary = _JKDictionaryCreate((id *)&parseState->objectStack.keys[startingObjectIndex], (NSUInteger *)&parseState->objectStack.cfHashes[startingObjectIndex], (id *)&parseState->objectStack.objects[startingObjectIndex], (parseState->objectStack.index - startingObjectIndex), parseState->mutableCollections); - - return(parsedDictionary); -} - -static void *jk_parse_dictionary(JKParseState *parseState) { - size_t startingObjectIndex = parseState->objectStack.index; - int dictState = JKParseAcceptValueOrEnd, stopParsing = 0; - void *parsedDictionary = NULL; - - while(JK_EXPECT_T((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T(parseState->atIndex < parseState->stringBuffer.bytes.length)))) { - if(JK_EXPECT_F(parseState->objectStack.index > (parseState->objectStack.count - 4UL))) { if(jk_objectStack_resize(&parseState->objectStack, parseState->objectStack.count + 128UL)) { jk_error(parseState, @"Internal error: [dictionary] objectsIndex > %zu, resize failed? %@ line #%ld", (parseState->objectStack.count - 4UL), [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; } } - - size_t objectStackIndex = parseState->objectStack.index++; - parseState->objectStack.keys[objectStackIndex] = NULL; - parseState->objectStack.objects[objectStackIndex] = NULL; - void *key = NULL, *object = NULL; - - if(JK_EXPECT_T((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0)))) { - switch(parseState->token.type) { - case JKTokenTypeString: - if(JK_EXPECT_F((dictState & JKParseAcceptValue) == 0)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected string."); stopParsing = 1; break; } - if(JK_EXPECT_F((key = jk_object_for_token(parseState)) == NULL)) { jk_error(parseState, @"Internal error: Key == NULL."); stopParsing = 1; break; } - else { - parseState->objectStack.keys[objectStackIndex] = key; - if(JK_EXPECT_T(parseState->token.value.cacheItem != NULL)) { if(JK_EXPECT_F(parseState->token.value.cacheItem->cfHash == 0UL)) { parseState->token.value.cacheItem->cfHash = CFHash(key); } parseState->objectStack.cfHashes[objectStackIndex] = parseState->token.value.cacheItem->cfHash; } - else { parseState->objectStack.cfHashes[objectStackIndex] = CFHash(key); } - } - break; - - case JKTokenTypeObjectEnd: if((JK_EXPECT_T(dictState & JKParseAcceptEnd))) { NSCParameterAssert(parseState->objectStack.index >= startingObjectIndex); parsedDictionary = jk_create_dictionary(parseState, startingObjectIndex); } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected '}'."); } stopParsing = 1; break; - case JKTokenTypeComma: if((JK_EXPECT_T(dictState & JKParseAcceptComma))) { dictState = JKParseAcceptValue; parseState->objectStack.index--; continue; } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected ','."); stopParsing = 1; } break; - - default: parseState->errorIsPrev = 1; jk_error_parse_accept_or3(parseState, dictState, @"a \"STRING\"", @"a comma", @"a '}'"); stopParsing = 1; break; - } - } - - if(JK_EXPECT_T(stopParsing == 0)) { - if(JK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0)) { if(JK_EXPECT_F(parseState->token.type != JKTokenTypeSeparator)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Expected ':'."); stopParsing = 1; } } - } - - if((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0))) { - switch(parseState->token.type) { - case JKTokenTypeNumber: - case JKTokenTypeString: - case JKTokenTypeTrue: - case JKTokenTypeFalse: - case JKTokenTypeNull: - case JKTokenTypeArrayBegin: - case JKTokenTypeObjectBegin: - if(JK_EXPECT_F((dictState & JKParseAcceptValue) == 0)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected value."); stopParsing = 1; break; } - if(JK_EXPECT_F((object = jk_object_for_token(parseState)) == NULL)) { jk_error(parseState, @"Internal error: Object == NULL."); stopParsing = 1; break; } else { parseState->objectStack.objects[objectStackIndex] = object; dictState = JKParseAcceptCommaOrEnd; } - break; - default: parseState->errorIsPrev = 1; jk_error_parse_accept_or3(parseState, dictState, @"a value", @"a comma", @"a '}'"); stopParsing = 1; break; - } - } - } - - if(JK_EXPECT_F(parsedDictionary == NULL)) { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { if(parseState->objectStack.keys[idx] != NULL) { CFRelease(parseState->objectStack.keys[idx]); parseState->objectStack.keys[idx] = NULL; } if(parseState->objectStack.objects[idx] != NULL) { CFRelease(parseState->objectStack.objects[idx]); parseState->objectStack.objects[idx] = NULL; } } } -#if !defined(NS_BLOCK_ASSERTIONS) - else { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { parseState->objectStack.objects[idx] = NULL; parseState->objectStack.keys[idx] = NULL; } } -#endif - - parseState->objectStack.index = startingObjectIndex; - return(parsedDictionary); -} - -static id json_parse_it(JKParseState *parseState) { - id parsedObject = NULL; - int stopParsing = 0; - - while((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T(parseState->atIndex < parseState->stringBuffer.bytes.length))) { - if((JK_EXPECT_T(stopParsing == 0)) && (JK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0))) { - switch(parseState->token.type) { - case JKTokenTypeArrayBegin: - case JKTokenTypeObjectBegin: parsedObject = [(id)jk_object_for_token(parseState) autorelease]; stopParsing = 1; break; - default: jk_error(parseState, @"Expected either '[' or '{'."); stopParsing = 1; break; - } - } - } - - NSCParameterAssert((parseState->objectStack.index == 0) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - - if((parsedObject == NULL) && (JK_AT_STRING_PTR(parseState) == JK_END_STRING_PTR(parseState))) { jk_error(parseState, @"Reached the end of the buffer."); } - if(parsedObject == NULL) { jk_error(parseState, @"Unable to parse JSON."); } - - if((parsedObject != NULL) && (JK_AT_STRING_PTR(parseState) < JK_END_STRING_PTR(parseState))) { - jk_parse_skip_whitespace(parseState); - if((parsedObject != NULL) && ((parseState->parseOptionFlags & JKParseOptionPermitTextAfterValidJSON) == 0) && (JK_AT_STRING_PTR(parseState) < JK_END_STRING_PTR(parseState))) { - jk_error(parseState, @"A valid JSON object was parsed but there were additional non-white-space characters remaining."); - parsedObject = NULL; - } - } - - return(parsedObject); -} - -//////////// -#pragma mark - -#pragma mark Object cache - -// This uses a Galois Linear Feedback Shift Register (LFSR) PRNG to pick which item in the cache to age. It has a period of (2^32)-1. -// NOTE: A LFSR *MUST* be initialized to a non-zero value and must always have a non-zero value. The LFSR is initalized to 1 in -initWithParseOptions: -JK_STATIC_INLINE void jk_cache_age(JKParseState *parseState) { - NSCParameterAssert((parseState != NULL) && (parseState->cache.prng_lfsr != 0U)); - parseState->cache.prng_lfsr = (parseState->cache.prng_lfsr >> 1) ^ ((0U - (parseState->cache.prng_lfsr & 1U)) & 0x80200003U); - parseState->cache.age[parseState->cache.prng_lfsr & (parseState->cache.count - 1UL)] >>= 1; -} - -// The object cache is nothing more than a hash table with open addressing collision resolution that is bounded by JK_CACHE_PROBES attempts. -// -// The hash table is a linear C array of JKTokenCacheItem. The terms "item" and "bucket" are synonymous with the index in to the cache array, i.e. cache.items[bucket]. -// -// Items in the cache have an age associated with them. An items age is incremented using saturating unsigned arithmetic and decremeted using unsigned right shifts. -// Thus, an items age is managed using an AIMD policy- additive increase, multiplicative decrease. All age calculations and manipulations are branchless. -// The primitive C type MUST be unsigned. It is currently a "char", which allows (at a minimum and in practice) 8 bits. -// -// A "useable bucket" is a bucket that is not in use (never populated), or has an age == 0. -// -// When an item is found in the cache, it's age is incremented. -// If a useable bucket hasn't been found, the current item (bucket) is aged along with two random items. -// -// If a value is not found in the cache, and no useable bucket has been found, that value is not added to the cache. - -static void *jk_cachedObjects(JKParseState *parseState) { - unsigned long bucket = parseState->token.value.hash & (parseState->cache.count - 1UL), setBucket = 0UL, useableBucket = 0UL, x = 0UL; - void *parsedAtom = NULL; - - if(JK_EXPECT_F(parseState->token.value.ptrRange.length == 0UL) && JK_EXPECT_T(parseState->token.value.type == JKValueTypeString)) { return(@""); } - - for(x = 0UL; x < JK_CACHE_PROBES; x++) { - if(JK_EXPECT_F(parseState->cache.items[bucket].object == NULL)) { setBucket = 1UL; useableBucket = bucket; break; } - - if((JK_EXPECT_T(parseState->cache.items[bucket].hash == parseState->token.value.hash)) && (JK_EXPECT_T(parseState->cache.items[bucket].size == parseState->token.value.ptrRange.length)) && (JK_EXPECT_T(parseState->cache.items[bucket].type == parseState->token.value.type)) && (JK_EXPECT_T(parseState->cache.items[bucket].bytes != NULL)) && (JK_EXPECT_T(memcmp(parseState->cache.items[bucket].bytes, parseState->token.value.ptrRange.ptr, parseState->token.value.ptrRange.length) == 0U))) { - parseState->cache.age[bucket] = (((uint32_t)parseState->cache.age[bucket]) + 1U) - (((((uint32_t)parseState->cache.age[bucket]) + 1U) >> 31) ^ 1U); - parseState->token.value.cacheItem = &parseState->cache.items[bucket]; - NSCParameterAssert(parseState->cache.items[bucket].object != NULL); - return((void *)CFRetain(parseState->cache.items[bucket].object)); - } else { - if(JK_EXPECT_F(setBucket == 0UL) && JK_EXPECT_F(parseState->cache.age[bucket] == 0U)) { setBucket = 1UL; useableBucket = bucket; } - if(JK_EXPECT_F(setBucket == 0UL)) { parseState->cache.age[bucket] >>= 1; jk_cache_age(parseState); jk_cache_age(parseState); } - // This is the open addressing function. The values length and type are used as a form of "double hashing" to distribute values with the same effective value hash across different object cache buckets. - // The values type is a prime number that is relatively coprime to the other primes in the set of value types and the number of hash table buckets. - bucket = (parseState->token.value.hash + (parseState->token.value.ptrRange.length * (x + 1UL)) + (parseState->token.value.type * (x + 1UL)) + (3UL * (x + 1UL))) & (parseState->cache.count - 1UL); - } - } - - switch(parseState->token.value.type) { - case JKValueTypeString: parsedAtom = (void *)CFStringCreateWithBytes(NULL, parseState->token.value.ptrRange.ptr, parseState->token.value.ptrRange.length, kCFStringEncodingUTF8, 0); break; - case JKValueTypeLongLong: parsedAtom = (void *)CFNumberCreate(NULL, kCFNumberLongLongType, &parseState->token.value.number.longLongValue); break; - case JKValueTypeUnsignedLongLong: - if(parseState->token.value.number.unsignedLongLongValue <= LLONG_MAX) { parsedAtom = (void *)CFNumberCreate(NULL, kCFNumberLongLongType, &parseState->token.value.number.unsignedLongLongValue); } - else { parsedAtom = (void *)parseState->objCImpCache.NSNumberInitWithUnsignedLongLong(parseState->objCImpCache.NSNumberAlloc(parseState->objCImpCache.NSNumberClass, @selector(alloc)), @selector(initWithUnsignedLongLong:), parseState->token.value.number.unsignedLongLongValue); } - break; - case JKValueTypeDouble: parsedAtom = (void *)CFNumberCreate(NULL, kCFNumberDoubleType, &parseState->token.value.number.doubleValue); break; - default: jk_error(parseState, @"Internal error: Unknown token value type. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; - } - - if(JK_EXPECT_T(setBucket) && (JK_EXPECT_T(parsedAtom != NULL))) { - bucket = useableBucket; - if(JK_EXPECT_T((parseState->cache.items[bucket].object != NULL))) { CFRelease(parseState->cache.items[bucket].object); parseState->cache.items[bucket].object = NULL; } - - if(JK_EXPECT_T((parseState->cache.items[bucket].bytes = (unsigned char *)reallocf(parseState->cache.items[bucket].bytes, parseState->token.value.ptrRange.length)) != NULL)) { - memcpy(parseState->cache.items[bucket].bytes, parseState->token.value.ptrRange.ptr, parseState->token.value.ptrRange.length); - parseState->cache.items[bucket].object = (void *)CFRetain(parsedAtom); - parseState->cache.items[bucket].hash = parseState->token.value.hash; - parseState->cache.items[bucket].cfHash = 0UL; - parseState->cache.items[bucket].size = parseState->token.value.ptrRange.length; - parseState->cache.items[bucket].type = parseState->token.value.type; - parseState->token.value.cacheItem = &parseState->cache.items[bucket]; - parseState->cache.age[bucket] = JK_INIT_CACHE_AGE; - } else { // The realloc failed, so clear the appropriate fields. - parseState->cache.items[bucket].hash = 0UL; - parseState->cache.items[bucket].cfHash = 0UL; - parseState->cache.items[bucket].size = 0UL; - parseState->cache.items[bucket].type = 0UL; - } - } - - return(parsedAtom); -} - - -static void *jk_object_for_token(JKParseState *parseState) { - void *parsedAtom = NULL; - - parseState->token.value.cacheItem = NULL; - switch(parseState->token.type) { - case JKTokenTypeString: parsedAtom = jk_cachedObjects(parseState); break; - case JKTokenTypeNumber: parsedAtom = jk_cachedObjects(parseState); break; - case JKTokenTypeObjectBegin: parsedAtom = jk_parse_dictionary(parseState); break; - case JKTokenTypeArrayBegin: parsedAtom = jk_parse_array(parseState); break; - case JKTokenTypeTrue: parsedAtom = (void *)kCFBooleanTrue; break; - case JKTokenTypeFalse: parsedAtom = (void *)kCFBooleanFalse; break; - case JKTokenTypeNull: parsedAtom = (void *)kCFNull; break; - default: jk_error(parseState, @"Internal error: Unknown token type. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; - } - - return(parsedAtom); -} - -#pragma mark - -@implementation JSONDecoder - -+ (id)decoder -{ - return([self decoderWithParseOptions:JKParseOptionStrict]); -} - -+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags -{ - return([[[self alloc] initWithParseOptions:parseOptionFlags] autorelease]); -} - -- (id)init -{ - return([self initWithParseOptions:JKParseOptionStrict]); -} - -- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags -{ - if((self = [super init]) == NULL) { return(NULL); } - - if(parseOptionFlags & ~JKParseOptionValidFlags) { [self autorelease]; [NSException raise:NSInvalidArgumentException format:@"Invalid parse options."]; } - - if((parseState = (JKParseState *)calloc(1UL, sizeof(JKParseState))) == NULL) { goto errorExit; } - - parseState->parseOptionFlags = parseOptionFlags; - - parseState->token.tokenBuffer.roundSizeUpToMultipleOf = 4096UL; - parseState->objectStack.roundSizeUpToMultipleOf = 2048UL; - - parseState->objCImpCache.NSNumberClass = _jk_NSNumberClass; - parseState->objCImpCache.NSNumberAlloc = _jk_NSNumberAllocImp; - parseState->objCImpCache.NSNumberInitWithUnsignedLongLong = _jk_NSNumberInitWithUnsignedLongLongImp; - - parseState->cache.prng_lfsr = 1U; - parseState->cache.count = JK_CACHE_SLOTS; - if((parseState->cache.items = (JKTokenCacheItem *)calloc(1UL, sizeof(JKTokenCacheItem) * parseState->cache.count)) == NULL) { goto errorExit; } - - return(self); - - errorExit: - if(self) { [self autorelease]; self = NULL; } - return(NULL); -} - -// This is here primarily to support the NSString and NSData convenience functions so the autoreleased JSONDecoder can release most of its resources before the pool pops. -static void _JSONDecoderCleanup(JSONDecoder *decoder) { - if((decoder != NULL) && (decoder->parseState != NULL)) { - jk_managedBuffer_release(&decoder->parseState->token.tokenBuffer); - jk_objectStack_release(&decoder->parseState->objectStack); - - [decoder clearCache]; - if(decoder->parseState->cache.items != NULL) { free(decoder->parseState->cache.items); decoder->parseState->cache.items = NULL; } - - free(decoder->parseState); decoder->parseState = NULL; - } -} - -- (void)dealloc -{ - _JSONDecoderCleanup(self); - [super dealloc]; -} - -- (void)clearCache -{ - if(JK_EXPECT_T(parseState != NULL)) { - if(JK_EXPECT_T(parseState->cache.items != NULL)) { - size_t idx = 0UL; - for(idx = 0UL; idx < parseState->cache.count; idx++) { - if(JK_EXPECT_T(parseState->cache.items[idx].object != NULL)) { CFRelease(parseState->cache.items[idx].object); parseState->cache.items[idx].object = NULL; } - if(JK_EXPECT_T(parseState->cache.items[idx].bytes != NULL)) { free(parseState->cache.items[idx].bytes); parseState->cache.items[idx].bytes = NULL; } - memset(&parseState->cache.items[idx], 0, sizeof(JKTokenCacheItem)); - parseState->cache.age[idx] = 0U; - } - } - } -} - -// This needs to be completely rewritten. -static id _JKParseUTF8String(JKParseState *parseState, BOOL mutableCollections, const unsigned char *string, size_t length, NSError **error) { - NSCParameterAssert((parseState != NULL) && (string != NULL) && (parseState->cache.prng_lfsr != 0U)); - parseState->stringBuffer.bytes.ptr = string; - parseState->stringBuffer.bytes.length = length; - parseState->atIndex = 0UL; - parseState->lineNumber = 1UL; - parseState->lineStartIndex = 0UL; - parseState->prev_atIndex = 0UL; - parseState->prev_lineNumber = 1UL; - parseState->prev_lineStartIndex = 0UL; - parseState->error = NULL; - parseState->errorIsPrev = 0; - parseState->mutableCollections = (mutableCollections == NO) ? NO : YES; - - unsigned char stackTokenBuffer[JK_TOKENBUFFER_SIZE] JK_ALIGNED(64); - jk_managedBuffer_setToStackBuffer(&parseState->token.tokenBuffer, stackTokenBuffer, sizeof(stackTokenBuffer)); - - void *stackObjects [JK_STACK_OBJS] JK_ALIGNED(64); - void *stackKeys [JK_STACK_OBJS] JK_ALIGNED(64); - CFHashCode stackCFHashes[JK_STACK_OBJS] JK_ALIGNED(64); - jk_objectStack_setToStackBuffer(&parseState->objectStack, stackObjects, stackKeys, stackCFHashes, JK_STACK_OBJS); - - id parsedJSON = json_parse_it(parseState); - - if((error != NULL) && (parseState->error != NULL)) { *error = parseState->error; } - - jk_managedBuffer_release(&parseState->token.tokenBuffer); - jk_objectStack_release(&parseState->objectStack); - - parseState->stringBuffer.bytes.ptr = NULL; - parseState->stringBuffer.bytes.length = 0UL; - parseState->atIndex = 0UL; - parseState->lineNumber = 1UL; - parseState->lineStartIndex = 0UL; - parseState->prev_atIndex = 0UL; - parseState->prev_lineNumber = 1UL; - parseState->prev_lineStartIndex = 0UL; - parseState->error = NULL; - parseState->errorIsPrev = 0; - parseState->mutableCollections = NO; - - return(parsedJSON); -} - -//////////// -#pragma mark Deprecated as of v1.4 -//////////// - -// Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length -{ - return([self objectWithUTF8String:string length:length error:NULL]); -} - -// Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error -{ - return([self objectWithUTF8String:string length:length error:error]); -} - -// Deprecated in JSONKit v1.4. Use objectWithData: instead. -- (id)parseJSONData:(NSData *)jsonData -{ - return([self objectWithData:jsonData error:NULL]); -} - -// Deprecated in JSONKit v1.4. Use objectWithData:error: instead. -- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error -{ - return([self objectWithData:jsonData error:error]); -} - -//////////// -#pragma mark Methods that return immutable collection objects -//////////// - -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length -{ - return([self objectWithUTF8String:string length:length error:NULL]); -} - -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error -{ - if(parseState == NULL) { [NSException raise:NSInternalInconsistencyException format:@"parseState is NULL."]; } - if(string == NULL) { [NSException raise:NSInvalidArgumentException format:@"The string argument is NULL."]; } - - return(_JKParseUTF8String(parseState, NO, string, (size_t)length, error)); -} - -- (id)objectWithData:(NSData *)jsonData -{ - return([self objectWithData:jsonData error:NULL]); -} - -- (id)objectWithData:(NSData *)jsonData error:(NSError **)error -{ - if(jsonData == NULL) { [NSException raise:NSInvalidArgumentException format:@"The jsonData argument is NULL."]; } - return([self objectWithUTF8String:(const unsigned char *)[jsonData bytes] length:[jsonData length] error:error]); -} - -//////////// -#pragma mark Methods that return mutable collection objects -//////////// - -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length -{ - return([self mutableObjectWithUTF8String:string length:length error:NULL]); -} - -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error -{ - if(parseState == NULL) { [NSException raise:NSInternalInconsistencyException format:@"parseState is NULL."]; } - if(string == NULL) { [NSException raise:NSInvalidArgumentException format:@"The string argument is NULL."]; } - - return(_JKParseUTF8String(parseState, YES, string, (size_t)length, error)); -} - -- (id)mutableObjectWithData:(NSData *)jsonData -{ - return([self mutableObjectWithData:jsonData error:NULL]); -} - -- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error -{ - if(jsonData == NULL) { [NSException raise:NSInvalidArgumentException format:@"The jsonData argument is NULL."]; } - return([self mutableObjectWithUTF8String:(const unsigned char *)[jsonData bytes] length:[jsonData length] error:error]); -} - -@end - -/* - The NSString and NSData convenience methods need a little bit of explanation. - - Prior to JSONKit v1.4, the NSString -objectFromJSONStringWithParseOptions:error: method looked like - - const unsigned char *utf8String = (const unsigned char *)[self UTF8String]; - if(utf8String == NULL) { return(NULL); } - size_t utf8Length = strlen((const char *)utf8String); - return([[JSONDecoder decoderWithParseOptions:parseOptionFlags] parseUTF8String:utf8String length:utf8Length error:error]); - - This changed with v1.4 to a more complicated method. The reason for this is to keep the amount of memory that is - allocated, but not yet freed because it is dependent on the autorelease pool to pop before it can be reclaimed. - - In the simpler v1.3 code, this included all the bytes used to store the -UTF8String along with the JSONDecoder and all its overhead. - - Now we use an autoreleased CFMutableData that is sized to the UTF8 length of the NSString in question and is used to hold the UTF8 - conversion of said string. - - Once parsed, the CFMutableData has its length set to 0. This should, hopefully, allow the CFMutableData to realloc and/or free - the buffer. - - Another change made was a slight modification to JSONDecoder so that most of the cleanup work that was done in -dealloc was moved - to a private, internal function. These convenience routines keep the pointer to the autoreleased JSONDecoder and calls - _JSONDecoderCleanup() to early release the decoders resources since we already know that particular decoder is not going to be used - again. - - If everything goes smoothly, this will most likely result in perhaps a few hundred bytes that are allocated but waiting for the - autorelease pool to pop. This is compared to the thousands and easily hundreds of thousands of bytes that would have been in - autorelease limbo. It's more complicated for us, but a win for the user. - - Autorelease objects are used in case things don't go smoothly. By having them autoreleased, we effectively guarantee that our - requirement to -release the object is always met, not matter what goes wrong. The downside is having a an object or two in - autorelease limbo, but we've done our best to minimize that impact, so it all balances out. - */ - -@implementation NSString (JSONKitDeserializing) - -static id _NSStringObjectFromJSONString(NSString *jsonString, JKParseOptionFlags parseOptionFlags, NSError **error, BOOL mutableCollection) { - id returnObject = NULL; - CFMutableDataRef mutableData = NULL; - JSONDecoder *decoder = NULL; - - CFIndex stringLength = CFStringGetLength((CFStringRef)jsonString); - NSUInteger stringUTF8Length = [jsonString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - - if((mutableData = (CFMutableDataRef)[(id)CFDataCreateMutable(NULL, (NSUInteger)stringUTF8Length) autorelease]) != NULL) { - UInt8 *utf8String = CFDataGetMutableBytePtr(mutableData); - CFIndex usedBytes = 0L, convertedCount = 0L; - - convertedCount = CFStringGetBytes((CFStringRef)jsonString, CFRangeMake(0L, stringLength), kCFStringEncodingUTF8, '?', NO, utf8String, (NSUInteger)stringUTF8Length, &usedBytes); - if(JK_EXPECT_F(convertedCount != stringLength) || JK_EXPECT_F(usedBytes < 0L)) { if(error != NULL) { *error = [NSError errorWithDomain:@"JKErrorDomain" code:-1L userInfo:[NSDictionary dictionaryWithObject:@"An error occurred converting the contents of a NSString to UTF8." forKey:NSLocalizedDescriptionKey]]; } goto exitNow; } - - if(mutableCollection == NO) { returnObject = [(decoder = [JSONDecoder decoderWithParseOptions:parseOptionFlags]) objectWithUTF8String:(const unsigned char *)utf8String length:(size_t)usedBytes error:error]; } - else { returnObject = [(decoder = [JSONDecoder decoderWithParseOptions:parseOptionFlags]) mutableObjectWithUTF8String:(const unsigned char *)utf8String length:(size_t)usedBytes error:error]; } - } - -exitNow: - if(mutableData != NULL) { CFDataSetLength(mutableData, 0L); } - if(decoder != NULL) { _JSONDecoderCleanup(decoder); } - return(returnObject); -} - -- (id)objectFromJSONString -{ - return([self objectFromJSONStringWithParseOptions:JKParseOptionStrict error:NULL]); -} - -- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags -{ - return([self objectFromJSONStringWithParseOptions:parseOptionFlags error:NULL]); -} - -- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error -{ - return(_NSStringObjectFromJSONString(self, parseOptionFlags, error, NO)); -} - - -- (id)mutableObjectFromJSONString -{ - return([self mutableObjectFromJSONStringWithParseOptions:JKParseOptionStrict error:NULL]); -} - -- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags -{ - return([self mutableObjectFromJSONStringWithParseOptions:parseOptionFlags error:NULL]); -} - -- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error -{ - return(_NSStringObjectFromJSONString(self, parseOptionFlags, error, YES)); -} - -@end - -@implementation NSData (JSONKitDeserializing) - -- (id)objectFromJSONData -{ - return([self objectFromJSONDataWithParseOptions:JKParseOptionStrict error:NULL]); -} - -- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags -{ - return([self objectFromJSONDataWithParseOptions:parseOptionFlags error:NULL]); -} - -- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error -{ - JSONDecoder *decoder = NULL; - id returnObject = [(decoder = [JSONDecoder decoderWithParseOptions:parseOptionFlags]) objectWithData:self error:error]; - if(decoder != NULL) { _JSONDecoderCleanup(decoder); } - return(returnObject); -} - -- (id)mutableObjectFromJSONData -{ - return([self mutableObjectFromJSONDataWithParseOptions:JKParseOptionStrict error:NULL]); -} - -- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags -{ - return([self mutableObjectFromJSONDataWithParseOptions:parseOptionFlags error:NULL]); -} - -- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error -{ - JSONDecoder *decoder = NULL; - id returnObject = [(decoder = [JSONDecoder decoderWithParseOptions:parseOptionFlags]) mutableObjectWithData:self error:error]; - if(decoder != NULL) { _JSONDecoderCleanup(decoder); } - return(returnObject); -} - - -@end - -//////////// -#pragma mark - -#pragma mark Encoding / deserializing functions - -static void jk_encode_error(JKEncodeState *encodeState, NSString *format, ...) { - NSCParameterAssert((encodeState != NULL) && (format != NULL)); - - va_list varArgsList; - va_start(varArgsList, format); - NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; - va_end(varArgsList); - - if(encodeState->error == NULL) { - encodeState->error = [NSError errorWithDomain:@"JKErrorDomain" code:-1L userInfo: - [NSDictionary dictionaryWithObjectsAndKeys: - formatString, NSLocalizedDescriptionKey, - NULL]]; - } -} - -JK_STATIC_INLINE void jk_encode_updateCache(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object) { - NSCParameterAssert(encodeState != NULL); - if(JK_EXPECT_T(cacheSlot != NULL)) { - NSCParameterAssert((object != NULL) && (startingAtIndex <= encodeState->atIndex)); - cacheSlot->object = object; - cacheSlot->offset = startingAtIndex; - cacheSlot->length = (size_t)(encodeState->atIndex - startingAtIndex); - } -} - -static int jk_encode_printf(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, ...) { - va_list varArgsList, varArgsListCopy; - va_start(varArgsList, format); - va_copy(varArgsListCopy, varArgsList); - - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (startingAtIndex <= encodeState->atIndex) && (format != NULL)); - - ssize_t formattedStringLength = 0L; - int returnValue = 0; - - if(JK_EXPECT_T((formattedStringLength = vsnprintf((char *)&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex], (encodeState->stringBuffer.bytes.length - encodeState->atIndex), format, varArgsList)) >= (ssize_t)(encodeState->stringBuffer.bytes.length - encodeState->atIndex))) { - NSCParameterAssert(((encodeState->atIndex + (formattedStringLength * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length)); - if(JK_EXPECT_F(((encodeState->atIndex + (formattedStringLength * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length)) && JK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + (formattedStringLength * 2UL)+ 4096UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); returnValue = 1; goto exitNow; } - if(JK_EXPECT_F((formattedStringLength = vsnprintf((char *)&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex], (encodeState->stringBuffer.bytes.length - encodeState->atIndex), format, varArgsListCopy)) >= (ssize_t)(encodeState->stringBuffer.bytes.length - encodeState->atIndex))) { jk_encode_error(encodeState, @"vsnprintf failed unexpectedly."); returnValue = 1; goto exitNow; } - } - -exitNow: - va_end(varArgsList); - va_end(varArgsListCopy); - if(JK_EXPECT_T(returnValue == 0)) { encodeState->atIndex += formattedStringLength; jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, object); } - return(returnValue); -} - -static int jk_encode_write(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (startingAtIndex <= encodeState->atIndex) && (format != NULL)); - if(JK_EXPECT_F(((encodeState->atIndex + strlen(format) + 256UL) > encodeState->stringBuffer.bytes.length)) && JK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + strlen(format) + 1024UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - size_t formatIdx = 0UL; - for(formatIdx = 0UL; format[formatIdx] != 0; formatIdx++) { NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[formatIdx]; } - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, object); - return(0); -} - -static int jk_encode_writePrettyPrintWhiteSpace(JKEncodeState *encodeState) { - NSCParameterAssert((encodeState != NULL) && ((encodeState->serializeOptionFlags & JKSerializeOptionPretty) != 0UL)); - if(JK_EXPECT_F((encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 16UL) > encodeState->stringBuffer.bytes.length) && JK_EXPECT_T(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 4096UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\n'; - size_t depthWhiteSpace = 0UL; - for(depthWhiteSpace = 0UL; depthWhiteSpace < (encodeState->depth * 2UL); depthWhiteSpace++) { NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = ' '; } - return(0); -} - -static int jk_encode_write1slow(JKEncodeState *encodeState, ssize_t depthChange, const char *format) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (format != NULL) && ((depthChange >= -1L) && (depthChange <= 1L)) && ((encodeState->depth == 0UL) ? (depthChange >= 0L) : 1) && ((encodeState->serializeOptionFlags & JKSerializeOptionPretty) != 0UL)); - if(JK_EXPECT_F((encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 16UL) > encodeState->stringBuffer.bytes.length) && JK_EXPECT_F(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 4096UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - encodeState->depth += depthChange; - if(JK_EXPECT_T(format[0] == ':')) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[0]; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = ' '; } - else { - if(JK_EXPECT_F(depthChange == -1L)) { if(JK_EXPECT_F(jk_encode_writePrettyPrintWhiteSpace(encodeState))) { return(1); } } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[0]; - if(JK_EXPECT_T(depthChange != -1L)) { if(JK_EXPECT_F(jk_encode_writePrettyPrintWhiteSpace(encodeState))) { return(1); } } - } - NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); - return(0); -} - -static int jk_encode_write1fast(JKEncodeState *encodeState, ssize_t depthChange JK_UNUSED_ARG, const char *format) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && ((encodeState->serializeOptionFlags & JKSerializeOptionPretty) == 0UL)); - if(JK_EXPECT_T((encodeState->atIndex + 4UL) < encodeState->stringBuffer.bytes.length)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[0]; } - else { return(jk_encode_write(encodeState, NULL, 0UL, NULL, format)); } - return(0); -} - -static int jk_encode_writen(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, size_t length) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (startingAtIndex <= encodeState->atIndex)); - if(JK_EXPECT_F((encodeState->stringBuffer.bytes.length - encodeState->atIndex) < (length + 4UL))) { if(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + 4096UL + length) == NULL) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } } - memcpy(encodeState->stringBuffer.bytes.ptr + encodeState->atIndex, format, length); - encodeState->atIndex += length; - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, object); - return(0); -} - -JK_STATIC_INLINE JKHash jk_encode_object_hash(void *objectPtr) { - return( ( (((JKHash)objectPtr) >> 21) ^ (((JKHash)objectPtr) >> 9) ) + (((JKHash)objectPtr) >> 4) ); -} - -static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *objectPtr) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (objectPtr != NULL)); - - id object = (id)objectPtr, encodeCacheObject = object; - int isClass = JKClassUnknown; - size_t startingAtIndex = encodeState->atIndex; - - JKHash objectHash = jk_encode_object_hash(objectPtr); - JKEncodeCache *cacheSlot = &encodeState->cache[objectHash % JK_ENCODE_CACHE_SLOTS]; - - if(JK_EXPECT_T(cacheSlot->object == object)) { - NSCParameterAssert((cacheSlot->object != NULL) && - (cacheSlot->offset < encodeState->atIndex) && ((cacheSlot->offset + cacheSlot->length) < encodeState->atIndex) && - (cacheSlot->offset < encodeState->stringBuffer.bytes.length) && ((cacheSlot->offset + cacheSlot->length) < encodeState->stringBuffer.bytes.length) && - ((encodeState->stringBuffer.bytes.ptr + encodeState->atIndex) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length))); - if(JK_EXPECT_F(((encodeState->atIndex + cacheSlot->length + 256UL) > encodeState->stringBuffer.bytes.length)) && JK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + cacheSlot->length + 1024UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - NSCParameterAssert(((encodeState->atIndex + cacheSlot->length) < encodeState->stringBuffer.bytes.length) && - ((encodeState->stringBuffer.bytes.ptr + encodeState->atIndex) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + encodeState->atIndex + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->atIndex))); - memcpy(encodeState->stringBuffer.bytes.ptr + encodeState->atIndex, encodeState->stringBuffer.bytes.ptr + cacheSlot->offset, cacheSlot->length); - encodeState->atIndex += cacheSlot->length; - return(0); - } - - // When we encounter a class that we do not handle, and we have either a delegate or block that the user supplied to format unsupported classes, - // we "re-run" the object check. However, we re-run the object check exactly ONCE. If the user supplies an object that isn't one of the - // supported classes, we fail the second time (i.e., double fault error). - BOOL rerunningAfterClassFormatter = NO; - rerunAfterClassFormatter:; - - // XXX XXX XXX XXX - // - // We need to work around a bug in 10.7, which breaks ABI compatibility with Objective-C going back not just to 10.0, but OpenStep and even NextStep. - // - // It has long been documented that "the very first thing that a pointer to an Objective-C object "points to" is a pointer to that objects class". - // - // This is euphemistically called "tagged pointers". There are a number of highly technical problems with this, most involving long passages from - // the C standard(s). In short, one can make a strong case, couched from the perspective of the C standard(s), that that 10.7 "tagged pointers" are - // fundamentally Wrong and Broken, and should have never been implemented. Assuming those points are glossed over, because the change is very clearly - // breaking ABI compatibility, this should have resulted in a minimum of a "minimum version required" bump in various shared libraries to prevent - // causes code that used to work just fine to suddenly break without warning. - // - // In fact, the C standard says that the hack below is "undefined behavior"- there is no requirement that the 10.7 tagged pointer hack of setting the - // "lower, unused bits" must be preserved when casting the result to an integer type, but this "works" because for most architectures - // `sizeof(long) == sizeof(void *)` and the compiler uses the same representation for both. (note: this is informal, not meant to be - // normative or pedantically correct). - // - // In other words, while this "works" for now, technically the compiler is not obligated to do "what we want", and a later version of the compiler - // is not required in any way to produce the same results or behavior that earlier versions of the compiler did for the statement below. - // - // Fan-fucking-tastic. - // - // Why not just use `object_getClass()`? Because `object->isa` reduces to (typically) a *single* instruction. Calling `object_getClass()` requires - // that the compiler potentially spill registers, establish a function call frame / environment, and finally execute a "jump subroutine" instruction. - // Then, the called subroutine must spend half a dozen instructions in its prolog, however many instructions doing whatever it does, then half a dozen - // instructions in its prolog. One instruction compared to dozens, maybe a hundred instructions. - // - // Yes, that's one to two orders of magnitude difference. Which is compelling in its own right. When going for performance, you're often happy with - // gains in the two to three percent range. - // - // XXX XXX XXX XXX - - - BOOL workAroundMacOSXABIBreakingBug = (JK_EXPECT_F(((NSUInteger)object) & 0x1)) ? YES : NO; - void *objectISA = (JK_EXPECT_F(workAroundMacOSXABIBreakingBug)) ? NULL : *((void **)objectPtr); - if(JK_EXPECT_F(workAroundMacOSXABIBreakingBug)) { goto slowClassLookup; } - - if(JK_EXPECT_T(objectISA == encodeState->fastClassLookup.stringClass)) { isClass = JKClassString; } - else if(JK_EXPECT_T(objectISA == encodeState->fastClassLookup.numberClass)) { isClass = JKClassNumber; } - else if(JK_EXPECT_T(objectISA == encodeState->fastClassLookup.dictionaryClass)) { isClass = JKClassDictionary; } - else if(JK_EXPECT_T(objectISA == encodeState->fastClassLookup.arrayClass)) { isClass = JKClassArray; } - else if(JK_EXPECT_T(objectISA == encodeState->fastClassLookup.nullClass)) { isClass = JKClassNull; } - else { - slowClassLookup: - if(JK_EXPECT_T([object isKindOfClass:[NSString class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.stringClass = objectISA; } isClass = JKClassString; } - else if(JK_EXPECT_T([object isKindOfClass:[NSNumber class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.numberClass = objectISA; } isClass = JKClassNumber; } - else if(JK_EXPECT_T([object isKindOfClass:[NSDictionary class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.dictionaryClass = objectISA; } isClass = JKClassDictionary; } - else if(JK_EXPECT_T([object isKindOfClass:[NSArray class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.arrayClass = objectISA; } isClass = JKClassArray; } - else if(JK_EXPECT_T([object isKindOfClass:[NSNull class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.nullClass = objectISA; } isClass = JKClassNull; } - else { - if((rerunningAfterClassFormatter == NO) && ( -#ifdef __BLOCKS__ - ((encodeState->classFormatterBlock) && ((object = encodeState->classFormatterBlock(object)) != NULL)) || -#endif - ((encodeState->classFormatterIMP) && ((object = encodeState->classFormatterIMP(encodeState->classFormatterDelegate, encodeState->classFormatterSelector, object)) != NULL)) )) { rerunningAfterClassFormatter = YES; goto rerunAfterClassFormatter; } - - if(rerunningAfterClassFormatter == NO) { jk_encode_error(encodeState, @"Unable to serialize object class %@.", NSStringFromClass([encodeCacheObject class])); return(1); } - else { jk_encode_error(encodeState, @"Unable to serialize object class %@ that was returned by the unsupported class formatter. Original object class was %@.", (object == NULL) ? @"NULL" : NSStringFromClass([object class]), NSStringFromClass([encodeCacheObject class])); return(1); } - } - } - - // This is here for the benefit of the optimizer. It allows the optimizer to do loop invariant code motion for the JKClassArray - // and JKClassDictionary cases when printing simple, single characters via jk_encode_write(), which is actually a macro: - // #define jk_encode_write1(es, dc, f) (_jk_encode_prettyPrint ? jk_encode_write1slow(es, dc, f) : jk_encode_write1fast(es, dc, f)) - int _jk_encode_prettyPrint = JK_EXPECT_T((encodeState->serializeOptionFlags & JKSerializeOptionPretty) == 0) ? 0 : 1; - - switch(isClass) { - case JKClassString: - { - { - const unsigned char *cStringPtr = (const unsigned char *)CFStringGetCStringPtr((CFStringRef)object, kCFStringEncodingMacRoman); - if(cStringPtr != NULL) { - const unsigned char *utf8String = cStringPtr; - size_t utf8Idx = 0UL; - - CFIndex stringLength = CFStringGetLength((CFStringRef)object); - if(JK_EXPECT_F(((encodeState->atIndex + (stringLength * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length)) && JK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + (stringLength * 2UL) + 1024UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - if(JK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - for(utf8Idx = 0UL; utf8String[utf8Idx] != 0U; utf8Idx++) { - NSCParameterAssert(((&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex]) - encodeState->stringBuffer.bytes.ptr) < (ssize_t)encodeState->stringBuffer.bytes.length); - NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); - if(JK_EXPECT_F(utf8String[utf8Idx] >= 0x80U)) { encodeState->atIndex = startingAtIndex; goto slowUTF8Path; } - if(JK_EXPECT_F(utf8String[utf8Idx] < 0x20U)) { - switch(utf8String[utf8Idx]) { - case '\b': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'b'; break; - case '\f': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'f'; break; - case '\n': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'n'; break; - case '\r': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'r'; break; - case '\t': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 't'; break; - default: if(JK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x", utf8String[utf8Idx]))) { return(1); } break; - } - } else { - if(JK_EXPECT_F(utf8String[utf8Idx] == '\"') || JK_EXPECT_F(utf8String[utf8Idx] == '\\') || (JK_EXPECT_F(encodeState->serializeOptionFlags & JKSerializeOptionEscapeForwardSlashes) && JK_EXPECT_F(utf8String[utf8Idx] == '/'))) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = utf8String[utf8Idx]; - } - } - NSCParameterAssert((encodeState->atIndex + 1UL) < encodeState->stringBuffer.bytes.length); - if(JK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, encodeCacheObject); - return(0); - } - } - - slowUTF8Path: - { - CFIndex stringLength = CFStringGetLength((CFStringRef)object); - CFIndex maxStringUTF8Length = CFStringGetMaximumSizeForEncoding(stringLength, kCFStringEncodingUTF8) + 32L; - - if(JK_EXPECT_F((size_t)maxStringUTF8Length > encodeState->utf8ConversionBuffer.bytes.length) && JK_EXPECT_F(jk_managedBuffer_resize(&encodeState->utf8ConversionBuffer, maxStringUTF8Length + 1024UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - CFIndex usedBytes = 0L, convertedCount = 0L; - convertedCount = CFStringGetBytes((CFStringRef)object, CFRangeMake(0L, stringLength), kCFStringEncodingUTF8, '?', NO, encodeState->utf8ConversionBuffer.bytes.ptr, encodeState->utf8ConversionBuffer.bytes.length - 16L, &usedBytes); - if(JK_EXPECT_F(convertedCount != stringLength) || JK_EXPECT_F(usedBytes < 0L)) { jk_encode_error(encodeState, @"An error occurred converting the contents of a NSString to UTF8."); return(1); } - - if(JK_EXPECT_F((encodeState->atIndex + (maxStringUTF8Length * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length) && JK_EXPECT_F(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + (maxStringUTF8Length * 2UL) + 1024UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - const unsigned char *utf8String = encodeState->utf8ConversionBuffer.bytes.ptr; - - size_t utf8Idx = 0UL; - if(JK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - for(utf8Idx = 0UL; utf8Idx < (size_t)usedBytes; utf8Idx++) { - NSCParameterAssert(((&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex]) - encodeState->stringBuffer.bytes.ptr) < (ssize_t)encodeState->stringBuffer.bytes.length); - NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); - NSCParameterAssert((CFIndex)utf8Idx < usedBytes); - if(JK_EXPECT_F(utf8String[utf8Idx] < 0x20U)) { - switch(utf8String[utf8Idx]) { - case '\b': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'b'; break; - case '\f': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'f'; break; - case '\n': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'n'; break; - case '\r': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'r'; break; - case '\t': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 't'; break; - default: if(JK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x", utf8String[utf8Idx]))) { return(1); } break; - } - } else { - if(JK_EXPECT_F(utf8String[utf8Idx] >= 0x80U) && (encodeState->serializeOptionFlags & JKSerializeOptionEscapeUnicode)) { - const unsigned char *nextValidCharacter = NULL; - UTF32 u32ch = 0U; - ConversionResult result; - - if(JK_EXPECT_F((result = ConvertSingleCodePointInUTF8(&utf8String[utf8Idx], &utf8String[usedBytes], (UTF8 const **)&nextValidCharacter, &u32ch)) != conversionOK)) { jk_encode_error(encodeState, @"Error converting UTF8."); return(1); } - else { - utf8Idx = (nextValidCharacter - utf8String) - 1UL; - if(JK_EXPECT_T(u32ch <= 0xffffU)) { if(JK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x", u32ch))) { return(1); } } - else { if(JK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x\\u%4.4x", (0xd7c0U + (u32ch >> 10)), (0xdc00U + (u32ch & 0x3ffU))))) { return(1); } } - } - } else { - if(JK_EXPECT_F(utf8String[utf8Idx] == '\"') || JK_EXPECT_F(utf8String[utf8Idx] == '\\') || (JK_EXPECT_F(encodeState->serializeOptionFlags & JKSerializeOptionEscapeForwardSlashes) && JK_EXPECT_F(utf8String[utf8Idx] == '/'))) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = utf8String[utf8Idx]; - } - } - } - NSCParameterAssert((encodeState->atIndex + 1UL) < encodeState->stringBuffer.bytes.length); - if(JK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, encodeCacheObject); - return(0); - } - } - break; - - case JKClassNumber: - { - if(object == (id)kCFBooleanTrue) { return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "true", 4UL)); } - else if(object == (id)kCFBooleanFalse) { return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "false", 5UL)); } - - const char *objCType = [object objCType]; - char anum[256], *aptr = &anum[255]; - int isNegative = 0; - unsigned long long ullv; - long long llv; - - if(JK_EXPECT_F(objCType == NULL) || JK_EXPECT_F(objCType[0] == 0) || JK_EXPECT_F(objCType[1] != 0)) { jk_encode_error(encodeState, @"NSNumber conversion error, unknown type. Type: '%s'", (objCType == NULL) ? "" : objCType); return(1); } - - switch(objCType[0]) { - case 'c': case 'i': case 's': case 'l': case 'q': - if(JK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberLongLongType, &llv))) { - if(llv < 0LL) { ullv = -llv; isNegative = 1; } else { ullv = llv; isNegative = 0; } - goto convertNumber; - } else { jk_encode_error(encodeState, @"Unable to get scalar value from number object."); return(1); } - break; - case 'C': case 'I': case 'S': case 'L': case 'Q': case 'B': - if(JK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberLongLongType, &ullv))) { - convertNumber: - if(JK_EXPECT_F(ullv < 10ULL)) { *--aptr = ullv + '0'; } else { while(JK_EXPECT_T(ullv > 0ULL)) { *--aptr = (ullv % 10ULL) + '0'; ullv /= 10ULL; NSCParameterAssert(aptr > anum); } } - if(isNegative) { *--aptr = '-'; } - NSCParameterAssert(aptr > anum); - return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, aptr, &anum[255] - aptr)); - } else { jk_encode_error(encodeState, @"Unable to get scalar value from number object."); return(1); } - break; - case 'f': case 'd': - { - double dv; - if(JK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberDoubleType, &dv))) { - if(JK_EXPECT_F(!isfinite(dv))) { jk_encode_error(encodeState, @"Floating point values must be finite. JSON does not support NaN or Infinity."); return(1); } - return(jk_encode_printf(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "%.17g", dv)); - } else { jk_encode_error(encodeState, @"Unable to get floating point value from number object."); return(1); } - } - break; - default: jk_encode_error(encodeState, @"NSNumber conversion error, unknown type. Type: '%c' / 0x%2.2x", objCType[0], objCType[0]); return(1); break; - } - } - break; - - case JKClassArray: - { - int printComma = 0; - CFIndex arrayCount = CFArrayGetCount((CFArrayRef)object), idx = 0L; - if(JK_EXPECT_F(jk_encode_write1(encodeState, 1L, "["))) { return(1); } - if(JK_EXPECT_F(arrayCount > 1020L)) { - for(id arrayObject in object) { if(JK_EXPECT_T(printComma)) { if(JK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } printComma = 1; if(JK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, arrayObject))) { return(1); } } - } else { - void *objects[1024]; - CFArrayGetValues((CFArrayRef)object, CFRangeMake(0L, arrayCount), (const void **)objects); - for(idx = 0L; idx < arrayCount; idx++) { if(JK_EXPECT_T(printComma)) { if(JK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } printComma = 1; if(JK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, objects[idx]))) { return(1); } } - } - return(jk_encode_write1(encodeState, -1L, "]")); - } - break; - - case JKClassDictionary: - { - int printComma = 0; - CFIndex dictionaryCount = CFDictionaryGetCount((CFDictionaryRef)object), idx = 0L; - id enumerateObject = JK_EXPECT_F(_jk_encode_prettyPrint) ? [[object allKeys] sortedArrayUsingSelector:@selector(compare:)] : object; - - if(JK_EXPECT_F(jk_encode_write1(encodeState, 1L, "{"))) { return(1); } - if(JK_EXPECT_F(_jk_encode_prettyPrint) || JK_EXPECT_F(dictionaryCount > 1020L)) { - for(id keyObject in enumerateObject) { - if(JK_EXPECT_T(printComma)) { if(JK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } - printComma = 1; - void *keyObjectISA = *((void **)keyObject); - if(JK_EXPECT_F((keyObjectISA != encodeState->fastClassLookup.stringClass)) && JK_EXPECT_F(([keyObject isKindOfClass:[NSString class]] == NO))) { jk_encode_error(encodeState, @"Key must be a string object."); return(1); } - if(JK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, keyObject))) { return(1); } - if(JK_EXPECT_F(jk_encode_write1(encodeState, 0L, ":"))) { return(1); } - if(JK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, (void *)CFDictionaryGetValue((CFDictionaryRef)object, keyObject)))) { return(1); } - } - } else { - void *keys[1024], *objects[1024]; - CFDictionaryGetKeysAndValues((CFDictionaryRef)object, (const void **)keys, (const void **)objects); - for(idx = 0L; idx < dictionaryCount; idx++) { - if(JK_EXPECT_T(printComma)) { if(JK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } - printComma = 1; - void *keyObjectISA = *((void **)keys[idx]); - if(JK_EXPECT_F(keyObjectISA != encodeState->fastClassLookup.stringClass) && JK_EXPECT_F([(id)keys[idx] isKindOfClass:[NSString class]] == NO)) { jk_encode_error(encodeState, @"Key must be a string object."); return(1); } - if(JK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, keys[idx]))) { return(1); } - if(JK_EXPECT_F(jk_encode_write1(encodeState, 0L, ":"))) { return(1); } - if(JK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, objects[idx]))) { return(1); } - } - } - return(jk_encode_write1(encodeState, -1L, "}")); - } - break; - - case JKClassNull: return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "null", 4UL)); break; - - default: jk_encode_error(encodeState, @"Unable to serialize object class %@.", NSStringFromClass([object class])); return(1); break; - } - - return(0); -} - - -@implementation JKSerializer - -+ (id)serializeObject:(id)object options:(JKSerializeOptionFlags)optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([[[[self alloc] init] autorelease] serializeObject:object options:optionFlags encodeOption:encodeOption block:block delegate:delegate selector:selector error:error]); -} - -- (id)serializeObject:(id)object options:(JKSerializeOptionFlags)optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ -#ifndef __BLOCKS__ -#pragma unused(block) -#endif - NSParameterAssert((object != NULL) && (encodeState == NULL) && ((delegate != NULL) ? (block == NULL) : 1) && ((block != NULL) ? (delegate == NULL) : 1) && - (((encodeOption & JKEncodeOptionCollectionObj) != 0UL) ? (((encodeOption & JKEncodeOptionStringObj) == 0UL) && ((encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) : 1) && - (((encodeOption & JKEncodeOptionStringObj) != 0UL) ? ((encodeOption & JKEncodeOptionCollectionObj) == 0UL) : 1)); - - id returnObject = NULL; - - if(encodeState != NULL) { [self releaseState]; } - if((encodeState = (struct JKEncodeState *)calloc(1UL, sizeof(JKEncodeState))) == NULL) { [NSException raise:NSMallocException format:@"Unable to allocate state structure."]; return(NULL); } - - if((error != NULL) && (*error != NULL)) { *error = NULL; } - - if(delegate != NULL) { - if(selector == NULL) { [NSException raise:NSInvalidArgumentException format:@"The delegate argument is not NULL, but the selector argument is NULL."]; } - if([delegate respondsToSelector:selector] == NO) { [NSException raise:NSInvalidArgumentException format:@"The serializeUnsupportedClassesUsingDelegate: delegate does not respond to the selector argument."]; } - encodeState->classFormatterDelegate = delegate; - encodeState->classFormatterSelector = selector; - encodeState->classFormatterIMP = (JKClassFormatterIMP)[delegate methodForSelector:selector]; - NSCParameterAssert(encodeState->classFormatterIMP != NULL); - } - -#ifdef __BLOCKS__ - encodeState->classFormatterBlock = block; -#endif - encodeState->serializeOptionFlags = optionFlags; - encodeState->encodeOption = encodeOption; - encodeState->stringBuffer.roundSizeUpToMultipleOf = (1024UL * 32UL); - encodeState->utf8ConversionBuffer.roundSizeUpToMultipleOf = 4096UL; - - unsigned char stackJSONBuffer[JK_JSONBUFFER_SIZE] JK_ALIGNED(64); - jk_managedBuffer_setToStackBuffer(&encodeState->stringBuffer, stackJSONBuffer, sizeof(stackJSONBuffer)); - - unsigned char stackUTF8Buffer[JK_UTF8BUFFER_SIZE] JK_ALIGNED(64); - jk_managedBuffer_setToStackBuffer(&encodeState->utf8ConversionBuffer, stackUTF8Buffer, sizeof(stackUTF8Buffer)); - - if(((encodeOption & JKEncodeOptionCollectionObj) != 0UL) && (([object isKindOfClass:[NSArray class]] == NO) && ([object isKindOfClass:[NSDictionary class]] == NO))) { jk_encode_error(encodeState, @"Unable to serialize object class %@, expected a NSArray or NSDictionary.", NSStringFromClass([object class])); goto errorExit; } - if(((encodeOption & JKEncodeOptionStringObj) != 0UL) && ([object isKindOfClass:[NSString class]] == NO)) { jk_encode_error(encodeState, @"Unable to serialize object class %@, expected a NSString.", NSStringFromClass([object class])); goto errorExit; } - - if(jk_encode_add_atom_to_buffer(encodeState, object) == 0) { - BOOL stackBuffer = ((encodeState->stringBuffer.flags & JKManagedBufferMustFree) == 0UL) ? YES : NO; - - if((encodeState->atIndex < 2UL)) - if((stackBuffer == NO) && ((encodeState->stringBuffer.bytes.ptr = (unsigned char *)reallocf(encodeState->stringBuffer.bytes.ptr, encodeState->atIndex + 16UL)) == NULL)) { jk_encode_error(encodeState, @"Unable to realloc buffer"); goto errorExit; } - - switch((encodeOption & JKEncodeOptionAsTypeMask)) { - case JKEncodeOptionAsData: - if(stackBuffer == YES) { if((returnObject = [(id)CFDataCreate( NULL, encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSData object"); } } - else { if((returnObject = [(id)CFDataCreateWithBytesNoCopy( NULL, encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex, NULL) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSData object"); } } - break; - - case JKEncodeOptionAsString: - if(stackBuffer == YES) { if((returnObject = [(id)CFStringCreateWithBytes( NULL, (const UInt8 *)encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex, kCFStringEncodingUTF8, NO) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSString object"); } } - else { if((returnObject = [(id)CFStringCreateWithBytesNoCopy(NULL, (const UInt8 *)encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex, kCFStringEncodingUTF8, NO, NULL) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSString object"); } } - break; - - default: jk_encode_error(encodeState, @"Unknown encode as type."); break; - } - - if((returnObject != NULL) && (stackBuffer == NO)) { encodeState->stringBuffer.flags &= ~JKManagedBufferMustFree; encodeState->stringBuffer.bytes.ptr = NULL; encodeState->stringBuffer.bytes.length = 0UL; } - } - -errorExit: - if((encodeState != NULL) && (error != NULL) && (encodeState->error != NULL)) { *error = encodeState->error; encodeState->error = NULL; } - [self releaseState]; - - return(returnObject); -} - -- (void)releaseState -{ - if(encodeState != NULL) { - jk_managedBuffer_release(&encodeState->stringBuffer); - jk_managedBuffer_release(&encodeState->utf8ConversionBuffer); - free(encodeState); encodeState = NULL; - } -} - -- (void)dealloc -{ - [self releaseState]; - [super dealloc]; -} - -@end - -@implementation NSString (JSONKitSerializing) - -//////////// -#pragma mark Methods for serializing a single NSString. -//////////// - -// Useful for those who need to serialize just a NSString. Otherwise you would have to do something like [NSArray arrayWithObject:stringToBeJSONSerialized], serializing the array, and then chopping of the extra ^\[.*\]$ square brackets. - -// NSData returning methods... - -- (NSData *)JSONData -{ - return([self JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES error:NULL]); -} - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | ((includeQuotes == NO) ? JKEncodeOptionStringObjTrimQuotes : 0UL) | JKEncodeOptionStringObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -// NSString returning methods... - -- (NSString *)JSONString -{ - return([self JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES error:NULL]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | ((includeQuotes == NO) ? JKEncodeOptionStringObjTrimQuotes : 0UL) | JKEncodeOptionStringObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -@end - -@implementation NSArray (JSONKitSerializing) - -// NSData returning methods... - -- (NSData *)JSONData -{ - return([JKSerializer serializeObject:self options:JKSerializeOptionNone encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -// NSString returning methods... - -- (NSString *)JSONString -{ - return([JKSerializer serializeObject:self options:JKSerializeOptionNone encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -@end - -@implementation NSDictionary (JSONKitSerializing) - -// NSData returning methods... - -- (NSData *)JSONData -{ - return([JKSerializer serializeObject:self options:JKSerializeOptionNone encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -// NSString returning methods... - -- (NSString *)JSONString -{ - return([JKSerializer serializeObject:self options:JKSerializeOptionNone encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -@end - - -#ifdef __BLOCKS__ - -@implementation NSArray (JSONKitSerializingBlockAdditions) - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -@end - -@implementation NSDictionary (JSONKitSerializingBlockAdditions) - -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JKSerializer serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -@end - -#endif // __BLOCKS__ - diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/bin/test-JSONKit b/tests/JSONTestSuite/parsers/test_JSONKit/bin/test-JSONKit deleted file mode 100755 index 568d2a1dd..000000000 Binary files a/tests/JSONTestSuite/parsers/test_JSONKit/bin/test-JSONKit and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.pbxproj deleted file mode 100644 index 1c92f533f..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.pbxproj +++ /dev/null @@ -1,252 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0388E0421D57F15D00BA0899 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0388E0411D57F15D00BA0899 /* main.m */; }; - 0388E04A1D57F16400BA0899 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 0388E0491D57F16400BA0899 /* JSONKit.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 0388E03C1D57F15D00BA0899 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0388E03E1D57F15D00BA0899 /* test-JSONKit */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "test-JSONKit"; sourceTree = BUILT_PRODUCTS_DIR; }; - 0388E0411D57F15D00BA0899 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 0388E0481D57F16400BA0899 /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = ""; }; - 0388E0491D57F16400BA0899 /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0388E03B1D57F15D00BA0899 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0388E0351D57F15D00BA0899 = { - isa = PBXGroup; - children = ( - 0388E0481D57F16400BA0899 /* JSONKit.h */, - 0388E0491D57F16400BA0899 /* JSONKit.m */, - 0388E0401D57F15D00BA0899 /* test-JSONKit */, - 0388E03F1D57F15D00BA0899 /* Products */, - ); - sourceTree = ""; - }; - 0388E03F1D57F15D00BA0899 /* Products */ = { - isa = PBXGroup; - children = ( - 0388E03E1D57F15D00BA0899 /* test-JSONKit */, - ); - name = Products; - sourceTree = ""; - }; - 0388E0401D57F15D00BA0899 /* test-JSONKit */ = { - isa = PBXGroup; - children = ( - 0388E0411D57F15D00BA0899 /* main.m */, - ); - path = "test-JSONKit"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 0388E03D1D57F15D00BA0899 /* test-JSONKit */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0388E0451D57F15D00BA0899 /* Build configuration list for PBXNativeTarget "test-JSONKit" */; - buildPhases = ( - 0388E03A1D57F15D00BA0899 /* Sources */, - 0388E03B1D57F15D00BA0899 /* Frameworks */, - 0388E03C1D57F15D00BA0899 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "test-JSONKit"; - productName = "test-JSONKit"; - productReference = 0388E03E1D57F15D00BA0899 /* test-JSONKit */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0388E0361D57F15D00BA0899 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 0388E03D1D57F15D00BA0899 = { - CreatedOnToolsVersion = 7.3; - }; - }; - }; - buildConfigurationList = 0388E0391D57F15D00BA0899 /* Build configuration list for PBXProject "test-JSONKit" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 0388E0351D57F15D00BA0899; - productRefGroup = 0388E03F1D57F15D00BA0899 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 0388E03D1D57F15D00BA0899 /* test-JSONKit */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 0388E03A1D57F15D00BA0899 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0388E04A1D57F16400BA0899 /* JSONKit.m in Sources */, - 0388E0421D57F15D00BA0899 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 0388E0431D57F15D00BA0899 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 0388E0441D57F15D00BA0899 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 0388E0461D57F15D00BA0899 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 0388E0471D57F15D00BA0899 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0388E0391D57F15D00BA0899 /* Build configuration list for PBXProject "test-JSONKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0388E0431D57F15D00BA0899 /* Debug */, - 0388E0441D57F15D00BA0899 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0388E0451D57F15D00BA0899 /* Build configuration list for PBXNativeTarget "test-JSONKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0388E0461D57F15D00BA0899 /* Debug */, - 0388E0471D57F15D00BA0899 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0388E0361D57F15D00BA0899 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 88a89bd32..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 9149b691c..000000000 Binary files a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-JSONKit.xcscheme b/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-JSONKit.xcscheme deleted file mode 100644 index 6c4b602f3..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-JSONKit.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 5aaf6969e..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test-JSONKit.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 0388E03D1D57F15D00BA0899 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit/main.m b/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit/main.m deleted file mode 100644 index eb9e94c09..000000000 --- a/tests/JSONTestSuite/parsers/test_JSONKit/test-JSONKit/main.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// main.m -// test-JSONKit -// -// Created by nst on 08/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#import -#import "JSONKit.h" // https://github.com/johnezang/JSONKit - -#include -#include -#include -#include -#include -#include - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -TestStatus test_file(char* filename, int printParsingResults) { - - NSString *path = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding]; - - //NSLog(@"--- %@", path); - -// if([path hasSuffix:@"n_structure_100000_opening_arrays.json"]) return ERROR; -// if([path hasSuffix:@"n_structure_empty.json"]) return ERROR; - - NSData *data = [NSData dataWithContentsOfFile:path]; - - JSONDecoder *decoder = [JSONDecoder decoderWithParseOptions:JKParseOptionNone]; - - NSError *error = nil; - id o = [decoder objectWithData:data error:&error]; - - if (printParsingResults) { - NSLog(@"--------------------------------\n"); - NSLog(@"-- file: %@\n", path); - NSLog(@"-- contents: %@\n", data); - NSLog(@"-- parsed: %d\n", o != NULL); - if(o != NULL) { - NSLog(@"-- o: %@", o); - } - } - - // if (value == NULL) { - // fprintf(stderr, "Unable to parse data\n"); - // free(file_contents); - // return 1; - // } - - return o != nil ? PASS : FAIL; -} - -int main(int argc, const char * argv[]) { - @autoreleasepool { - - const char* path = argv[1]; - - int printParsingResults = 0; - - int result = test_file(path, printParsingResults); - - if (result == PASS) { - return 0; - } else { - return 1; - } - - } - return 0; -} diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/Program.cs b/tests/JSONTestSuite/parsers/test_Json.NET/Program.cs deleted file mode 100755 index f5f716772..000000000 --- a/tests/JSONTestSuite/parsers/test_Json.NET/Program.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.IO; -using Newtonsoft.Json; - -namespace ConsoleApplication -{ - public class Program - { - public static int Main(string[] args) - { - if (args.Length != 1) - { - Console.Error.WriteLine($"Usage: {Path.GetFileName(Environment.GetCommandLineArgs()[0])} file.json"); - return 1; - } - - try - { - using (var fileStream = new FileStream(args[0], FileMode.Open)) - using (var streamReader = new StreamReader(fileStream)) - using (var jsonReader = new JsonTextReader(streamReader)) - { - try - { - JsonSerializer serializer = JsonSerializer.Create(new JsonSerializerSettings{ - MaxDepth = 512 - }); - var result = serializer.Deserialize(jsonReader); - Console.WriteLine(result); - } - catch (Exception e) - { - Console.Error.WriteLine(e); - return 1; - } - return 0; - } - } - catch (Exception e) - { - Console.Error.WriteLine(e); - return 2; - } - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/Newtonsoft.Json.dll b/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/Newtonsoft.Json.dll deleted file mode 100755 index 5f2336e6c..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/Newtonsoft.Json.dll and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/System.Runtime.Serialization.Primitives.dll b/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/System.Runtime.Serialization.Primitives.dll deleted file mode 100755 index 7cbc84393..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/System.Runtime.Serialization.Primitives.dll and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.deps.json b/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.deps.json deleted file mode 100755 index bb6752601..000000000 --- a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.deps.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v1.0", - "signature": "09db60146a5b8a0d40c5ea0fb7485ab3bbdd4a1a" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v1.0": { - "test_Json.NET/1.0.0": { - "dependencies": { - "Newtonsoft.Json": "9.0.1" - }, - "runtime": { - "test_Json.NET.dll": {} - } - }, - "Newtonsoft.Json/9.0.1": { - "dependencies": { - "System.Runtime.Serialization.Primitives": "4.1.1" - }, - "runtime": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - } - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "runtime": { - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - } - } - } - }, - "libraries": { - "test_Json.NET/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==" - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==" - } - } -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.dll b/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.dll deleted file mode 100755 index e477bb3ec..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.dll and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.pdb b/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.pdb deleted file mode 100755 index 82dc9f1ec..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.pdb and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.runtimeconfig.json b/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.runtimeconfig.json deleted file mode 100755 index d0437745b..000000000 --- a/tests/JSONTestSuite/parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.runtimeconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "runtimeOptions": { - "framework": { - "name": "Microsoft.NETCore.App", - "version": "1.0.1" - } - } -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/project.json b/tests/JSONTestSuite/parsers/test_Json.NET/project.json deleted file mode 100755 index 3f240a288..000000000 --- a/tests/JSONTestSuite/parsers/test_Json.NET/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0-*", - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": true - }, - "dependencies": { - "Newtonsoft.Json": "9.0.1" - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.1" - } - }, - "imports": "dnxcore50" - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_Json.NET/project.lock.json b/tests/JSONTestSuite/parsers/test_Json.NET/project.lock.json deleted file mode 100755 index ebf1b8cff..000000000 --- a/tests/JSONTestSuite/parsers/test_Json.NET/project.lock.json +++ /dev/null @@ -1,6741 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETCoreApp,Version=v1.0": { - "Libuv/1.9.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1" - }, - "runtimeTargets": { - "runtimes/osx/native/_._": { - "assetType": "native", - "rid": "osx" - } - } - }, - "Microsoft.CodeAnalysis.Analyzers/1.1.0": { - "type": "package" - }, - "Microsoft.CodeAnalysis.Common/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "1.1.0", - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Collections.Immutable": "1.2.0", - "System.Console": "4.0.0", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.FileVersionInfo": "4.0.0", - "System.Diagnostics.StackTrace": "4.0.1", - "System.Diagnostics.Tools": "4.0.1", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.CodePages": "4.0.1", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath.XDocument": "4.0.1", - "System.Xml.XmlDocument": "4.0.1" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "Microsoft.CodeAnalysis.CSharp/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "[1.3.0]" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "Microsoft.CodeAnalysis.VisualBasic/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "1.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "Microsoft.CSharp/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.0/Microsoft.CSharp.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CSharp.dll": {} - } - }, - "Microsoft.NETCore.App/1.0.1": { - "type": "package", - "dependencies": { - "Libuv": "1.9.0", - "Microsoft.CSharp": "4.0.1", - "Microsoft.CodeAnalysis.CSharp": "1.3.0", - "Microsoft.CodeAnalysis.VisualBasic": "1.3.0", - "Microsoft.NETCore.DotNetHostPolicy": "1.0.1", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.4", - "Microsoft.VisualBasic": "10.0.1", - "NETStandard.Library": "1.6.0", - "System.Buffers": "4.0.0", - "System.Collections.Immutable": "1.2.0", - "System.ComponentModel": "4.0.1", - "System.ComponentModel.Annotations": "4.1.0", - "System.Diagnostics.DiagnosticSource": "4.0.0", - "System.Diagnostics.Process": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO.FileSystem.Watcher": "4.0.0", - "System.IO.MemoryMappedFiles": "4.0.0", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Linq.Expressions": "4.1.0", - "System.Linq.Parallel": "4.0.1", - "System.Linq.Queryable": "4.0.1", - "System.Net.NameResolution": "4.0.0", - "System.Net.Requests": "4.0.11", - "System.Net.Security": "4.0.0", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Numerics.Vectors": "4.1.1", - "System.Reflection.DispatchProxy": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.Reader": "4.0.0", - "System.Runtime.Loader": "4.0.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Threading.Tasks.Dataflow": "4.6.0", - "System.Threading.Tasks.Extensions": "4.0.0", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10" - }, - "compile": { - "lib/netcoreapp1.0/_._": {} - }, - "runtime": { - "lib/netcoreapp1.0/_._": {} - } - }, - "Microsoft.NETCore.DotNetHost/1.0.1": { - "type": "package" - }, - "Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHostResolver": "1.0.1" - } - }, - "Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHost": "1.0.1" - } - }, - "Microsoft.NETCore.Jit/1.0.4": { - "type": "package" - }, - "Microsoft.NETCore.Platforms/1.0.1": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Jit": "1.0.4", - "Microsoft.NETCore.Windows.ApiSets": "1.0.1" - } - }, - "Microsoft.NETCore.Targets/1.0.1": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "type": "package" - }, - "Microsoft.VisualBasic/10.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/Microsoft.VisualBasic.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "Microsoft.Win32.Primitives/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "Microsoft.Win32.Registry/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "NETStandard.Library/1.6.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Console": "4.0.0", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tools": "4.0.1", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Globalization.Calendars": "4.0.1", - "System.IO": "4.1.0", - "System.IO.Compression": "4.1.0", - "System.IO.Compression.ZipFile": "4.0.1", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Net.Http": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Net.Sockets": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.0.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Timer": "4.0.1", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - } - }, - "runtime.native.System/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Security/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "System.AppContext/4.1.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/_._": {} - } - }, - "System.Buffers/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Buffers.dll": {} - }, - "runtime": { - "lib/netstandard1.1/_._": {} - } - }, - "System.Collections/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.0.12": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "System.ComponentModel/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.ComponentModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.ComponentModel.Annotations/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.ComponentModel": "4.0.1", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.4/System.ComponentModel.Annotations.dll": {} - }, - "runtime": { - "lib/netstandard1.4/_._": {} - } - }, - "System.Console/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.IO": "4.1.0", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Diagnostics.FileVersionInfo/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Diagnostics.Process/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "Microsoft.Win32.Registry": "4.0.0", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.4/System.Diagnostics.Process.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.4/_._": { - "assetType": "runtime", - "rid": "osx" - } - } - }, - "System.Diagnostics.StackTrace/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Diagnostics.Tools/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Dynamic.Runtime/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Dynamic.Runtime.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Dynamic.Runtime.dll": {} - } - }, - "System.Globalization/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Globalization": "4.0.11", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0", - "runtime.native.System.IO.Compression": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.0.1": { - "type": "package", - "dependencies": { - "System.Buffers": "4.0.0", - "System.IO": "4.1.0", - "System.IO.Compression": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.IO.FileSystem/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.IO.FileSystem.Watcher/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Overlapped": "4.0.1", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Watcher.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "osx" - } - } - }, - "System.IO.MemoryMappedFiles/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.MemoryMappedFiles.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.UnmanagedMemoryStream/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Linq/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Emit.Lightweight": "4.0.1", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Linq.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Linq.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Linq.Queryable/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Linq.Queryable.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Net.Http/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.DiagnosticSource": "4.0.0", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.OpenSsl": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0", - "runtime.native.System.Net.Http": "4.0.1", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.NameResolution/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Principal.Windows": "4.0.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.NameResolution.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Requests/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Net.Http": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Net.Requests.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Security/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Claims": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.OpenSsl": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Security.Principal": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0", - "runtime.native.System.Net.Security": "4.0.1", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Security.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Sockets/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.IO": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Runtime": "4.1.0", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.Net.WebHeaderCollection/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Numerics.Vectors/4.1.1": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "System.ObjectModel/4.0.12": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.IO": "4.1.0", - "System.Reflection.Primitives": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.DispatchProxy/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Reflection.Emit/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.0.1": { - "type": "package", - "dependencies": { - "System.Reflection": "4.1.0", - "System.Reflection.Primitives": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.0.1": { - "type": "package", - "dependencies": { - "System.Reflection": "4.1.0", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Immutable": "1.2.0", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/netstandard1.1/_._": {} - } - }, - "System.Reflection.Primitives/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.1.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.Reader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "System.Resources.ResourceManager/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Globalization": "4.0.11", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Reflection": "4.1.0", - "System.Reflection.Primitives": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.1/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Loader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/_._": {} - }, - "runtime": { - "lib/netstandard1.5/_._": {} - } - }, - "System.Runtime.Numerics/4.0.1": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - } - }, - "System.Security.Claims/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Security.Principal": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Security.Cryptography.Algorithms/4.2.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Text.Encoding": "4.0.11", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.6/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/4.2.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Text.Encoding": "4.0.11" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.6/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Text.Encoding": "4.0.11", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Text.Encoding": "4.0.11", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/_._": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Globalization.Calendars": "4.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Cng": "4.2.0", - "System.Security.Cryptography.Csp": "4.0.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.OpenSsl": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "runtime.native.System": "4.0.0", - "runtime.native.System.Net.Http": "4.0.1", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.6/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Principal/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Security.Principal.dll": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "System.Security.Principal.Windows/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Claims": "4.0.1", - "System.Security.Principal": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.CodePages/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding.Extensions/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.0.11": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Overlapped/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard1.3/_._": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Threading.Tasks/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - }, - "runtime": { - "lib/netstandard1.1/_._": {} - } - }, - "System.Threading.Tasks.Extensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Runtime": "4.1.0", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Tasks.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Threading.Thread/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Thread.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Threading.ThreadPool/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/System.Threading.ThreadPool.dll": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Threading.Timer/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Extensions": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tools": "4.0.1", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "System.Xml.XmlDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Xml.XPath/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - }, - "System.Xml.XPath.XDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/_._": {} - } - } - } - }, - "libraries": { - "Libuv/1.9.0": { - "sha512": "D8v8u5uSFuPNVxs2f7p4jxbNv8dbFuC77iKzvKPdFezOewuzOIqD1TXylLQqA5BEcylP9d0ENJlP/MrTLUEjVA==", - "type": "package", - "path": "Libuv/1.9.0", - "files": [ - "Libuv.1.9.0.nupkg.sha512", - "Libuv.nuspec", - "License.txt", - "runtimes/debian-x64/native/libuv.so", - "runtimes/fedora-x64/native/libuv.so", - "runtimes/opensuse-x64/native/libuv.so", - "runtimes/osx/native/libuv.dylib", - "runtimes/rhel-x64/native/libuv.so", - "runtimes/win7-arm/native/libuv.dll", - "runtimes/win7-x64/native/libuv.dll", - "runtimes/win7-x86/native/libuv.dll" - ] - }, - "Microsoft.CodeAnalysis.Analyzers/1.1.0": { - "sha512": "OH6ljOMgMRZdmt5fNQ6UTMbdj8raOzuzDSrIW5C2ZKTrCKxVzzXF8yAywokUC+bkK826eeJ2xD5dxIwEAULhFA==", - "type": "package", - "path": "Microsoft.CodeAnalysis.Analyzers/1.1.0", - "files": [ - "Microsoft.CodeAnalysis.Analyzers.1.1.0.nupkg.sha512", - "Microsoft.CodeAnalysis.Analyzers.nuspec", - "ThirdPartyNotices.rtf", - "analyzers/dotnet/cs/Microsoft.CodeAnalysis.Analyzers.dll", - "analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.Analyzers.dll", - "analyzers/dotnet/vb/Microsoft.CodeAnalysis.Analyzers.dll", - "analyzers/dotnet/vb/Microsoft.CodeAnalysis.VisualBasic.Analyzers.dll", - "tools/install.ps1", - "tools/uninstall.ps1" - ] - }, - "Microsoft.CodeAnalysis.Common/1.3.0": { - "sha512": "x7OqhuCTG3yGpsbN0jmnxew6nF6GG1JXWcCQ+gvoqlk8rO+JqUYtCJrHtzzw2jFb0kVsZNlRnigqTzbz9tqR5g==", - "type": "package", - "path": "Microsoft.CodeAnalysis.Common/1.3.0", - "files": [ - "Microsoft.CodeAnalysis.Common.1.3.0.nupkg.sha512", - "Microsoft.CodeAnalysis.Common.nuspec", - "ThirdPartyNotices.rtf", - "lib/net45/Microsoft.CodeAnalysis.dll", - "lib/net45/Microsoft.CodeAnalysis.xml", - "lib/netstandard1.3/Microsoft.CodeAnalysis.dll", - "lib/netstandard1.3/Microsoft.CodeAnalysis.xml", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.dll", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.xml" - ] - }, - "Microsoft.CodeAnalysis.CSharp/1.3.0": { - "sha512": "mFf0XRjrNYxpme+j7OwlFS8LiAdL67HAnMv6tiqcwSXXfNz6LFAqcB90jQB8AQIQd/n6TtoqBayf47Fk+1w7HQ==", - "type": "package", - "path": "Microsoft.CodeAnalysis.CSharp/1.3.0", - "files": [ - "Microsoft.CodeAnalysis.CSharp.1.3.0.nupkg.sha512", - "Microsoft.CodeAnalysis.CSharp.nuspec", - "ThirdPartyNotices.rtf", - "lib/net45/Microsoft.CodeAnalysis.CSharp.dll", - "lib/net45/Microsoft.CodeAnalysis.CSharp.xml", - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.dll", - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.xml", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.CSharp.dll", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.CSharp.xml" - ] - }, - "Microsoft.CodeAnalysis.VisualBasic/1.3.0": { - "sha512": "s3UugysCXE1uE/grnNxuifxfz46kftnZya4poBASL1jpQweRd7MBgHMZdwR23wOXkGoqZPOcAbQMnWx4yhiGmw==", - "type": "package", - "path": "Microsoft.CodeAnalysis.VisualBasic/1.3.0", - "files": [ - "Microsoft.CodeAnalysis.VisualBasic.1.3.0.nupkg.sha512", - "Microsoft.CodeAnalysis.VisualBasic.nuspec", - "ThirdPartyNotices.rtf", - "lib/net45/Microsoft.CodeAnalysis.VisualBasic.dll", - "lib/net45/Microsoft.CodeAnalysis.VisualBasic.xml", - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.dll", - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.xml", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.VisualBasic.dll", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.VisualBasic.xml" - ] - }, - "Microsoft.CSharp/4.0.1": { - "sha512": "9ghWfwsNHaWVZcy86YIUYGv9c9AZLYZ4Tad47IzjekVrI5zp6TGy6FXoxqdkxGn8apv6TqoaLoRWAAEQXyf60Q==", - "type": "package", - "path": "Microsoft.CSharp/4.0.1", - "files": [ - "Microsoft.CSharp.4.0.1.nupkg.sha512", - "Microsoft.CSharp.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/Microsoft.CSharp.dll", - "lib/netstandard1.3/Microsoft.CSharp.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/Microsoft.CSharp.dll", - "ref/netcore50/Microsoft.CSharp.xml", - "ref/netcore50/de/Microsoft.CSharp.xml", - "ref/netcore50/es/Microsoft.CSharp.xml", - "ref/netcore50/fr/Microsoft.CSharp.xml", - "ref/netcore50/it/Microsoft.CSharp.xml", - "ref/netcore50/ja/Microsoft.CSharp.xml", - "ref/netcore50/ko/Microsoft.CSharp.xml", - "ref/netcore50/ru/Microsoft.CSharp.xml", - "ref/netcore50/zh-hans/Microsoft.CSharp.xml", - "ref/netcore50/zh-hant/Microsoft.CSharp.xml", - "ref/netstandard1.0/Microsoft.CSharp.dll", - "ref/netstandard1.0/Microsoft.CSharp.xml", - "ref/netstandard1.0/de/Microsoft.CSharp.xml", - "ref/netstandard1.0/es/Microsoft.CSharp.xml", - "ref/netstandard1.0/fr/Microsoft.CSharp.xml", - "ref/netstandard1.0/it/Microsoft.CSharp.xml", - "ref/netstandard1.0/ja/Microsoft.CSharp.xml", - "ref/netstandard1.0/ko/Microsoft.CSharp.xml", - "ref/netstandard1.0/ru/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "Microsoft.NETCore.App/1.0.1": { - "sha512": "wtgwT7w/yMHKUB5Y0dVzVEoUagz7VaZj9REjfP7GtgzVlAVrrK+V0f59HZPG35JIjE8nfBlzOCR+L61FDJEnNw==", - "type": "package", - "path": "Microsoft.NETCore.App/1.0.1", - "files": [ - "Microsoft.NETCore.App.1.0.1.nupkg.sha512", - "Microsoft.NETCore.App.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netcoreapp1.0/_._" - ] - }, - "Microsoft.NETCore.DotNetHost/1.0.1": { - "sha512": "SYdAiKG/O9ekimIQ05bbdVjWnY8RBsfKnhmx4OkJv3bhQzOKOTbMgNCTXcUu5k4A2HXF6tCFISlkTRT5WZ3kJQ==", - "type": "package", - "path": "Microsoft.NETCore.DotNetHost/1.0.1", - "files": [ - "Microsoft.NETCore.DotNetHost.1.0.1.nupkg.sha512", - "Microsoft.NETCore.DotNetHost.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "sha512": "4uX9ChfLNRGAT6kZnXOB51VvveEy7HOiAPBtvSqKeI5fVmNJkCLBOG8JwCxxOU1Yxbgu5OSoZyoYCJt0NqMQuA==", - "type": "package", - "path": "Microsoft.NETCore.DotNetHostPolicy/1.0.1", - "files": [ - "Microsoft.NETCore.DotNetHostPolicy.1.0.1.nupkg.sha512", - "Microsoft.NETCore.DotNetHostPolicy.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "sha512": "yVXttMsS/v8EpK698VTvuCTB4+wI1O7qFjZK3gPul6juCqoXEABRdpe+DxehtZ3qRBkbWH4MXxCyrfI2iOLy2w==", - "type": "package", - "path": "Microsoft.NETCore.DotNetHostResolver/1.0.1", - "files": [ - "Microsoft.NETCore.DotNetHostResolver.1.0.1.nupkg.sha512", - "Microsoft.NETCore.DotNetHostResolver.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.Jit/1.0.4": { - "sha512": "EeJczJ2Gxx7ikO7N0IVE+CAv4/G3uYLKZGSGMXz8SgFMSk2fSytUCBBTv8iOAPXflbCOameAe+I+tFKX+6I3vg==", - "type": "package", - "path": "Microsoft.NETCore.Jit/1.0.4", - "files": [ - "Microsoft.NETCore.Jit.1.0.4.nupkg.sha512", - "Microsoft.NETCore.Jit.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.Platforms/1.0.1": { - "sha512": "oUUR+PxdiR+DDOMYD/qbSB1gtuuDR9bToBZjqSKwyr/HtzPVpHCg4zl5TgPLaxQ9X/A8VfbPoGUE1c5wi6D2uA==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.0.1", - "files": [ - "Microsoft.NETCore.Platforms.1.0.1.nupkg.sha512", - "Microsoft.NETCore.Platforms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "sha512": "YOt2elMGDdHsnmRDMFKk1bjUjNbCuabxCPYYPrXuyrNodXe2uTUh7kRvSow3ONGYX8VHP426PejCwy0vSoFDag==", - "type": "package", - "path": "Microsoft.NETCore.Runtime.CoreCLR/1.0.4", - "files": [ - "Microsoft.NETCore.Runtime.CoreCLR.1.0.4.nupkg.sha512", - "Microsoft.NETCore.Runtime.CoreCLR.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets/1.0.1": { - "sha512": "D6W7E7bvLMulsxXkMmMZTkYTr2lbV/J1JHYELebmtXEJVBGUA/E6xuDbbkcxZok/jl/FiM/xDp2JESnff8vAkA==", - "type": "package", - "path": "Microsoft.NETCore.Targets/1.0.1", - "files": [ - "Microsoft.NETCore.Targets.1.0.1.nupkg.sha512", - "Microsoft.NETCore.Targets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "sha512": "j2w31BijMivx1IuXXfiMfJ6aIggvCap3+uwrkBGMdJwZnJfLr0O1Si5dpv503TPWmCfOFC9X8w5EF43CmehFuw==", - "type": "package", - "path": "Microsoft.NETCore.Windows.ApiSets/1.0.1", - "files": [ - "Microsoft.NETCore.Windows.ApiSets.1.0.1.nupkg.sha512", - "Microsoft.NETCore.Windows.ApiSets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.VisualBasic/10.0.1": { - "sha512": "X7UPwB1yNq1O3x/x+GsPEEZLq2m6/DkFOw+dwMYpvisuLeepCBex6KOIg76N125VkYNKHFYQW1xHKxfUp6rzQA==", - "type": "package", - "path": "Microsoft.VisualBasic/10.0.1", - "files": [ - "Microsoft.VisualBasic.10.0.1.nupkg.sha512", - "Microsoft.VisualBasic.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net45/_._", - "lib/netcore50/Microsoft.VisualBasic.dll", - "lib/netstandard1.3/Microsoft.VisualBasic.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/net45/_._", - "ref/netcore50/Microsoft.VisualBasic.dll", - "ref/netcore50/Microsoft.VisualBasic.xml", - "ref/netcore50/de/Microsoft.VisualBasic.xml", - "ref/netcore50/es/Microsoft.VisualBasic.xml", - "ref/netcore50/fr/Microsoft.VisualBasic.xml", - "ref/netcore50/it/Microsoft.VisualBasic.xml", - "ref/netcore50/ja/Microsoft.VisualBasic.xml", - "ref/netcore50/ko/Microsoft.VisualBasic.xml", - "ref/netcore50/ru/Microsoft.VisualBasic.xml", - "ref/netcore50/zh-hans/Microsoft.VisualBasic.xml", - "ref/netcore50/zh-hant/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/Microsoft.VisualBasic.dll", - "ref/netstandard1.1/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/de/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/es/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/fr/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/it/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/ja/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/ko/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/ru/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/zh-hans/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/zh-hant/Microsoft.VisualBasic.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._" - ] - }, - "Microsoft.Win32.Primitives/4.0.1": { - "sha512": "blO/BsGSJaNZyiocTXJDAn3zdNUmckwWuxYC0Xv0sTp6KX+4lzV6iJR3YpFrxL6j4wu9lSnAYVQ1FX49G/QJcA==", - "type": "package", - "path": "Microsoft.Win32.Primitives/4.0.1", - "files": [ - "Microsoft.Win32.Primitives.4.0.1.nupkg.sha512", - "Microsoft.Win32.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "Microsoft.Win32.Registry/4.0.0": { - "sha512": "sKRGsOYljokZ+fG3veg9izmLN/pSNVAkQTsaTqv3Fws8TDJr0uBICSXZz9/d/SCeZhZwqpAUxmnJSrHsOXOPbg==", - "type": "package", - "path": "Microsoft.Win32.Registry/4.0.0", - "files": [ - "Microsoft.Win32.Registry.4.0.0.nupkg.sha512", - "Microsoft.Win32.Registry.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/Microsoft.Win32.Registry.dll", - "ref/net46/Microsoft.Win32.Registry.dll", - "ref/netstandard1.3/Microsoft.Win32.Registry.dll", - "ref/netstandard1.3/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Registry.xml", - "runtimes/unix/lib/netstandard1.3/Microsoft.Win32.Registry.dll", - "runtimes/win/lib/net46/Microsoft.Win32.Registry.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll" - ] - }, - "NETStandard.Library/1.6.0": { - "sha512": "SJiGdgbNk3ihgCwRxHNrIGquXfaWIAFT/J2V2MWrvkQAfxqJa+HPZQ5SBnY+/OEdJamg1jDbbn2TPtl0dEFWPA==", - "type": "package", - "path": "NETStandard.Library/1.6.0", - "files": [ - "NETStandard.Library.1.6.0.nupkg.sha512", - "NETStandard.Library.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt" - ] - }, - "Newtonsoft.Json/9.0.1": { - "sha512": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", - "type": "package", - "path": "Newtonsoft.Json/9.0.1", - "files": [ - "Newtonsoft.Json.9.0.1.nupkg.sha512", - "Newtonsoft.Json.nuspec", - "lib/net20/Newtonsoft.Json.dll", - "lib/net20/Newtonsoft.Json.xml", - "lib/net35/Newtonsoft.Json.dll", - "lib/net35/Newtonsoft.Json.xml", - "lib/net40/Newtonsoft.Json.dll", - "lib/net40/Newtonsoft.Json.xml", - "lib/net45/Newtonsoft.Json.dll", - "lib/net45/Newtonsoft.Json.xml", - "lib/netstandard1.0/Newtonsoft.Json.dll", - "lib/netstandard1.0/Newtonsoft.Json.xml", - "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll", - "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml", - "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll", - "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.xml", - "tools/install.ps1" - ] - }, - "runtime.native.System/4.0.0": { - "sha512": "gFmH1mF+QbzRzVT93fsDgvjOv8BdosZrRo14BDAkU3DgjhjvRMvfqzFQROFfu3NabxUjfeGMAsJ/VFED3EvWdA==", - "type": "package", - "path": "runtime.native.System/4.0.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.4.0.0.nupkg.sha512", - "runtime.native.System.nuspec" - ] - }, - "runtime.native.System.IO.Compression/4.1.0": { - "sha512": "8KVM+e9f20jMcW0nxaLZZb1/SuKXpqLDkXE0yOJscB1i84ibUnirFvvHwbKE/4Zw+1EhnXqbW6gfRQG5pTY7/Q==", - "type": "package", - "path": "runtime.native.System.IO.Compression/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.IO.Compression.4.1.0.nupkg.sha512", - "runtime.native.System.IO.Compression.nuspec" - ] - }, - "runtime.native.System.Net.Http/4.0.1": { - "sha512": "KjLWjCsLyD3b8mfCtNyR4pXowLdBq9Z2CZUcy0bo4RHIW9TutuvILOlDKR7q/DLMNC8DODqknLspZm6FupE/qA==", - "type": "package", - "path": "runtime.native.System.Net.Http/4.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Net.Http.4.0.1.nupkg.sha512", - "runtime.native.System.Net.Http.nuspec" - ] - }, - "runtime.native.System.Net.Security/4.0.1": { - "sha512": "a55jykBPMea1SIVjJEN1PvQ4KnyL1ZG8i60MBDzLk5Eu4IakIPetbnOc+d4knFtUKfzUcNW95BlprQU5IWuALg==", - "type": "package", - "path": "runtime.native.System.Net.Security/4.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Net.Security.4.0.1.nupkg.sha512", - "runtime.native.System.Net.Security.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography/4.0.0": { - "sha512": "X2LMjiJLUp7SmlOEcJIZkLuMe8ns8EB1SDeGTgTwQta2XFGU8W7pnORYg17dMA6p002pXHCWlWrP6M0d4rSWCA==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography/4.0.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.4.0.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.nuspec" - ] - }, - "System.AppContext/4.1.0": { - "sha512": "5Km5wcAufp3oVpLzIvB3APvVCjmZQB04rwl6kjMLOGDZW/w+kZPEMmTisoG4V6UkZ2o0Kyg9hYB66kkCdEIL+g==", - "type": "package", - "path": "System.AppContext/4.1.0", - "files": [ - "System.AppContext.4.1.0.nupkg.sha512", - "System.AppContext.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/net463/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/netstandard1.6/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.AppContext.dll", - "ref/net463/System.AppContext.dll", - "ref/netstandard/_._", - "ref/netstandard1.3/System.AppContext.dll", - "ref/netstandard1.3/System.AppContext.xml", - "ref/netstandard1.3/de/System.AppContext.xml", - "ref/netstandard1.3/es/System.AppContext.xml", - "ref/netstandard1.3/fr/System.AppContext.xml", - "ref/netstandard1.3/it/System.AppContext.xml", - "ref/netstandard1.3/ja/System.AppContext.xml", - "ref/netstandard1.3/ko/System.AppContext.xml", - "ref/netstandard1.3/ru/System.AppContext.xml", - "ref/netstandard1.3/zh-hans/System.AppContext.xml", - "ref/netstandard1.3/zh-hant/System.AppContext.xml", - "ref/netstandard1.6/System.AppContext.dll", - "ref/netstandard1.6/System.AppContext.xml", - "ref/netstandard1.6/de/System.AppContext.xml", - "ref/netstandard1.6/es/System.AppContext.xml", - "ref/netstandard1.6/fr/System.AppContext.xml", - "ref/netstandard1.6/it/System.AppContext.xml", - "ref/netstandard1.6/ja/System.AppContext.xml", - "ref/netstandard1.6/ko/System.AppContext.xml", - "ref/netstandard1.6/ru/System.AppContext.xml", - "ref/netstandard1.6/zh-hans/System.AppContext.xml", - "ref/netstandard1.6/zh-hant/System.AppContext.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.AppContext.dll" - ] - }, - "System.Buffers/4.0.0": { - "sha512": "YnxcvD1w2t1M+e/ILFMmHG8SOAtFo0SXyLrF38QWLM+oFBWUD4yZx3uCzPTZOUw9kQnQwp93VvC30SZygWNN6g==", - "type": "package", - "path": "System.Buffers/4.0.0", - "files": [ - "System.Buffers.4.0.0.nupkg.sha512", - "System.Buffers.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/.xml", - "lib/netstandard1.1/System.Buffers.dll" - ] - }, - "System.Collections/4.0.11": { - "sha512": "Q8IfQjdxgGhg7xO82qGScQqrSh0gGT5bZltznwc4rbLW9i65GPJa11dskMHDtiWXMKfKoe0B71U1S70zZd61mw==", - "type": "package", - "path": "System.Collections/4.0.11", - "files": [ - "System.Collections.4.0.11.nupkg.sha512", - "System.Collections.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.dll", - "ref/netcore50/System.Collections.xml", - "ref/netcore50/de/System.Collections.xml", - "ref/netcore50/es/System.Collections.xml", - "ref/netcore50/fr/System.Collections.xml", - "ref/netcore50/it/System.Collections.xml", - "ref/netcore50/ja/System.Collections.xml", - "ref/netcore50/ko/System.Collections.xml", - "ref/netcore50/ru/System.Collections.xml", - "ref/netcore50/zh-hans/System.Collections.xml", - "ref/netcore50/zh-hant/System.Collections.xml", - "ref/netstandard1.0/System.Collections.dll", - "ref/netstandard1.0/System.Collections.xml", - "ref/netstandard1.0/de/System.Collections.xml", - "ref/netstandard1.0/es/System.Collections.xml", - "ref/netstandard1.0/fr/System.Collections.xml", - "ref/netstandard1.0/it/System.Collections.xml", - "ref/netstandard1.0/ja/System.Collections.xml", - "ref/netstandard1.0/ko/System.Collections.xml", - "ref/netstandard1.0/ru/System.Collections.xml", - "ref/netstandard1.0/zh-hans/System.Collections.xml", - "ref/netstandard1.0/zh-hant/System.Collections.xml", - "ref/netstandard1.3/System.Collections.dll", - "ref/netstandard1.3/System.Collections.xml", - "ref/netstandard1.3/de/System.Collections.xml", - "ref/netstandard1.3/es/System.Collections.xml", - "ref/netstandard1.3/fr/System.Collections.xml", - "ref/netstandard1.3/it/System.Collections.xml", - "ref/netstandard1.3/ja/System.Collections.xml", - "ref/netstandard1.3/ko/System.Collections.xml", - "ref/netstandard1.3/ru/System.Collections.xml", - "ref/netstandard1.3/zh-hans/System.Collections.xml", - "ref/netstandard1.3/zh-hant/System.Collections.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Concurrent/4.0.12": { - "sha512": "7x8U6XmBv2xdZBSpF2mvgdmuWZtUthW2+uacIl/l72sY9RWbczkbb1u+BjdajyzMN0JIM+bwUvduCYxXmjD/5A==", - "type": "package", - "path": "System.Collections.Concurrent/4.0.12", - "files": [ - "System.Collections.Concurrent.4.0.12.nupkg.sha512", - "System.Collections.Concurrent.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Collections.Concurrent.dll", - "lib/netstandard1.3/System.Collections.Concurrent.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.Concurrent.dll", - "ref/netcore50/System.Collections.Concurrent.xml", - "ref/netcore50/de/System.Collections.Concurrent.xml", - "ref/netcore50/es/System.Collections.Concurrent.xml", - "ref/netcore50/fr/System.Collections.Concurrent.xml", - "ref/netcore50/it/System.Collections.Concurrent.xml", - "ref/netcore50/ja/System.Collections.Concurrent.xml", - "ref/netcore50/ko/System.Collections.Concurrent.xml", - "ref/netcore50/ru/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hans/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.1/System.Collections.Concurrent.dll", - "ref/netstandard1.1/System.Collections.Concurrent.xml", - "ref/netstandard1.1/de/System.Collections.Concurrent.xml", - "ref/netstandard1.1/es/System.Collections.Concurrent.xml", - "ref/netstandard1.1/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.1/it/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.3/System.Collections.Concurrent.dll", - "ref/netstandard1.3/System.Collections.Concurrent.xml", - "ref/netstandard1.3/de/System.Collections.Concurrent.xml", - "ref/netstandard1.3/es/System.Collections.Concurrent.xml", - "ref/netstandard1.3/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.3/it/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hant/System.Collections.Concurrent.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Immutable/1.2.0": { - "sha512": "DQaTY0MHjfJ0h0Go/qlFxkdwWVgR6wIhTw9DD8QdiFhjweE3mduvOu1SBYNLMycX5lKHjq3gv8K37++atweafA==", - "type": "package", - "path": "System.Collections.Immutable/1.2.0", - "files": [ - "System.Collections.Immutable.1.2.0.nupkg.sha512", - "System.Collections.Immutable.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Collections.Immutable.dll", - "lib/netstandard1.0/System.Collections.Immutable.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" - ] - }, - "System.ComponentModel/4.0.1": { - "sha512": "cZ7UeRSwTYaLTMQ7fxkjODurM8JihcdjIQNsYCTlOshdDmXmWPRWLS3xz8mDlSVU4pQAdVTXBHo+wO6Xf5uO9w==", - "type": "package", - "path": "System.ComponentModel/4.0.1", - "files": [ - "System.ComponentModel.4.0.1.nupkg.sha512", - "System.ComponentModel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ComponentModel.dll", - "lib/netstandard1.3/System.ComponentModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ComponentModel.dll", - "ref/netcore50/System.ComponentModel.xml", - "ref/netcore50/de/System.ComponentModel.xml", - "ref/netcore50/es/System.ComponentModel.xml", - "ref/netcore50/fr/System.ComponentModel.xml", - "ref/netcore50/it/System.ComponentModel.xml", - "ref/netcore50/ja/System.ComponentModel.xml", - "ref/netcore50/ko/System.ComponentModel.xml", - "ref/netcore50/ru/System.ComponentModel.xml", - "ref/netcore50/zh-hans/System.ComponentModel.xml", - "ref/netcore50/zh-hant/System.ComponentModel.xml", - "ref/netstandard1.0/System.ComponentModel.dll", - "ref/netstandard1.0/System.ComponentModel.xml", - "ref/netstandard1.0/de/System.ComponentModel.xml", - "ref/netstandard1.0/es/System.ComponentModel.xml", - "ref/netstandard1.0/fr/System.ComponentModel.xml", - "ref/netstandard1.0/it/System.ComponentModel.xml", - "ref/netstandard1.0/ja/System.ComponentModel.xml", - "ref/netstandard1.0/ko/System.ComponentModel.xml", - "ref/netstandard1.0/ru/System.ComponentModel.xml", - "ref/netstandard1.0/zh-hans/System.ComponentModel.xml", - "ref/netstandard1.0/zh-hant/System.ComponentModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.ComponentModel.Annotations/4.1.0": { - "sha512": "KdgtuTz/RAAsuJk9cqebTM/pPYwxXzTP923N8BlbEmIdNZyjCfPBfDTG263ifarRj089s1DlkeK6MsQPItlpiQ==", - "type": "package", - "path": "System.ComponentModel.Annotations/4.1.0", - "files": [ - "System.ComponentModel.Annotations.4.1.0.nupkg.sha512", - "System.ComponentModel.Annotations.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net461/System.ComponentModel.Annotations.dll", - "lib/netcore50/System.ComponentModel.Annotations.dll", - "lib/netstandard1.4/System.ComponentModel.Annotations.dll", - "lib/portable-net45+win8/_._", - "lib/win8/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net461/System.ComponentModel.Annotations.dll", - "ref/netcore50/System.ComponentModel.Annotations.dll", - "ref/netcore50/System.ComponentModel.Annotations.xml", - "ref/netcore50/de/System.ComponentModel.Annotations.xml", - "ref/netcore50/es/System.ComponentModel.Annotations.xml", - "ref/netcore50/fr/System.ComponentModel.Annotations.xml", - "ref/netcore50/it/System.ComponentModel.Annotations.xml", - "ref/netcore50/ja/System.ComponentModel.Annotations.xml", - "ref/netcore50/ko/System.ComponentModel.Annotations.xml", - "ref/netcore50/ru/System.ComponentModel.Annotations.xml", - "ref/netcore50/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netcore50/zh-hant/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/System.ComponentModel.Annotations.dll", - "ref/netstandard1.1/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/de/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/es/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/fr/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/it/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/ja/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/ko/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/ru/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/zh-hant/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/System.ComponentModel.Annotations.dll", - "ref/netstandard1.3/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/de/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/es/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/fr/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/it/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/ja/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/ko/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/ru/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/zh-hant/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/System.ComponentModel.Annotations.dll", - "ref/netstandard1.4/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/de/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/es/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/fr/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/it/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/ja/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/ko/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/ru/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/zh-hant/System.ComponentModel.Annotations.xml", - "ref/portable-net45+win8/_._", - "ref/win8/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Console/4.0.0": { - "sha512": "Csrh0bnPH2QRA72lcxefVJ6ecCHWsTc28ruaEKDNLX0MKB30LhS0o77l9rqde0LVd1+HlD5Mx/sLAhJdAdVHaw==", - "type": "package", - "path": "System.Console/4.0.0", - "files": [ - "System.Console.4.0.0.nupkg.sha512", - "System.Console.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Console.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Console.dll", - "ref/netstandard1.3/System.Console.dll", - "ref/netstandard1.3/System.Console.xml", - "ref/netstandard1.3/de/System.Console.xml", - "ref/netstandard1.3/es/System.Console.xml", - "ref/netstandard1.3/fr/System.Console.xml", - "ref/netstandard1.3/it/System.Console.xml", - "ref/netstandard1.3/ja/System.Console.xml", - "ref/netstandard1.3/ko/System.Console.xml", - "ref/netstandard1.3/ru/System.Console.xml", - "ref/netstandard1.3/zh-hans/System.Console.xml", - "ref/netstandard1.3/zh-hant/System.Console.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Debug/4.0.11": { - "sha512": "ZPSemq+D8LPPdQ31o4MdF9TuWO57pGsktFEqWoseVfRBtk61ahIZFB1PBUiezuS1oLE7O5PDaj7HPGqcdKXxzw==", - "type": "package", - "path": "System.Diagnostics.Debug/4.0.11", - "files": [ - "System.Diagnostics.Debug.4.0.11.nupkg.sha512", - "System.Diagnostics.Debug.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Debug.dll", - "ref/netcore50/System.Diagnostics.Debug.xml", - "ref/netcore50/de/System.Diagnostics.Debug.xml", - "ref/netcore50/es/System.Diagnostics.Debug.xml", - "ref/netcore50/fr/System.Diagnostics.Debug.xml", - "ref/netcore50/it/System.Diagnostics.Debug.xml", - "ref/netcore50/ja/System.Diagnostics.Debug.xml", - "ref/netcore50/ko/System.Diagnostics.Debug.xml", - "ref/netcore50/ru/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/System.Diagnostics.Debug.dll", - "ref/netstandard1.0/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/System.Diagnostics.Debug.dll", - "ref/netstandard1.3/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.DiagnosticSource/4.0.0": { - "sha512": "mm9ia/8ccnqwhP8ocxahTkBrpZZlHCaKfJrooXAIPPY0XaeMKxawRmsCumRxqNy/s9ca92B9vM+GkQK3g95D5A==", - "type": "package", - "path": "System.Diagnostics.DiagnosticSource/4.0.0", - "files": [ - "System.Diagnostics.DiagnosticSource.4.0.0.nupkg.sha512", - "System.Diagnostics.DiagnosticSource.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Diagnostics.DiagnosticSource.dll", - "lib/net46/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.xml", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.dll", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.xml" - ] - }, - "System.Diagnostics.FileVersionInfo/4.0.0": { - "sha512": "yEylMXNSFocrjNF+X3b8wsQqOowse01NkGIBmlH5sz5MS/zYIpi373AQP5xwcFMXh1lLhJDtUrVWabY3jtHU/A==", - "type": "package", - "path": "System.Diagnostics.FileVersionInfo/4.0.0", - "files": [ - "System.Diagnostics.FileVersionInfo.4.0.0.nupkg.sha512", - "System.Diagnostics.FileVersionInfo.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.FileVersionInfo.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Diagnostics.FileVersionInfo.dll", - "ref/netstandard1.3/System.Diagnostics.FileVersionInfo.dll", - "ref/netstandard1.3/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/de/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/es/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/fr/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/it/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/ja/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/ko/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/ru/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.FileVersionInfo.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll", - "runtimes/win/lib/net46/System.Diagnostics.FileVersionInfo.dll", - "runtimes/win/lib/netcore50/System.Diagnostics.FileVersionInfo.dll", - "runtimes/win/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll" - ] - }, - "System.Diagnostics.Process/4.1.0": { - "sha512": "M+yw/XrfdXHOOO8jkcXjs/WEkNF4tbsfRZAcPv75eAFQ+kqNef5vkBbzEjzJP7VZ9cHKh9wevW35M77nZA3nAA==", - "type": "package", - "path": "System.Diagnostics.Process/4.1.0", - "files": [ - "System.Diagnostics.Process.4.1.0.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/netstandard1.3/System.Diagnostics.Process.dll", - "ref/netstandard1.3/System.Diagnostics.Process.xml", - "ref/netstandard1.3/de/System.Diagnostics.Process.xml", - "ref/netstandard1.3/es/System.Diagnostics.Process.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Process.xml", - "ref/netstandard1.3/it/System.Diagnostics.Process.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Process.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Process.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Process.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Process.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Process.xml", - "ref/netstandard1.4/System.Diagnostics.Process.dll", - "ref/netstandard1.4/System.Diagnostics.Process.xml", - "ref/netstandard1.4/de/System.Diagnostics.Process.xml", - "ref/netstandard1.4/es/System.Diagnostics.Process.xml", - "ref/netstandard1.4/fr/System.Diagnostics.Process.xml", - "ref/netstandard1.4/it/System.Diagnostics.Process.xml", - "ref/netstandard1.4/ja/System.Diagnostics.Process.xml", - "ref/netstandard1.4/ko/System.Diagnostics.Process.xml", - "ref/netstandard1.4/ru/System.Diagnostics.Process.xml", - "ref/netstandard1.4/zh-hans/System.Diagnostics.Process.xml", - "ref/netstandard1.4/zh-hant/System.Diagnostics.Process.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/linux/lib/netstandard1.4/System.Diagnostics.Process.dll", - "runtimes/osx/lib/netstandard1.4/System.Diagnostics.Process.dll", - "runtimes/win/lib/net46/System.Diagnostics.Process.dll", - "runtimes/win/lib/net461/System.Diagnostics.Process.dll", - "runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll", - "runtimes/win7/lib/netcore50/_._" - ] - }, - "System.Diagnostics.StackTrace/4.0.1": { - "sha512": "YHqAy1CS6a3SEH9cZkYGozIyf96OwyEHUaNoJcofN7OmPbJWU1e0m7ZuLy8TiCgfHFMNgmStCrcrmX6YK5jGww==", - "type": "package", - "path": "System.Diagnostics.StackTrace/4.0.1", - "files": [ - "System.Diagnostics.StackTrace.4.0.1.nupkg.sha512", - "System.Diagnostics.StackTrace.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.StackTrace.dll", - "lib/netstandard1.3/System.Diagnostics.StackTrace.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Diagnostics.StackTrace.dll", - "ref/netstandard1.3/System.Diagnostics.StackTrace.dll", - "ref/netstandard1.3/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/de/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/es/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/fr/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/it/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/ja/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/ko/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/ru/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.StackTrace.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Diagnostics.StackTrace.dll" - ] - }, - "System.Diagnostics.Tools/4.0.1": { - "sha512": "gsMDPD+hZUQjKSCco+l523+KnLu5ecGyRH6ROMKQ99TWgS6HBCjuAefAAHZBxxzpfdOdftWxIT/yRpxnK16GRQ==", - "type": "package", - "path": "System.Diagnostics.Tools/4.0.1", - "files": [ - "System.Diagnostics.Tools.4.0.1.nupkg.sha512", - "System.Diagnostics.Tools.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/netcore50/de/System.Diagnostics.Tools.xml", - "ref/netcore50/es/System.Diagnostics.Tools.xml", - "ref/netcore50/fr/System.Diagnostics.Tools.xml", - "ref/netcore50/it/System.Diagnostics.Tools.xml", - "ref/netcore50/ja/System.Diagnostics.Tools.xml", - "ref/netcore50/ko/System.Diagnostics.Tools.xml", - "ref/netcore50/ru/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/System.Diagnostics.Tools.dll", - "ref/netstandard1.0/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/de/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/es/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/it/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Tools.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Tracing/4.1.0": { - "sha512": "ZaM+U6aVTDoNkJS2IVccYjCrMU2LSyfXFKsMHp1+O1KVjpAuvryPFKOz7msel4h8zOKQS3Ra24n0nsLS2eQ3qg==", - "type": "package", - "path": "System.Diagnostics.Tracing/4.1.0", - "files": [ - "System.Diagnostics.Tracing.4.1.0.nupkg.sha512", - "System.Diagnostics.Tracing.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Diagnostics.Tracing.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.xml", - "ref/netcore50/de/System.Diagnostics.Tracing.xml", - "ref/netcore50/es/System.Diagnostics.Tracing.xml", - "ref/netcore50/fr/System.Diagnostics.Tracing.xml", - "ref/netcore50/it/System.Diagnostics.Tracing.xml", - "ref/netcore50/ja/System.Diagnostics.Tracing.xml", - "ref/netcore50/ko/System.Diagnostics.Tracing.xml", - "ref/netcore50/ru/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/System.Diagnostics.Tracing.dll", - "ref/netstandard1.1/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/System.Diagnostics.Tracing.dll", - "ref/netstandard1.2/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/System.Diagnostics.Tracing.dll", - "ref/netstandard1.3/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/System.Diagnostics.Tracing.dll", - "ref/netstandard1.5/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hant/System.Diagnostics.Tracing.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Dynamic.Runtime/4.0.11": { - "sha512": "hVeEKnlsPLX5jWZwRzCrqIZyJqaF7IKP77F7RCjsBdg+U5Fdze1ECoU5X08YEo4pLWkaA4oLpFeE+VX3AR20DQ==", - "type": "package", - "path": "System.Dynamic.Runtime/4.0.11", - "files": [ - "System.Dynamic.Runtime.4.0.11.nupkg.sha512", - "System.Dynamic.Runtime.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Dynamic.Runtime.dll", - "lib/netstandard1.3/System.Dynamic.Runtime.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Dynamic.Runtime.dll", - "ref/netcore50/System.Dynamic.Runtime.xml", - "ref/netcore50/de/System.Dynamic.Runtime.xml", - "ref/netcore50/es/System.Dynamic.Runtime.xml", - "ref/netcore50/fr/System.Dynamic.Runtime.xml", - "ref/netcore50/it/System.Dynamic.Runtime.xml", - "ref/netcore50/ja/System.Dynamic.Runtime.xml", - "ref/netcore50/ko/System.Dynamic.Runtime.xml", - "ref/netcore50/ru/System.Dynamic.Runtime.xml", - "ref/netcore50/zh-hans/System.Dynamic.Runtime.xml", - "ref/netcore50/zh-hant/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/System.Dynamic.Runtime.dll", - "ref/netstandard1.0/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/de/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/es/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/fr/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/it/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ja/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ko/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ru/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/System.Dynamic.Runtime.dll", - "ref/netstandard1.3/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/de/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/es/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/fr/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/it/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ja/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ko/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ru/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Dynamic.Runtime.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Dynamic.Runtime.dll" - ] - }, - "System.Globalization/4.0.11": { - "sha512": "4OkH9ucdngUq3WvXclho8fxvspuHU8YivNvcWWO55+MhdmB4feKf9RPwzSoEQ6wA0KcLYT3yAPU7lr0MHUGcCw==", - "type": "package", - "path": "System.Globalization/4.0.11", - "files": [ - "System.Globalization.4.0.11.nupkg.sha512", - "System.Globalization.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Globalization.dll", - "ref/netcore50/System.Globalization.xml", - "ref/netcore50/de/System.Globalization.xml", - "ref/netcore50/es/System.Globalization.xml", - "ref/netcore50/fr/System.Globalization.xml", - "ref/netcore50/it/System.Globalization.xml", - "ref/netcore50/ja/System.Globalization.xml", - "ref/netcore50/ko/System.Globalization.xml", - "ref/netcore50/ru/System.Globalization.xml", - "ref/netcore50/zh-hans/System.Globalization.xml", - "ref/netcore50/zh-hant/System.Globalization.xml", - "ref/netstandard1.0/System.Globalization.dll", - "ref/netstandard1.0/System.Globalization.xml", - "ref/netstandard1.0/de/System.Globalization.xml", - "ref/netstandard1.0/es/System.Globalization.xml", - "ref/netstandard1.0/fr/System.Globalization.xml", - "ref/netstandard1.0/it/System.Globalization.xml", - "ref/netstandard1.0/ja/System.Globalization.xml", - "ref/netstandard1.0/ko/System.Globalization.xml", - "ref/netstandard1.0/ru/System.Globalization.xml", - "ref/netstandard1.0/zh-hans/System.Globalization.xml", - "ref/netstandard1.0/zh-hant/System.Globalization.xml", - "ref/netstandard1.3/System.Globalization.dll", - "ref/netstandard1.3/System.Globalization.xml", - "ref/netstandard1.3/de/System.Globalization.xml", - "ref/netstandard1.3/es/System.Globalization.xml", - "ref/netstandard1.3/fr/System.Globalization.xml", - "ref/netstandard1.3/it/System.Globalization.xml", - "ref/netstandard1.3/ja/System.Globalization.xml", - "ref/netstandard1.3/ko/System.Globalization.xml", - "ref/netstandard1.3/ru/System.Globalization.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Calendars/4.0.1": { - "sha512": "Rx7SxJI4VoRvUFS/O5xjK1iQFVGqwBSi6wlt4ZDYhE6dN6H4LQ8zWAvGab/j0EDFh/yOQ0AL15XG3kj/hUkKSQ==", - "type": "package", - "path": "System.Globalization.Calendars/4.0.1", - "files": [ - "System.Globalization.Calendars.4.0.1.nupkg.sha512", - "System.Globalization.Calendars.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.xml", - "ref/netstandard1.3/de/System.Globalization.Calendars.xml", - "ref/netstandard1.3/es/System.Globalization.Calendars.xml", - "ref/netstandard1.3/fr/System.Globalization.Calendars.xml", - "ref/netstandard1.3/it/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ja/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ko/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ru/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Calendars.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Extensions/4.0.1": { - "sha512": "ywlaKelQMSMGlwOcVuepCJXxLBZSgrZlXIYjWPvoA4XW/fqf/gji3yB6m1SdrmPoE9HsAXAuyF9V4SjZEnyvbA==", - "type": "package", - "path": "System.Globalization.Extensions/4.0.1", - "files": [ - "System.Globalization.Extensions.4.0.1.nupkg.sha512", - "System.Globalization.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.xml", - "ref/netstandard1.3/de/System.Globalization.Extensions.xml", - "ref/netstandard1.3/es/System.Globalization.Extensions.xml", - "ref/netstandard1.3/fr/System.Globalization.Extensions.xml", - "ref/netstandard1.3/it/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ja/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ko/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ru/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Extensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll", - "runtimes/win/lib/net46/System.Globalization.Extensions.dll", - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll" - ] - }, - "System.IO/4.1.0": { - "sha512": "fDY/S3SmZzfGOoamBtl9zIWy8l5tyy9DoHWqa5kOltjZKt/pU5BV/cujiLDTIt06yutMlZ0IbXoKfQ0icMzCDA==", - "type": "package", - "path": "System.IO/4.1.0", - "files": [ - "System.IO.4.1.0.nupkg.sha512", - "System.IO.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.IO.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.IO.dll", - "ref/netcore50/System.IO.dll", - "ref/netcore50/System.IO.xml", - "ref/netcore50/de/System.IO.xml", - "ref/netcore50/es/System.IO.xml", - "ref/netcore50/fr/System.IO.xml", - "ref/netcore50/it/System.IO.xml", - "ref/netcore50/ja/System.IO.xml", - "ref/netcore50/ko/System.IO.xml", - "ref/netcore50/ru/System.IO.xml", - "ref/netcore50/zh-hans/System.IO.xml", - "ref/netcore50/zh-hant/System.IO.xml", - "ref/netstandard1.0/System.IO.dll", - "ref/netstandard1.0/System.IO.xml", - "ref/netstandard1.0/de/System.IO.xml", - "ref/netstandard1.0/es/System.IO.xml", - "ref/netstandard1.0/fr/System.IO.xml", - "ref/netstandard1.0/it/System.IO.xml", - "ref/netstandard1.0/ja/System.IO.xml", - "ref/netstandard1.0/ko/System.IO.xml", - "ref/netstandard1.0/ru/System.IO.xml", - "ref/netstandard1.0/zh-hans/System.IO.xml", - "ref/netstandard1.0/zh-hant/System.IO.xml", - "ref/netstandard1.3/System.IO.dll", - "ref/netstandard1.3/System.IO.xml", - "ref/netstandard1.3/de/System.IO.xml", - "ref/netstandard1.3/es/System.IO.xml", - "ref/netstandard1.3/fr/System.IO.xml", - "ref/netstandard1.3/it/System.IO.xml", - "ref/netstandard1.3/ja/System.IO.xml", - "ref/netstandard1.3/ko/System.IO.xml", - "ref/netstandard1.3/ru/System.IO.xml", - "ref/netstandard1.3/zh-hans/System.IO.xml", - "ref/netstandard1.3/zh-hant/System.IO.xml", - "ref/netstandard1.5/System.IO.dll", - "ref/netstandard1.5/System.IO.xml", - "ref/netstandard1.5/de/System.IO.xml", - "ref/netstandard1.5/es/System.IO.xml", - "ref/netstandard1.5/fr/System.IO.xml", - "ref/netstandard1.5/it/System.IO.xml", - "ref/netstandard1.5/ja/System.IO.xml", - "ref/netstandard1.5/ko/System.IO.xml", - "ref/netstandard1.5/ru/System.IO.xml", - "ref/netstandard1.5/zh-hans/System.IO.xml", - "ref/netstandard1.5/zh-hant/System.IO.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.Compression/4.1.0": { - "sha512": "1UPUauRB+MyeHKnf8gwc2WtP4VVEHFJ3hwW3UGQvlhbIiYez6Xgp8Yfda6NpLTTyR+pkCZg5qjSMWCn+UiKF6w==", - "type": "package", - "path": "System.IO.Compression/4.1.0", - "files": [ - "System.IO.Compression.4.1.0.nupkg.sha512", - "System.IO.Compression.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.IO.Compression.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/netcore50/de/System.IO.Compression.xml", - "ref/netcore50/es/System.IO.Compression.xml", - "ref/netcore50/fr/System.IO.Compression.xml", - "ref/netcore50/it/System.IO.Compression.xml", - "ref/netcore50/ja/System.IO.Compression.xml", - "ref/netcore50/ko/System.IO.Compression.xml", - "ref/netcore50/ru/System.IO.Compression.xml", - "ref/netcore50/zh-hans/System.IO.Compression.xml", - "ref/netcore50/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.1/System.IO.Compression.dll", - "ref/netstandard1.1/System.IO.Compression.xml", - "ref/netstandard1.1/de/System.IO.Compression.xml", - "ref/netstandard1.1/es/System.IO.Compression.xml", - "ref/netstandard1.1/fr/System.IO.Compression.xml", - "ref/netstandard1.1/it/System.IO.Compression.xml", - "ref/netstandard1.1/ja/System.IO.Compression.xml", - "ref/netstandard1.1/ko/System.IO.Compression.xml", - "ref/netstandard1.1/ru/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.3/System.IO.Compression.dll", - "ref/netstandard1.3/System.IO.Compression.xml", - "ref/netstandard1.3/de/System.IO.Compression.xml", - "ref/netstandard1.3/es/System.IO.Compression.xml", - "ref/netstandard1.3/fr/System.IO.Compression.xml", - "ref/netstandard1.3/it/System.IO.Compression.xml", - "ref/netstandard1.3/ja/System.IO.Compression.xml", - "ref/netstandard1.3/ko/System.IO.Compression.xml", - "ref/netstandard1.3/ru/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll", - "runtimes/win/lib/net46/System.IO.Compression.dll", - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll" - ] - }, - "System.IO.Compression.ZipFile/4.0.1": { - "sha512": "Lm36G8QNfncuHx/WX3NqYbcgytLom5i252He3gziUOJH/4bV1OpQ7iYYUPHDIW3BG3Uu2SaGrXS5F3BOP4/51A==", - "type": "package", - "path": "System.IO.Compression.ZipFile/4.0.1", - "files": [ - "System.IO.Compression.ZipFile.4.0.1.nupkg.sha512", - "System.IO.Compression.ZipFile.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/de/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/es/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/fr/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/it/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ja/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ko/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ru/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem/4.0.1": { - "sha512": "HFpllN5lfzCcaLxzYHkq7P3XITywUOQ7uEbGObhdO5MHBjzPd+ebk4G2NnQUEIdLA+LBvkV7UHMUoSB00mwm9w==", - "type": "package", - "path": "System.IO.FileSystem/4.0.1", - "files": [ - "System.IO.FileSystem.4.0.1.nupkg.sha512", - "System.IO.FileSystem.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem.Primitives/4.0.1": { - "sha512": "fXuPsJnvdzhn7a6Ac6Zx0cLTa9FjU44xhVLGIxmAwcYFlr/OG8BGoEIeqxbiDMHWP3Q6nEKcgjPmfAPp6KwHdQ==", - "type": "package", - "path": "System.IO.FileSystem.Primitives/4.0.1", - "files": [ - "System.IO.FileSystem.Primitives.4.0.1.nupkg.sha512", - "System.IO.FileSystem.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem.Watcher/4.0.0": { - "sha512": "/fC9hfjVJfj68AoVj0pS30/IjByEz+7QctNGG3KYh0ISdFgU9XreDNCXrGPmq8mzxfWqQbRRoS+4fEAwRDaKWw==", - "type": "package", - "path": "System.IO.FileSystem.Watcher/4.0.0", - "files": [ - "System.IO.FileSystem.Watcher.4.0.0.nupkg.sha512", - "System.IO.FileSystem.Watcher.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Watcher.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Watcher.dll", - "ref/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "ref/netstandard1.3/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Watcher.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/linux/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "runtimes/osx/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "runtimes/win/lib/net46/System.IO.FileSystem.Watcher.dll", - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "runtimes/win7/lib/netcore50/_._" - ] - }, - "System.IO.MemoryMappedFiles/4.0.0": { - "sha512": "fgdb0TbtVwr7++pJzJUSSTmEQVVYeHs578IxnKkUjdJ0ZGqsLHJ+4ESZ7PB+Q7BHIv2Iw5LHQow1E0n9LfoJUQ==", - "type": "package", - "path": "System.IO.MemoryMappedFiles/4.0.0", - "files": [ - "System.IO.MemoryMappedFiles.4.0.0.nupkg.sha512", - "System.IO.MemoryMappedFiles.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.MemoryMappedFiles.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.MemoryMappedFiles.dll", - "ref/netstandard1.3/System.IO.MemoryMappedFiles.dll", - "ref/netstandard1.3/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/de/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/es/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/fr/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/it/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/ja/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/ko/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/ru/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/zh-hans/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/zh-hant/System.IO.MemoryMappedFiles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll", - "runtimes/win/lib/net46/System.IO.MemoryMappedFiles.dll", - "runtimes/win/lib/netcore50/System.IO.MemoryMappedFiles.dll", - "runtimes/win/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll" - ] - }, - "System.IO.UnmanagedMemoryStream/4.0.1": { - "sha512": "ZymchmVl1tFgDC2j4MHXgtKwUmoKeJ5csVxsBT6HxHJhlpaGUwJJtp+sTWS1XlPvBTMJvLv0MUBFssDbKxWEEg==", - "type": "package", - "path": "System.IO.UnmanagedMemoryStream/4.0.1", - "files": [ - "System.IO.UnmanagedMemoryStream.4.0.1.nupkg.sha512", - "System.IO.UnmanagedMemoryStream.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.UnmanagedMemoryStream.dll", - "lib/netstandard1.3/System.IO.UnmanagedMemoryStream.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.UnmanagedMemoryStream.dll", - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.dll", - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/de/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/es/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/fr/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/it/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/ja/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/ko/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/ru/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/zh-hans/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/zh-hant/System.IO.UnmanagedMemoryStream.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq/4.1.0": { - "sha512": "0RdoPVXle4lmjVjAvHeo1SjvnjXOTczTRBJF+XMWZma6R0XU8z4dvDDJby+lDtUblE0MmXgUXrqLMWwS5kriLA==", - "type": "package", - "path": "System.Linq/4.1.0", - "files": [ - "System.Linq.4.1.0.nupkg.sha512", - "System.Linq.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.dll", - "lib/netcore50/System.Linq.dll", - "lib/netstandard1.6/System.Linq.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.dll", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/netcore50/de/System.Linq.xml", - "ref/netcore50/es/System.Linq.xml", - "ref/netcore50/fr/System.Linq.xml", - "ref/netcore50/it/System.Linq.xml", - "ref/netcore50/ja/System.Linq.xml", - "ref/netcore50/ko/System.Linq.xml", - "ref/netcore50/ru/System.Linq.xml", - "ref/netcore50/zh-hans/System.Linq.xml", - "ref/netcore50/zh-hant/System.Linq.xml", - "ref/netstandard1.0/System.Linq.dll", - "ref/netstandard1.0/System.Linq.xml", - "ref/netstandard1.0/de/System.Linq.xml", - "ref/netstandard1.0/es/System.Linq.xml", - "ref/netstandard1.0/fr/System.Linq.xml", - "ref/netstandard1.0/it/System.Linq.xml", - "ref/netstandard1.0/ja/System.Linq.xml", - "ref/netstandard1.0/ko/System.Linq.xml", - "ref/netstandard1.0/ru/System.Linq.xml", - "ref/netstandard1.0/zh-hans/System.Linq.xml", - "ref/netstandard1.0/zh-hant/System.Linq.xml", - "ref/netstandard1.6/System.Linq.dll", - "ref/netstandard1.6/System.Linq.xml", - "ref/netstandard1.6/de/System.Linq.xml", - "ref/netstandard1.6/es/System.Linq.xml", - "ref/netstandard1.6/fr/System.Linq.xml", - "ref/netstandard1.6/it/System.Linq.xml", - "ref/netstandard1.6/ja/System.Linq.xml", - "ref/netstandard1.6/ko/System.Linq.xml", - "ref/netstandard1.6/ru/System.Linq.xml", - "ref/netstandard1.6/zh-hans/System.Linq.xml", - "ref/netstandard1.6/zh-hant/System.Linq.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq.Expressions/4.1.0": { - "sha512": "DcR/TsucSdvUaD2+2AyH5OhEXMLvt1z1EFtR3DjapY/zQWf1/jMbZLh/WbrzxhYhmrWB1/5sWs1kdc3Q+g1SEg==", - "type": "package", - "path": "System.Linq.Expressions/4.1.0", - "files": [ - "System.Linq.Expressions.4.1.0.nupkg.sha512", - "System.Linq.Expressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.Expressions.dll", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/netstandard1.6/System.Linq.Expressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.xml", - "ref/netcore50/de/System.Linq.Expressions.xml", - "ref/netcore50/es/System.Linq.Expressions.xml", - "ref/netcore50/fr/System.Linq.Expressions.xml", - "ref/netcore50/it/System.Linq.Expressions.xml", - "ref/netcore50/ja/System.Linq.Expressions.xml", - "ref/netcore50/ko/System.Linq.Expressions.xml", - "ref/netcore50/ru/System.Linq.Expressions.xml", - "ref/netcore50/zh-hans/System.Linq.Expressions.xml", - "ref/netcore50/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.0/System.Linq.Expressions.dll", - "ref/netstandard1.0/System.Linq.Expressions.xml", - "ref/netstandard1.0/de/System.Linq.Expressions.xml", - "ref/netstandard1.0/es/System.Linq.Expressions.xml", - "ref/netstandard1.0/fr/System.Linq.Expressions.xml", - "ref/netstandard1.0/it/System.Linq.Expressions.xml", - "ref/netstandard1.0/ja/System.Linq.Expressions.xml", - "ref/netstandard1.0/ko/System.Linq.Expressions.xml", - "ref/netstandard1.0/ru/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.3/System.Linq.Expressions.dll", - "ref/netstandard1.3/System.Linq.Expressions.xml", - "ref/netstandard1.3/de/System.Linq.Expressions.xml", - "ref/netstandard1.3/es/System.Linq.Expressions.xml", - "ref/netstandard1.3/fr/System.Linq.Expressions.xml", - "ref/netstandard1.3/it/System.Linq.Expressions.xml", - "ref/netstandard1.3/ja/System.Linq.Expressions.xml", - "ref/netstandard1.3/ko/System.Linq.Expressions.xml", - "ref/netstandard1.3/ru/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.6/System.Linq.Expressions.dll", - "ref/netstandard1.6/System.Linq.Expressions.xml", - "ref/netstandard1.6/de/System.Linq.Expressions.xml", - "ref/netstandard1.6/es/System.Linq.Expressions.xml", - "ref/netstandard1.6/fr/System.Linq.Expressions.xml", - "ref/netstandard1.6/it/System.Linq.Expressions.xml", - "ref/netstandard1.6/ja/System.Linq.Expressions.xml", - "ref/netstandard1.6/ko/System.Linq.Expressions.xml", - "ref/netstandard1.6/ru/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hant/System.Linq.Expressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Linq.Expressions.dll" - ] - }, - "System.Linq.Parallel/4.0.1": { - "sha512": "CMzKovrTe0CFg6dBMO6J3tkeEh5Lu51jsammXx/VBZtEwOBMh81vPzaOIsvUeCXjVmDkNeAiGkJhSOFQJ+n9aw==", - "type": "package", - "path": "System.Linq.Parallel/4.0.1", - "files": [ - "System.Linq.Parallel.4.0.1.nupkg.sha512", - "System.Linq.Parallel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Linq.Parallel.dll", - "lib/netstandard1.3/System.Linq.Parallel.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Linq.Parallel.dll", - "ref/netcore50/System.Linq.Parallel.xml", - "ref/netcore50/de/System.Linq.Parallel.xml", - "ref/netcore50/es/System.Linq.Parallel.xml", - "ref/netcore50/fr/System.Linq.Parallel.xml", - "ref/netcore50/it/System.Linq.Parallel.xml", - "ref/netcore50/ja/System.Linq.Parallel.xml", - "ref/netcore50/ko/System.Linq.Parallel.xml", - "ref/netcore50/ru/System.Linq.Parallel.xml", - "ref/netcore50/zh-hans/System.Linq.Parallel.xml", - "ref/netcore50/zh-hant/System.Linq.Parallel.xml", - "ref/netstandard1.1/System.Linq.Parallel.dll", - "ref/netstandard1.1/System.Linq.Parallel.xml", - "ref/netstandard1.1/de/System.Linq.Parallel.xml", - "ref/netstandard1.1/es/System.Linq.Parallel.xml", - "ref/netstandard1.1/fr/System.Linq.Parallel.xml", - "ref/netstandard1.1/it/System.Linq.Parallel.xml", - "ref/netstandard1.1/ja/System.Linq.Parallel.xml", - "ref/netstandard1.1/ko/System.Linq.Parallel.xml", - "ref/netstandard1.1/ru/System.Linq.Parallel.xml", - "ref/netstandard1.1/zh-hans/System.Linq.Parallel.xml", - "ref/netstandard1.1/zh-hant/System.Linq.Parallel.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq.Queryable/4.0.1": { - "sha512": "4Pgfj37LCCuwta+3owsNvL2UyveRUrW1YCthfdlGR27C6wtOwhpUFnOCDIQKbh1Cwl2fOztktRO3NQsRiVRXWQ==", - "type": "package", - "path": "System.Linq.Queryable/4.0.1", - "files": [ - "System.Linq.Queryable.4.0.1.nupkg.sha512", - "System.Linq.Queryable.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Linq.Queryable.dll", - "lib/netstandard1.3/System.Linq.Queryable.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Linq.Queryable.dll", - "ref/netcore50/System.Linq.Queryable.xml", - "ref/netcore50/de/System.Linq.Queryable.xml", - "ref/netcore50/es/System.Linq.Queryable.xml", - "ref/netcore50/fr/System.Linq.Queryable.xml", - "ref/netcore50/it/System.Linq.Queryable.xml", - "ref/netcore50/ja/System.Linq.Queryable.xml", - "ref/netcore50/ko/System.Linq.Queryable.xml", - "ref/netcore50/ru/System.Linq.Queryable.xml", - "ref/netcore50/zh-hans/System.Linq.Queryable.xml", - "ref/netcore50/zh-hant/System.Linq.Queryable.xml", - "ref/netstandard1.0/System.Linq.Queryable.dll", - "ref/netstandard1.0/System.Linq.Queryable.xml", - "ref/netstandard1.0/de/System.Linq.Queryable.xml", - "ref/netstandard1.0/es/System.Linq.Queryable.xml", - "ref/netstandard1.0/fr/System.Linq.Queryable.xml", - "ref/netstandard1.0/it/System.Linq.Queryable.xml", - "ref/netstandard1.0/ja/System.Linq.Queryable.xml", - "ref/netstandard1.0/ko/System.Linq.Queryable.xml", - "ref/netstandard1.0/ru/System.Linq.Queryable.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Queryable.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Queryable.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.Http/4.1.0": { - "sha512": "hZn7QMba3OTd0fWhtDpk6Ah/+486/XfPgLf40z31VLaHAMUOxmK4cmO/G50hNoViuM4BrSUl5MxfWWl7qrIENw==", - "type": "package", - "path": "System.Net.Http/4.1.0", - "files": [ - "System.Net.Http.4.1.0.nupkg.sha512", - "System.Net.Http.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/Xamarinmac20/_._", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/net46/System.Net.Http.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/Xamarinmac20/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/net46/System.Net.Http.dll", - "ref/net46/System.Net.Http.xml", - "ref/net46/de/System.Net.Http.xml", - "ref/net46/es/System.Net.Http.xml", - "ref/net46/fr/System.Net.Http.xml", - "ref/net46/it/System.Net.Http.xml", - "ref/net46/ja/System.Net.Http.xml", - "ref/net46/ko/System.Net.Http.xml", - "ref/net46/ru/System.Net.Http.xml", - "ref/net46/zh-hans/System.Net.Http.xml", - "ref/net46/zh-hant/System.Net.Http.xml", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/netcore50/de/System.Net.Http.xml", - "ref/netcore50/es/System.Net.Http.xml", - "ref/netcore50/fr/System.Net.Http.xml", - "ref/netcore50/it/System.Net.Http.xml", - "ref/netcore50/ja/System.Net.Http.xml", - "ref/netcore50/ko/System.Net.Http.xml", - "ref/netcore50/ru/System.Net.Http.xml", - "ref/netcore50/zh-hans/System.Net.Http.xml", - "ref/netcore50/zh-hant/System.Net.Http.xml", - "ref/netstandard1.1/System.Net.Http.dll", - "ref/netstandard1.1/System.Net.Http.xml", - "ref/netstandard1.1/de/System.Net.Http.xml", - "ref/netstandard1.1/es/System.Net.Http.xml", - "ref/netstandard1.1/fr/System.Net.Http.xml", - "ref/netstandard1.1/it/System.Net.Http.xml", - "ref/netstandard1.1/ja/System.Net.Http.xml", - "ref/netstandard1.1/ko/System.Net.Http.xml", - "ref/netstandard1.1/ru/System.Net.Http.xml", - "ref/netstandard1.1/zh-hans/System.Net.Http.xml", - "ref/netstandard1.1/zh-hant/System.Net.Http.xml", - "ref/netstandard1.3/System.Net.Http.dll", - "ref/netstandard1.3/System.Net.Http.xml", - "ref/netstandard1.3/de/System.Net.Http.xml", - "ref/netstandard1.3/es/System.Net.Http.xml", - "ref/netstandard1.3/fr/System.Net.Http.xml", - "ref/netstandard1.3/it/System.Net.Http.xml", - "ref/netstandard1.3/ja/System.Net.Http.xml", - "ref/netstandard1.3/ko/System.Net.Http.xml", - "ref/netstandard1.3/ru/System.Net.Http.xml", - "ref/netstandard1.3/zh-hans/System.Net.Http.xml", - "ref/netstandard1.3/zh-hant/System.Net.Http.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll", - "runtimes/win/lib/net46/System.Net.Http.dll", - "runtimes/win/lib/netcore50/System.Net.Http.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll" - ] - }, - "System.Net.NameResolution/4.0.0": { - "sha512": "iyHWj7OuudyxU1+Ahv8IoJNI1ZjrAfPmd1MBs16U41ZZqOAM6gRSrbvBadWaPvc7EOG0MfYry/DumOuQrpoLBQ==", - "type": "package", - "path": "System.Net.NameResolution/4.0.0", - "files": [ - "System.Net.NameResolution.4.0.0.nupkg.sha512", - "System.Net.NameResolution.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.NameResolution.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.NameResolution.dll", - "ref/netstandard1.3/System.Net.NameResolution.dll", - "ref/netstandard1.3/System.Net.NameResolution.xml", - "ref/netstandard1.3/de/System.Net.NameResolution.xml", - "ref/netstandard1.3/es/System.Net.NameResolution.xml", - "ref/netstandard1.3/fr/System.Net.NameResolution.xml", - "ref/netstandard1.3/it/System.Net.NameResolution.xml", - "ref/netstandard1.3/ja/System.Net.NameResolution.xml", - "ref/netstandard1.3/ko/System.Net.NameResolution.xml", - "ref/netstandard1.3/ru/System.Net.NameResolution.xml", - "ref/netstandard1.3/zh-hans/System.Net.NameResolution.xml", - "ref/netstandard1.3/zh-hant/System.Net.NameResolution.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Net.NameResolution.dll", - "runtimes/win/lib/net46/System.Net.NameResolution.dll", - "runtimes/win/lib/netcore50/System.Net.NameResolution.dll", - "runtimes/win/lib/netstandard1.3/System.Net.NameResolution.dll" - ] - }, - "System.Net.Primitives/4.0.11": { - "sha512": "KcZbYrq47rmbU8cHr9HxofO3ls/w0wvZBflGG7IwhVz29YSl1iJRI0SQJ9wkh6cSmpt/7HPKFQIbzjNpwGxUhg==", - "type": "package", - "path": "System.Net.Primitives/4.0.11", - "files": [ - "System.Net.Primitives.4.0.11.nupkg.sha512", - "System.Net.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Net.Primitives.dll", - "ref/netcore50/System.Net.Primitives.xml", - "ref/netcore50/de/System.Net.Primitives.xml", - "ref/netcore50/es/System.Net.Primitives.xml", - "ref/netcore50/fr/System.Net.Primitives.xml", - "ref/netcore50/it/System.Net.Primitives.xml", - "ref/netcore50/ja/System.Net.Primitives.xml", - "ref/netcore50/ko/System.Net.Primitives.xml", - "ref/netcore50/ru/System.Net.Primitives.xml", - "ref/netcore50/zh-hans/System.Net.Primitives.xml", - "ref/netcore50/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.0/System.Net.Primitives.dll", - "ref/netstandard1.0/System.Net.Primitives.xml", - "ref/netstandard1.0/de/System.Net.Primitives.xml", - "ref/netstandard1.0/es/System.Net.Primitives.xml", - "ref/netstandard1.0/fr/System.Net.Primitives.xml", - "ref/netstandard1.0/it/System.Net.Primitives.xml", - "ref/netstandard1.0/ja/System.Net.Primitives.xml", - "ref/netstandard1.0/ko/System.Net.Primitives.xml", - "ref/netstandard1.0/ru/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.1/System.Net.Primitives.dll", - "ref/netstandard1.1/System.Net.Primitives.xml", - "ref/netstandard1.1/de/System.Net.Primitives.xml", - "ref/netstandard1.1/es/System.Net.Primitives.xml", - "ref/netstandard1.1/fr/System.Net.Primitives.xml", - "ref/netstandard1.1/it/System.Net.Primitives.xml", - "ref/netstandard1.1/ja/System.Net.Primitives.xml", - "ref/netstandard1.1/ko/System.Net.Primitives.xml", - "ref/netstandard1.1/ru/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.3/System.Net.Primitives.dll", - "ref/netstandard1.3/System.Net.Primitives.xml", - "ref/netstandard1.3/de/System.Net.Primitives.xml", - "ref/netstandard1.3/es/System.Net.Primitives.xml", - "ref/netstandard1.3/fr/System.Net.Primitives.xml", - "ref/netstandard1.3/it/System.Net.Primitives.xml", - "ref/netstandard1.3/ja/System.Net.Primitives.xml", - "ref/netstandard1.3/ko/System.Net.Primitives.xml", - "ref/netstandard1.3/ru/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Net.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.Requests/4.0.11": { - "sha512": "qyURRKYbqPZaqqYn9cmtJn/iByemgah6Y93Vs1+ZX6sOFM7Ttsrc4Fl6SkPGNK+CuulKU4xf1fZW+6YenAUIfw==", - "type": "package", - "path": "System.Net.Requests/4.0.11", - "files": [ - "System.Net.Requests.4.0.11.nupkg.sha512", - "System.Net.Requests.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/_._", - "ref/netcore50/System.Net.Requests.dll", - "ref/netcore50/System.Net.Requests.xml", - "ref/netcore50/de/System.Net.Requests.xml", - "ref/netcore50/es/System.Net.Requests.xml", - "ref/netcore50/fr/System.Net.Requests.xml", - "ref/netcore50/it/System.Net.Requests.xml", - "ref/netcore50/ja/System.Net.Requests.xml", - "ref/netcore50/ko/System.Net.Requests.xml", - "ref/netcore50/ru/System.Net.Requests.xml", - "ref/netcore50/zh-hans/System.Net.Requests.xml", - "ref/netcore50/zh-hant/System.Net.Requests.xml", - "ref/netstandard1.0/System.Net.Requests.dll", - "ref/netstandard1.0/System.Net.Requests.xml", - "ref/netstandard1.0/de/System.Net.Requests.xml", - "ref/netstandard1.0/es/System.Net.Requests.xml", - "ref/netstandard1.0/fr/System.Net.Requests.xml", - "ref/netstandard1.0/it/System.Net.Requests.xml", - "ref/netstandard1.0/ja/System.Net.Requests.xml", - "ref/netstandard1.0/ko/System.Net.Requests.xml", - "ref/netstandard1.0/ru/System.Net.Requests.xml", - "ref/netstandard1.0/zh-hans/System.Net.Requests.xml", - "ref/netstandard1.0/zh-hant/System.Net.Requests.xml", - "ref/netstandard1.1/System.Net.Requests.dll", - "ref/netstandard1.1/System.Net.Requests.xml", - "ref/netstandard1.1/de/System.Net.Requests.xml", - "ref/netstandard1.1/es/System.Net.Requests.xml", - "ref/netstandard1.1/fr/System.Net.Requests.xml", - "ref/netstandard1.1/it/System.Net.Requests.xml", - "ref/netstandard1.1/ja/System.Net.Requests.xml", - "ref/netstandard1.1/ko/System.Net.Requests.xml", - "ref/netstandard1.1/ru/System.Net.Requests.xml", - "ref/netstandard1.1/zh-hans/System.Net.Requests.xml", - "ref/netstandard1.1/zh-hant/System.Net.Requests.xml", - "ref/netstandard1.3/System.Net.Requests.dll", - "ref/netstandard1.3/System.Net.Requests.xml", - "ref/netstandard1.3/de/System.Net.Requests.xml", - "ref/netstandard1.3/es/System.Net.Requests.xml", - "ref/netstandard1.3/fr/System.Net.Requests.xml", - "ref/netstandard1.3/it/System.Net.Requests.xml", - "ref/netstandard1.3/ja/System.Net.Requests.xml", - "ref/netstandard1.3/ko/System.Net.Requests.xml", - "ref/netstandard1.3/ru/System.Net.Requests.xml", - "ref/netstandard1.3/zh-hans/System.Net.Requests.xml", - "ref/netstandard1.3/zh-hant/System.Net.Requests.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Net.Requests.dll", - "runtimes/win/lib/net46/_._", - "runtimes/win/lib/netstandard1.3/System.Net.Requests.dll" - ] - }, - "System.Net.Security/4.0.0": { - "sha512": "O5pmYZ0bsJzRP3lxvO6HZWjvBBKkhNRUI/UQReeDo9cvvfNuhBamZkAbaQTZRYOk+JsDzfpDrkqfglgeI9VhpQ==", - "type": "package", - "path": "System.Net.Security/4.0.0", - "files": [ - "System.Net.Security.4.0.0.nupkg.sha512", - "System.Net.Security.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Security.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Security.dll", - "ref/netstandard1.3/System.Net.Security.dll", - "ref/netstandard1.3/System.Net.Security.xml", - "ref/netstandard1.3/de/System.Net.Security.xml", - "ref/netstandard1.3/es/System.Net.Security.xml", - "ref/netstandard1.3/fr/System.Net.Security.xml", - "ref/netstandard1.3/it/System.Net.Security.xml", - "ref/netstandard1.3/ja/System.Net.Security.xml", - "ref/netstandard1.3/ko/System.Net.Security.xml", - "ref/netstandard1.3/ru/System.Net.Security.xml", - "ref/netstandard1.3/zh-hans/System.Net.Security.xml", - "ref/netstandard1.3/zh-hant/System.Net.Security.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Security.dll", - "runtimes/win/lib/net46/System.Net.Security.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Security.dll", - "runtimes/win7/lib/netcore50/_._" - ] - }, - "System.Net.Sockets/4.1.0": { - "sha512": "W2aqTjRs5tn3gNPemzojBcRPFBsnOiIABvwo+b7U82sVcW5JVgWOyewHDr7fdK/EEgJ8j+nrX9L/8sDV6vGLiA==", - "type": "package", - "path": "System.Net.Sockets/4.1.0", - "files": [ - "System.Net.Sockets.4.1.0.nupkg.sha512", - "System.Net.Sockets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.xml", - "ref/netstandard1.3/de/System.Net.Sockets.xml", - "ref/netstandard1.3/es/System.Net.Sockets.xml", - "ref/netstandard1.3/fr/System.Net.Sockets.xml", - "ref/netstandard1.3/it/System.Net.Sockets.xml", - "ref/netstandard1.3/ja/System.Net.Sockets.xml", - "ref/netstandard1.3/ko/System.Net.Sockets.xml", - "ref/netstandard1.3/ru/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hans/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hant/System.Net.Sockets.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.WebHeaderCollection/4.0.1": { - "sha512": "VWL7cEPrOoR7kfKQqZYpRMllMSdbx7iSCAwODSwRrD3wTC8j4eBp5j7kaxC7D1dg8m9uB/CoF6sAd1UkuSDXFQ==", - "type": "package", - "path": "System.Net.WebHeaderCollection/4.0.1", - "files": [ - "System.Net.WebHeaderCollection.4.0.1.nupkg.sha512", - "System.Net.WebHeaderCollection.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netstandard1.3/System.Net.WebHeaderCollection.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Net.WebHeaderCollection.dll", - "ref/netstandard1.3/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/de/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/es/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/fr/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/it/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/ja/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/ko/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/ru/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/zh-hans/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/zh-hant/System.Net.WebHeaderCollection.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Numerics.Vectors/4.1.1": { - "sha512": "PT1LXaeoOxy6VQi1+lfLpVHlVqSjJsYf2t8iWX49sHUkYUvFwvhIikG02vhbPRyn+oGSxOdR8OjutIO3UzJAhQ==", - "type": "package", - "path": "System.Numerics.Vectors/4.1.1", - "files": [ - "System.Numerics.Vectors.4.1.1.nupkg.sha512", - "System.Numerics.Vectors.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Numerics.Vectors.dll", - "lib/net46/System.Numerics.Vectors.xml", - "lib/netstandard1.0/System.Numerics.Vectors.dll", - "lib/netstandard1.0/System.Numerics.Vectors.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.xml", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Numerics.Vectors.dll", - "ref/net46/System.Numerics.Vectors.xml", - "ref/netstandard1.0/System.Numerics.Vectors.dll", - "ref/netstandard1.0/System.Numerics.Vectors.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.ObjectModel/4.0.12": { - "sha512": "KIgxKSkPPA1dvqK2fyO0Pyktc7aYDRdRsVWtkJE9OaHov6hZKq9UaARTmiEJdQxOIb4znG31rYroTIGU/gGHjw==", - "type": "package", - "path": "System.ObjectModel/4.0.12", - "files": [ - "System.ObjectModel.4.0.12.nupkg.sha512", - "System.ObjectModel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ObjectModel.dll", - "lib/netstandard1.3/System.ObjectModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ObjectModel.dll", - "ref/netcore50/System.ObjectModel.xml", - "ref/netcore50/de/System.ObjectModel.xml", - "ref/netcore50/es/System.ObjectModel.xml", - "ref/netcore50/fr/System.ObjectModel.xml", - "ref/netcore50/it/System.ObjectModel.xml", - "ref/netcore50/ja/System.ObjectModel.xml", - "ref/netcore50/ko/System.ObjectModel.xml", - "ref/netcore50/ru/System.ObjectModel.xml", - "ref/netcore50/zh-hans/System.ObjectModel.xml", - "ref/netcore50/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.0/System.ObjectModel.dll", - "ref/netstandard1.0/System.ObjectModel.xml", - "ref/netstandard1.0/de/System.ObjectModel.xml", - "ref/netstandard1.0/es/System.ObjectModel.xml", - "ref/netstandard1.0/fr/System.ObjectModel.xml", - "ref/netstandard1.0/it/System.ObjectModel.xml", - "ref/netstandard1.0/ja/System.ObjectModel.xml", - "ref/netstandard1.0/ko/System.ObjectModel.xml", - "ref/netstandard1.0/ru/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.3/System.ObjectModel.dll", - "ref/netstandard1.3/System.ObjectModel.xml", - "ref/netstandard1.3/de/System.ObjectModel.xml", - "ref/netstandard1.3/es/System.ObjectModel.xml", - "ref/netstandard1.3/fr/System.ObjectModel.xml", - "ref/netstandard1.3/it/System.ObjectModel.xml", - "ref/netstandard1.3/ja/System.ObjectModel.xml", - "ref/netstandard1.3/ko/System.ObjectModel.xml", - "ref/netstandard1.3/ru/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hant/System.ObjectModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection/4.1.0": { - "sha512": "FFKGlU3SOEK/iuO6Zx424OPXN+Siu6eDoVhDtAoSEbeglWmpxSykqg24Ul0+aXYT6xZIeZVxmESJwjB9OL9t2g==", - "type": "package", - "path": "System.Reflection/4.1.0", - "files": [ - "System.Reflection.4.1.0.nupkg.sha512", - "System.Reflection.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Reflection.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Reflection.dll", - "ref/netcore50/System.Reflection.dll", - "ref/netcore50/System.Reflection.xml", - "ref/netcore50/de/System.Reflection.xml", - "ref/netcore50/es/System.Reflection.xml", - "ref/netcore50/fr/System.Reflection.xml", - "ref/netcore50/it/System.Reflection.xml", - "ref/netcore50/ja/System.Reflection.xml", - "ref/netcore50/ko/System.Reflection.xml", - "ref/netcore50/ru/System.Reflection.xml", - "ref/netcore50/zh-hans/System.Reflection.xml", - "ref/netcore50/zh-hant/System.Reflection.xml", - "ref/netstandard1.0/System.Reflection.dll", - "ref/netstandard1.0/System.Reflection.xml", - "ref/netstandard1.0/de/System.Reflection.xml", - "ref/netstandard1.0/es/System.Reflection.xml", - "ref/netstandard1.0/fr/System.Reflection.xml", - "ref/netstandard1.0/it/System.Reflection.xml", - "ref/netstandard1.0/ja/System.Reflection.xml", - "ref/netstandard1.0/ko/System.Reflection.xml", - "ref/netstandard1.0/ru/System.Reflection.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.xml", - "ref/netstandard1.3/System.Reflection.dll", - "ref/netstandard1.3/System.Reflection.xml", - "ref/netstandard1.3/de/System.Reflection.xml", - "ref/netstandard1.3/es/System.Reflection.xml", - "ref/netstandard1.3/fr/System.Reflection.xml", - "ref/netstandard1.3/it/System.Reflection.xml", - "ref/netstandard1.3/ja/System.Reflection.xml", - "ref/netstandard1.3/ko/System.Reflection.xml", - "ref/netstandard1.3/ru/System.Reflection.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.xml", - "ref/netstandard1.5/System.Reflection.dll", - "ref/netstandard1.5/System.Reflection.xml", - "ref/netstandard1.5/de/System.Reflection.xml", - "ref/netstandard1.5/es/System.Reflection.xml", - "ref/netstandard1.5/fr/System.Reflection.xml", - "ref/netstandard1.5/it/System.Reflection.xml", - "ref/netstandard1.5/ja/System.Reflection.xml", - "ref/netstandard1.5/ko/System.Reflection.xml", - "ref/netstandard1.5/ru/System.Reflection.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.DispatchProxy/4.0.1": { - "sha512": "O81cWVlqW0zOMrl/JHcgFWGUCDaOU9NwOIPYqnxL/pd8RjymYpwfYKsg2+SB5g9UdiIZLR3m6FEDya7iYGCdRg==", - "type": "package", - "path": "System.Reflection.DispatchProxy/4.0.1", - "files": [ - "System.Reflection.DispatchProxy.4.0.1.nupkg.sha512", - "System.Reflection.DispatchProxy.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/netstandard1.3/System.Reflection.DispatchProxy.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.3/System.Reflection.DispatchProxy.dll", - "ref/netstandard1.3/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/de/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/es/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/fr/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/it/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/ja/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/ko/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/ru/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.DispatchProxy.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.DispatchProxy.dll" - ] - }, - "System.Reflection.Emit/4.0.1": { - "sha512": "N5sMd/U2YE6RsSDLJyGLwWQfW3dKw6dDA+PpsBuNAK0zfx6HaR6NS2hLVGUDLFPXaJBC/2I2unrSMF5H8OwGZA==", - "type": "package", - "path": "System.Reflection.Emit/4.0.1", - "files": [ - "System.Reflection.Emit.4.0.1.nupkg.sha512", - "System.Reflection.Emit.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.dll", - "lib/netstandard1.3/System.Reflection.Emit.dll", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/net45/_._", - "ref/netstandard1.1/System.Reflection.Emit.dll", - "ref/netstandard1.1/System.Reflection.Emit.xml", - "ref/netstandard1.1/de/System.Reflection.Emit.xml", - "ref/netstandard1.1/es/System.Reflection.Emit.xml", - "ref/netstandard1.1/fr/System.Reflection.Emit.xml", - "ref/netstandard1.1/it/System.Reflection.Emit.xml", - "ref/netstandard1.1/ja/System.Reflection.Emit.xml", - "ref/netstandard1.1/ko/System.Reflection.Emit.xml", - "ref/netstandard1.1/ru/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", - "ref/xamarinmac20/_._" - ] - }, - "System.Reflection.Emit.ILGeneration/4.0.1": { - "sha512": "2lEx073cw4oK6yrgCGzunJLChfv4Up0d7Jf0jYi4801n5Ele0xCBq80BUYnOnanAUesnQ7tr7hOy7Erjodm91w==", - "type": "package", - "path": "System.Reflection.Emit.ILGeneration/4.0.1", - "files": [ - "System.Reflection.Emit.ILGeneration.4.0.1.nupkg.sha512", - "System.Reflection.Emit.ILGeneration.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.ILGeneration.dll", - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.ILGeneration.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Emit.Lightweight/4.0.1": { - "sha512": "VAzJsSMNm9zzvE9nPI2jYIxME/E7EgTXAebcL61s0l5KSzvjNQLZBx6FDpdzGo0OWYwm95Z7/WUAQc8Fvv9qXw==", - "type": "package", - "path": "System.Reflection.Emit.Lightweight/4.0.1", - "files": [ - "System.Reflection.Emit.Lightweight.4.0.1.nupkg.sha512", - "System.Reflection.Emit.Lightweight.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.Lightweight.dll", - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Extensions/4.0.1": { - "sha512": "7/jRI76NgXghZ7ECDBAJeEu0vY1SXf3hQv9uJXYWsZIO/4Q+uZ7V4geUXaVhwJBvIKYHddbnaiBan6K+1F2o4g==", - "type": "package", - "path": "System.Reflection.Extensions/4.0.1", - "files": [ - "System.Reflection.Extensions.4.0.1.nupkg.sha512", - "System.Reflection.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/netcore50/de/System.Reflection.Extensions.xml", - "ref/netcore50/es/System.Reflection.Extensions.xml", - "ref/netcore50/fr/System.Reflection.Extensions.xml", - "ref/netcore50/it/System.Reflection.Extensions.xml", - "ref/netcore50/ja/System.Reflection.Extensions.xml", - "ref/netcore50/ko/System.Reflection.Extensions.xml", - "ref/netcore50/ru/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hans/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hant/System.Reflection.Extensions.xml", - "ref/netstandard1.0/System.Reflection.Extensions.dll", - "ref/netstandard1.0/System.Reflection.Extensions.xml", - "ref/netstandard1.0/de/System.Reflection.Extensions.xml", - "ref/netstandard1.0/es/System.Reflection.Extensions.xml", - "ref/netstandard1.0/fr/System.Reflection.Extensions.xml", - "ref/netstandard1.0/it/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ja/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ko/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ru/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.Metadata/1.3.0": { - "sha512": "S8fpHDmJ2hcKQ/3K4KUyAmviLsFKAK8iEERQVYP7KJw5p9c945nxe5p+qePjvKEye0eZX1jcWRaMArpP8qLoTg==", - "type": "package", - "path": "System.Reflection.Metadata/1.3.0", - "files": [ - "System.Reflection.Metadata.1.3.0.nupkg.sha512", - "System.Reflection.Metadata.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/System.Reflection.Metadata.dll", - "lib/netstandard1.1/System.Reflection.Metadata.xml", - "lib/portable-net45+win8/System.Reflection.Metadata.dll", - "lib/portable-net45+win8/System.Reflection.Metadata.xml" - ] - }, - "System.Reflection.Primitives/4.0.1": { - "sha512": "RHbqVEi34/PglMEDY6K5G2CAiH+yqbDsIylzXbXLVJAklQ33CMb51Ip7grLfntTnhjg9zep3YeylTrGYxZDPfQ==", - "type": "package", - "path": "System.Reflection.Primitives/4.0.1", - "files": [ - "System.Reflection.Primitives.4.0.1.nupkg.sha512", - "System.Reflection.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/netcore50/de/System.Reflection.Primitives.xml", - "ref/netcore50/es/System.Reflection.Primitives.xml", - "ref/netcore50/fr/System.Reflection.Primitives.xml", - "ref/netcore50/it/System.Reflection.Primitives.xml", - "ref/netcore50/ja/System.Reflection.Primitives.xml", - "ref/netcore50/ko/System.Reflection.Primitives.xml", - "ref/netcore50/ru/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", - "ref/netstandard1.0/System.Reflection.Primitives.dll", - "ref/netstandard1.0/System.Reflection.Primitives.xml", - "ref/netstandard1.0/de/System.Reflection.Primitives.xml", - "ref/netstandard1.0/es/System.Reflection.Primitives.xml", - "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", - "ref/netstandard1.0/it/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.TypeExtensions/4.1.0": { - "sha512": "xcxE/0GefeVYwji0R3kKeJa4NoSPQ/nehbsE95FIfsBo7REzTf5F7Qe64wzjGQ1ynITB/aq+A3wNGk0COmNwhg==", - "type": "package", - "path": "System.Reflection.TypeExtensions/4.1.0", - "files": [ - "System.Reflection.TypeExtensions.4.1.0.nupkg.sha512", - "System.Reflection.TypeExtensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/net462/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/net462/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.5/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.TypeExtensions.dll" - ] - }, - "System.Resources.Reader/4.0.0": { - "sha512": "wEcXzSRd9Up0I0g8bFnq9ujB9RBi8ChqbUCwfpkWoNCE87ykVKgQ3UgFoow0DRR1qs3JoMDNcwFCZk/2j9GweA==", - "type": "package", - "path": "System.Resources.Reader/4.0.0", - "files": [ - "System.Resources.Reader.4.0.0.nupkg.sha512", - "System.Resources.Reader.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Resources.Reader.dll" - ] - }, - "System.Resources.ResourceManager/4.0.1": { - "sha512": "bt5OMnI0dENfXTKpRxGoJiINymmIz77xDlsZvj/Wqe1GcjmtoArvXd/nazztiqXm3J7Gx5RMo0m51I3TLtQENQ==", - "type": "package", - "path": "System.Resources.ResourceManager/4.0.1", - "files": [ - "System.Resources.ResourceManager.4.0.1.nupkg.sha512", - "System.Resources.ResourceManager.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/netcore50/de/System.Resources.ResourceManager.xml", - "ref/netcore50/es/System.Resources.ResourceManager.xml", - "ref/netcore50/fr/System.Resources.ResourceManager.xml", - "ref/netcore50/it/System.Resources.ResourceManager.xml", - "ref/netcore50/ja/System.Resources.ResourceManager.xml", - "ref/netcore50/ko/System.Resources.ResourceManager.xml", - "ref/netcore50/ru/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/System.Resources.ResourceManager.dll", - "ref/netstandard1.0/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime/4.1.0": { - "sha512": "AOI1YSwpYf4M2z/sZl/26HdH5KpygjfR0vRvTJZjgHTjRxucG7Cr8b3Ili69j0s2XUf2OnZitbIGNJUMyFVpqQ==", - "type": "package", - "path": "System.Runtime/4.1.0", - "files": [ - "System.Runtime.4.1.0.nupkg.sha512", - "System.Runtime.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Extensions/4.1.0": { - "sha512": "543BhQMyqyp353EiDkb7abmeme8H40shEjVdmbRz16WznSWHpzQVAWhIr/c327XwtoedYqgHJiLEtqc5RRyE7w==", - "type": "package", - "path": "System.Runtime.Extensions/4.1.0", - "files": [ - "System.Runtime.Extensions.4.1.0.nupkg.sha512", - "System.Runtime.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.xml", - "ref/netcore50/de/System.Runtime.Extensions.xml", - "ref/netcore50/es/System.Runtime.Extensions.xml", - "ref/netcore50/fr/System.Runtime.Extensions.xml", - "ref/netcore50/it/System.Runtime.Extensions.xml", - "ref/netcore50/ja/System.Runtime.Extensions.xml", - "ref/netcore50/ko/System.Runtime.Extensions.xml", - "ref/netcore50/ru/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hans/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.0/System.Runtime.Extensions.dll", - "ref/netstandard1.0/System.Runtime.Extensions.xml", - "ref/netstandard1.0/de/System.Runtime.Extensions.xml", - "ref/netstandard1.0/es/System.Runtime.Extensions.xml", - "ref/netstandard1.0/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.0/it/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.3/System.Runtime.Extensions.dll", - "ref/netstandard1.3/System.Runtime.Extensions.xml", - "ref/netstandard1.3/de/System.Runtime.Extensions.xml", - "ref/netstandard1.3/es/System.Runtime.Extensions.xml", - "ref/netstandard1.3/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.3/it/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.5/System.Runtime.Extensions.dll", - "ref/netstandard1.5/System.Runtime.Extensions.xml", - "ref/netstandard1.5/de/System.Runtime.Extensions.xml", - "ref/netstandard1.5/es/System.Runtime.Extensions.xml", - "ref/netstandard1.5/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.5/it/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Handles/4.0.1": { - "sha512": "RlFrTFpi/wWFUkiO+GAG8vaIes08tUzl8iU5Kok8/PQQtLEHn9+nF24xqClb6WM8HA4LulKVjAleu5qfk0GkjQ==", - "type": "package", - "path": "System.Runtime.Handles/4.0.1", - "files": [ - "System.Runtime.Handles.4.0.1.nupkg.sha512", - "System.Runtime.Handles.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Runtime.Handles.dll", - "ref/netstandard1.3/System.Runtime.Handles.xml", - "ref/netstandard1.3/de/System.Runtime.Handles.xml", - "ref/netstandard1.3/es/System.Runtime.Handles.xml", - "ref/netstandard1.3/fr/System.Runtime.Handles.xml", - "ref/netstandard1.3/it/System.Runtime.Handles.xml", - "ref/netstandard1.3/ja/System.Runtime.Handles.xml", - "ref/netstandard1.3/ko/System.Runtime.Handles.xml", - "ref/netstandard1.3/ru/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Handles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices/4.1.0": { - "sha512": "66DSgKoK3eBQVu/RWw691cWYGR85bB4+Pad+pRnPMkL82X/chYUhM+sr+MddZhma51NmrBa8XYqTUTNO0m1GpQ==", - "type": "package", - "path": "System.Runtime.InteropServices/4.1.0", - "files": [ - "System.Runtime.InteropServices.4.1.0.nupkg.sha512", - "System.Runtime.InteropServices.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.InteropServices.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.xml", - "ref/netcore50/de/System.Runtime.InteropServices.xml", - "ref/netcore50/es/System.Runtime.InteropServices.xml", - "ref/netcore50/fr/System.Runtime.InteropServices.xml", - "ref/netcore50/it/System.Runtime.InteropServices.xml", - "ref/netcore50/ja/System.Runtime.InteropServices.xml", - "ref/netcore50/ko/System.Runtime.InteropServices.xml", - "ref/netcore50/ru/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hans/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/System.Runtime.InteropServices.dll", - "ref/netstandard1.2/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/System.Runtime.InteropServices.dll", - "ref/netstandard1.3/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/System.Runtime.InteropServices.dll", - "ref/netstandard1.5/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.InteropServices.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices.RuntimeInformation/4.0.0": { - "sha512": "q/OiUBYq+ef78e5tAnLdJfLyuQIgNMA3TfvLrI+GLat17fIHstj4LSpAEAHuW5bCL0b4DIfw6I/u9JmdnetZSA==", - "type": "package", - "path": "System.Runtime.InteropServices.RuntimeInformation/4.0.0", - "files": [ - "System.Runtime.InteropServices.RuntimeInformation.4.0.0.nupkg.sha512", - "System.Runtime.InteropServices.RuntimeInformation.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/win8/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/wpa81/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll" - ] - }, - "System.Runtime.Loader/4.0.0": { - "sha512": "GVDPw97lKyJrAsvej1IORrFlN6RsHsII0OzoZvUpWkF6AknRI9a1cLUAlzxp/d4rUHhGgK7Wapp7TbIy7Rp8TA==", - "type": "package", - "path": "System.Runtime.Loader/4.0.0", - "files": [ - "System.Runtime.Loader.4.0.0.nupkg.sha512", - "System.Runtime.Loader.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net462/_._", - "lib/netstandard1.5/System.Runtime.Loader.dll", - "ref/netstandard1.5/System.Runtime.Loader.dll", - "ref/netstandard1.5/System.Runtime.Loader.xml", - "ref/netstandard1.5/de/System.Runtime.Loader.xml", - "ref/netstandard1.5/es/System.Runtime.Loader.xml", - "ref/netstandard1.5/fr/System.Runtime.Loader.xml", - "ref/netstandard1.5/it/System.Runtime.Loader.xml", - "ref/netstandard1.5/ja/System.Runtime.Loader.xml", - "ref/netstandard1.5/ko/System.Runtime.Loader.xml", - "ref/netstandard1.5/ru/System.Runtime.Loader.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Loader.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Loader.xml" - ] - }, - "System.Runtime.Numerics/4.0.1": { - "sha512": "laG2qiVk8jeL4KUuYhSBnm32EqEWDnzSfxe1QjhJD7c6DDwsqLjiIv3ck4gs5PGSYYCH5hSb5x32+5VxD/IiBw==", - "type": "package", - "path": "System.Runtime.Numerics/4.0.1", - "files": [ - "System.Runtime.Numerics.4.0.1.nupkg.sha512", - "System.Runtime.Numerics.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/netstandard1.3/System.Runtime.Numerics.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/netcore50/de/System.Runtime.Numerics.xml", - "ref/netcore50/es/System.Runtime.Numerics.xml", - "ref/netcore50/fr/System.Runtime.Numerics.xml", - "ref/netcore50/it/System.Runtime.Numerics.xml", - "ref/netcore50/ja/System.Runtime.Numerics.xml", - "ref/netcore50/ko/System.Runtime.Numerics.xml", - "ref/netcore50/ru/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hans/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hant/System.Runtime.Numerics.xml", - "ref/netstandard1.1/System.Runtime.Numerics.dll", - "ref/netstandard1.1/System.Runtime.Numerics.xml", - "ref/netstandard1.1/de/System.Runtime.Numerics.xml", - "ref/netstandard1.1/es/System.Runtime.Numerics.xml", - "ref/netstandard1.1/fr/System.Runtime.Numerics.xml", - "ref/netstandard1.1/it/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ja/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ko/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ru/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.Numerics.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "sha512": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", - "type": "package", - "path": "System.Runtime.Serialization.Primitives/4.1.1", - "files": [ - "System.Runtime.Serialization.Primitives.4.1.1.nupkg.sha512", - "System.Runtime.Serialization.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Runtime.Serialization.Primitives.dll", - "lib/netcore50/System.Runtime.Serialization.Primitives.dll", - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/de/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/es/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/it/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/System.Runtime.Serialization.Primitives.dll", - "ref/netstandard1.0/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/de/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/es/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/it/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll", - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/de/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/es/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/it/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll" - ] - }, - "System.Security.Claims/4.0.1": { - "sha512": "TdJNr7fWHYV0BxUCN3p9ihfTH94sLvBieTMI3SRmdzW5AEWwZ3kYrhQFUtlYcCxJIaLGAe7Bkxbhe2tYKTJtcg==", - "type": "package", - "path": "System.Security.Claims/4.0.1", - "files": [ - "System.Security.Claims.4.0.1.nupkg.sha512", - "System.Security.Claims.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Claims.dll", - "lib/netstandard1.3/System.Security.Claims.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Claims.dll", - "ref/netstandard1.3/System.Security.Claims.dll", - "ref/netstandard1.3/System.Security.Claims.xml", - "ref/netstandard1.3/de/System.Security.Claims.xml", - "ref/netstandard1.3/es/System.Security.Claims.xml", - "ref/netstandard1.3/fr/System.Security.Claims.xml", - "ref/netstandard1.3/it/System.Security.Claims.xml", - "ref/netstandard1.3/ja/System.Security.Claims.xml", - "ref/netstandard1.3/ko/System.Security.Claims.xml", - "ref/netstandard1.3/ru/System.Security.Claims.xml", - "ref/netstandard1.3/zh-hans/System.Security.Claims.xml", - "ref/netstandard1.3/zh-hant/System.Security.Claims.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Cryptography.Algorithms/4.2.0": { - "sha512": "VISLYkxSKh2Hx2FRpmuv1Hltyls8nWxqLLFiWUT2VUxbKXVco7zXpUDHIhSKtT7gKaM2BotwIRjF0UrfCawT2Q==", - "type": "package", - "path": "System.Security.Cryptography.Algorithms/4.2.0", - "files": [ - "System.Security.Cryptography.Algorithms.4.2.0.nupkg.sha512", - "System.Security.Cryptography.Algorithms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Algorithms.dll", - "lib/net461/System.Security.Cryptography.Algorithms.dll", - "lib/net463/System.Security.Cryptography.Algorithms.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Algorithms.dll", - "ref/net461/System.Security.Cryptography.Algorithms.dll", - "ref/net463/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.3/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.4/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll" - ] - }, - "System.Security.Cryptography.Cng/4.2.0": { - "sha512": "YVJ609JunCq++x47/5FsAzFS/0oRz/tYOcpxY4qVfWW0PSQ4CaTOvpG+nFxLv+uDAiKW5h8++eUSTgPsM+Df9g==", - "type": "package", - "path": "System.Security.Cryptography.Cng/4.2.0", - "files": [ - "System.Security.Cryptography.Cng.4.2.0.nupkg.sha512", - "System.Security.Cryptography.Cng.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Cryptography.Cng.dll", - "lib/net461/System.Security.Cryptography.Cng.dll", - "lib/net463/System.Security.Cryptography.Cng.dll", - "ref/net46/System.Security.Cryptography.Cng.dll", - "ref/net461/System.Security.Cryptography.Cng.dll", - "ref/net463/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.3/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.4/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.4/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll" - ] - }, - "System.Security.Cryptography.Csp/4.0.0": { - "sha512": "+79Zn4o7wmmjImypvxcpYZRkUIE0HpYGQqP/frDouaV5W2clx8CNWmI47fv6EFuPJr+S98YykBoDlwGMapIrnQ==", - "type": "package", - "path": "System.Security.Cryptography.Csp/4.0.0", - "files": [ - "System.Security.Cryptography.Csp.4.0.0.nupkg.sha512", - "System.Security.Cryptography.Csp.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Csp.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Csp.dll", - "ref/netstandard1.3/System.Security.Cryptography.Csp.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll" - ] - }, - "System.Security.Cryptography.Encoding/4.0.0": { - "sha512": "NViKmTxMps6OtW1a3U/pdt2OAqQxmgjO0NZs0A88iPqauL4FnZo9bo53G+ASfqfDIclTkofgaH1xBtO6pE3s+g==", - "type": "package", - "path": "System.Security.Cryptography.Encoding/4.0.0", - "files": [ - "System.Security.Cryptography.Encoding.4.0.0.nupkg.sha512", - "System.Security.Cryptography.Encoding.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.Encoding.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll" - ] - }, - "System.Security.Cryptography.OpenSsl/4.0.0": { - "sha512": "XLf1DoeZp6gAee2hqO14Nzgty5dWNlwdx/D77pc29rp6okb9FEkeWLfqWnHeV4ImoRNxiLi/JU09sPJcMBru5A==", - "type": "package", - "path": "System.Security.Cryptography.OpenSsl/4.0.0", - "files": [ - "System.Security.Cryptography.OpenSsl.4.0.0.nupkg.sha512", - "System.Security.Cryptography.OpenSsl.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "ref/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll" - ] - }, - "System.Security.Cryptography.Primitives/4.0.0": { - "sha512": "oXU/KGnf3TT2ykVPC/Arbo45a2OatGvw+Ko3KpdbIGuqRzN22YB34K39QpNviz6oE5v0VBLj4PWd+JLvNKdy0w==", - "type": "package", - "path": "System.Security.Cryptography.Primitives/4.0.0", - "files": [ - "System.Security.Cryptography.Primitives.4.0.0.nupkg.sha512", - "System.Security.Cryptography.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Primitives.dll", - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Primitives.dll", - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Cryptography.X509Certificates/4.1.0": { - "sha512": "w2uEJo9ShGvwpRlF9wFpfESMl0tyKCeLMQ9+LF6c7vCn6KR66XHoC+kBK3+7uBsRdWNDhUCowslZH4wZHWfs9A==", - "type": "package", - "path": "System.Security.Cryptography.X509Certificates/4.1.0", - "files": [ - "System.Security.Cryptography.X509Certificates.4.1.0.nupkg.sha512", - "System.Security.Cryptography.X509Certificates.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.X509Certificates.dll", - "lib/net461/System.Security.Cryptography.X509Certificates.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.X509Certificates.dll", - "ref/net461/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll" - ] - }, - "System.Security.Principal/4.0.1": { - "sha512": "2YVhlpjs7+fOcWRfPZ7HKZTVlahADbExA0WvHWS9OM7SkBY4SS+OeuYn2oIPuCTaezKY/OMBjPbpsW/bQh5wRA==", - "type": "package", - "path": "System.Security.Principal/4.0.1", - "files": [ - "System.Security.Principal.4.0.1.nupkg.sha512", - "System.Security.Principal.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Security.Principal.dll", - "lib/netstandard1.0/System.Security.Principal.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Security.Principal.dll", - "ref/netcore50/System.Security.Principal.xml", - "ref/netcore50/de/System.Security.Principal.xml", - "ref/netcore50/es/System.Security.Principal.xml", - "ref/netcore50/fr/System.Security.Principal.xml", - "ref/netcore50/it/System.Security.Principal.xml", - "ref/netcore50/ja/System.Security.Principal.xml", - "ref/netcore50/ko/System.Security.Principal.xml", - "ref/netcore50/ru/System.Security.Principal.xml", - "ref/netcore50/zh-hans/System.Security.Principal.xml", - "ref/netcore50/zh-hant/System.Security.Principal.xml", - "ref/netstandard1.0/System.Security.Principal.dll", - "ref/netstandard1.0/System.Security.Principal.xml", - "ref/netstandard1.0/de/System.Security.Principal.xml", - "ref/netstandard1.0/es/System.Security.Principal.xml", - "ref/netstandard1.0/fr/System.Security.Principal.xml", - "ref/netstandard1.0/it/System.Security.Principal.xml", - "ref/netstandard1.0/ja/System.Security.Principal.xml", - "ref/netstandard1.0/ko/System.Security.Principal.xml", - "ref/netstandard1.0/ru/System.Security.Principal.xml", - "ref/netstandard1.0/zh-hans/System.Security.Principal.xml", - "ref/netstandard1.0/zh-hant/System.Security.Principal.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Principal.Windows/4.0.0": { - "sha512": "0fkMXcsodkuQp6KaCiiutGfBFB5AqqWJF9fQB05wDJYJi8Ceerx+Mp3NVofA/HeZ4ngY+gFg0t6P3OAkpSCTYQ==", - "type": "package", - "path": "System.Security.Principal.Windows/4.0.0", - "files": [ - "System.Security.Principal.Windows.4.0.0.nupkg.sha512", - "System.Security.Principal.Windows.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Principal.Windows.dll", - "ref/net46/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/de/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/es/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/fr/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/it/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ja/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ko/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ru/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hans/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hant/System.Security.Principal.Windows.xml", - "runtimes/unix/lib/netstandard1.3/System.Security.Principal.Windows.dll", - "runtimes/win/lib/net46/System.Security.Principal.Windows.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll" - ] - }, - "System.Text.Encoding/4.0.11": { - "sha512": "VmNf3C4yhkGkFEahnzG4ANqjyzgXC82XvG0434o8XRGRBC7x/2C/GuDGIe95a/SjA9bJjho4JxP0xVuyZm2vVw==", - "type": "package", - "path": "System.Text.Encoding/4.0.11", - "files": [ - "System.Text.Encoding.4.0.11.nupkg.sha512", - "System.Text.Encoding.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.dll", - "ref/netcore50/System.Text.Encoding.xml", - "ref/netcore50/de/System.Text.Encoding.xml", - "ref/netcore50/es/System.Text.Encoding.xml", - "ref/netcore50/fr/System.Text.Encoding.xml", - "ref/netcore50/it/System.Text.Encoding.xml", - "ref/netcore50/ja/System.Text.Encoding.xml", - "ref/netcore50/ko/System.Text.Encoding.xml", - "ref/netcore50/ru/System.Text.Encoding.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.0/System.Text.Encoding.dll", - "ref/netstandard1.0/System.Text.Encoding.xml", - "ref/netstandard1.0/de/System.Text.Encoding.xml", - "ref/netstandard1.0/es/System.Text.Encoding.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.xml", - "ref/netstandard1.0/it/System.Text.Encoding.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.3/System.Text.Encoding.dll", - "ref/netstandard1.3/System.Text.Encoding.xml", - "ref/netstandard1.3/de/System.Text.Encoding.xml", - "ref/netstandard1.3/es/System.Text.Encoding.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.xml", - "ref/netstandard1.3/it/System.Text.Encoding.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.Encoding.CodePages/4.0.1": { - "sha512": "9Ovjc/+OFvoxe77pOHRiwu0mph0MNmXa2qOKq2XS672f0CPZ3Z4X5/wpqBVYfuaut72OSLrBb1MvIm8MhEtgvA==", - "type": "package", - "path": "System.Text.Encoding.CodePages/4.0.1", - "files": [ - "System.Text.Encoding.CodePages.4.0.1.nupkg.sha512", - "System.Text.Encoding.CodePages.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Text.Encoding.CodePages.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.3/System.Text.Encoding.CodePages.dll", - "ref/netstandard1.3/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/de/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/es/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/it/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.CodePages.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll", - "runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll" - ] - }, - "System.Text.Encoding.Extensions/4.0.11": { - "sha512": "2bid7vf9JAPdw4zYnPtRXTJGWr1XR372EwzSNFJIT8ctmsZSHqGxcjVx/xUYfHtG8QN/mILpLSM3BUMCfEST4Q==", - "type": "package", - "path": "System.Text.Encoding.Extensions/4.0.11", - "files": [ - "System.Text.Encoding.Extensions.4.0.11.nupkg.sha512", - "System.Text.Encoding.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.Extensions.dll", - "ref/netcore50/System.Text.Encoding.Extensions.xml", - "ref/netcore50/de/System.Text.Encoding.Extensions.xml", - "ref/netcore50/es/System.Text.Encoding.Extensions.xml", - "ref/netcore50/fr/System.Text.Encoding.Extensions.xml", - "ref/netcore50/it/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ja/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ko/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ru/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.0/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.3/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.RegularExpressions/4.1.0": { - "sha512": "RpuCs3WWe11xaEivjjft+sxZ8w92OXpOzCkAS96Uvgs9XYWtGMfPhPuBPUgaCNYEtSOkwXDiSYxwQy/UtK0FVw==", - "type": "package", - "path": "System.Text.RegularExpressions/4.1.0", - "files": [ - "System.Text.RegularExpressions.4.1.0.nupkg.sha512", - "System.Text.RegularExpressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Text.RegularExpressions.dll", - "lib/netcore50/System.Text.RegularExpressions.dll", - "lib/netstandard1.6/System.Text.RegularExpressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.xml", - "ref/netcore50/de/System.Text.RegularExpressions.xml", - "ref/netcore50/es/System.Text.RegularExpressions.xml", - "ref/netcore50/fr/System.Text.RegularExpressions.xml", - "ref/netcore50/it/System.Text.RegularExpressions.xml", - "ref/netcore50/ja/System.Text.RegularExpressions.xml", - "ref/netcore50/ko/System.Text.RegularExpressions.xml", - "ref/netcore50/ru/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hans/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/System.Text.RegularExpressions.dll", - "ref/netstandard1.3/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/System.Text.RegularExpressions.dll", - "ref/netstandard1.6/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hant/System.Text.RegularExpressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading/4.0.11": { - "sha512": "RKqouvORktflN2qrqXkwlA2jzKlv2re7S2tXD7ccg706T87CCWP6d34oFX8o4m7aOKcAtETwbDM6q6pp06goAQ==", - "type": "package", - "path": "System.Threading/4.0.11", - "files": [ - "System.Threading.4.0.11.nupkg.sha512", - "System.Threading.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.dll", - "lib/netstandard1.3/System.Threading.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.dll", - "ref/netcore50/System.Threading.xml", - "ref/netcore50/de/System.Threading.xml", - "ref/netcore50/es/System.Threading.xml", - "ref/netcore50/fr/System.Threading.xml", - "ref/netcore50/it/System.Threading.xml", - "ref/netcore50/ja/System.Threading.xml", - "ref/netcore50/ko/System.Threading.xml", - "ref/netcore50/ru/System.Threading.xml", - "ref/netcore50/zh-hans/System.Threading.xml", - "ref/netcore50/zh-hant/System.Threading.xml", - "ref/netstandard1.0/System.Threading.dll", - "ref/netstandard1.0/System.Threading.xml", - "ref/netstandard1.0/de/System.Threading.xml", - "ref/netstandard1.0/es/System.Threading.xml", - "ref/netstandard1.0/fr/System.Threading.xml", - "ref/netstandard1.0/it/System.Threading.xml", - "ref/netstandard1.0/ja/System.Threading.xml", - "ref/netstandard1.0/ko/System.Threading.xml", - "ref/netstandard1.0/ru/System.Threading.xml", - "ref/netstandard1.0/zh-hans/System.Threading.xml", - "ref/netstandard1.0/zh-hant/System.Threading.xml", - "ref/netstandard1.3/System.Threading.dll", - "ref/netstandard1.3/System.Threading.xml", - "ref/netstandard1.3/de/System.Threading.xml", - "ref/netstandard1.3/es/System.Threading.xml", - "ref/netstandard1.3/fr/System.Threading.xml", - "ref/netstandard1.3/it/System.Threading.xml", - "ref/netstandard1.3/ja/System.Threading.xml", - "ref/netstandard1.3/ko/System.Threading.xml", - "ref/netstandard1.3/ru/System.Threading.xml", - "ref/netstandard1.3/zh-hans/System.Threading.xml", - "ref/netstandard1.3/zh-hant/System.Threading.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Threading.dll" - ] - }, - "System.Threading.Overlapped/4.0.1": { - "sha512": "i4TFJn9x/ItIURnFrCtt38dGEcRadrvtJZ0f1ooNpywjWQCFPu6rm1AnQ0Kx+7kMgwkx1P/VLrDCiFx1GMh94w==", - "type": "package", - "path": "System.Threading.Overlapped/4.0.1", - "files": [ - "System.Threading.Overlapped.4.0.1.nupkg.sha512", - "System.Threading.Overlapped.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Threading.Overlapped.dll", - "ref/net46/System.Threading.Overlapped.dll", - "ref/netstandard1.3/System.Threading.Overlapped.dll", - "ref/netstandard1.3/System.Threading.Overlapped.xml", - "ref/netstandard1.3/de/System.Threading.Overlapped.xml", - "ref/netstandard1.3/es/System.Threading.Overlapped.xml", - "ref/netstandard1.3/fr/System.Threading.Overlapped.xml", - "ref/netstandard1.3/it/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ja/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ko/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ru/System.Threading.Overlapped.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Overlapped.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Overlapped.xml", - "runtimes/unix/lib/netstandard1.3/System.Threading.Overlapped.dll", - "runtimes/win/lib/net46/System.Threading.Overlapped.dll", - "runtimes/win/lib/netcore50/System.Threading.Overlapped.dll", - "runtimes/win/lib/netstandard1.3/System.Threading.Overlapped.dll" - ] - }, - "System.Threading.Tasks/4.0.11": { - "sha512": "8dx7BKkXtbEuLYR+D99ZBz6xoEvmAyK+uk4j3kIbSC730jeIfh2KFECHztuHI/9jMHGWCXZlVpw4XJevgpAweQ==", - "type": "package", - "path": "System.Threading.Tasks/4.0.11", - "files": [ - "System.Threading.Tasks.4.0.11.nupkg.sha512", - "System.Threading.Tasks.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.dll", - "ref/netcore50/System.Threading.Tasks.xml", - "ref/netcore50/de/System.Threading.Tasks.xml", - "ref/netcore50/es/System.Threading.Tasks.xml", - "ref/netcore50/fr/System.Threading.Tasks.xml", - "ref/netcore50/it/System.Threading.Tasks.xml", - "ref/netcore50/ja/System.Threading.Tasks.xml", - "ref/netcore50/ko/System.Threading.Tasks.xml", - "ref/netcore50/ru/System.Threading.Tasks.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.0/System.Threading.Tasks.dll", - "ref/netstandard1.0/System.Threading.Tasks.xml", - "ref/netstandard1.0/de/System.Threading.Tasks.xml", - "ref/netstandard1.0/es/System.Threading.Tasks.xml", - "ref/netstandard1.0/fr/System.Threading.Tasks.xml", - "ref/netstandard1.0/it/System.Threading.Tasks.xml", - "ref/netstandard1.0/ja/System.Threading.Tasks.xml", - "ref/netstandard1.0/ko/System.Threading.Tasks.xml", - "ref/netstandard1.0/ru/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.3/System.Threading.Tasks.dll", - "ref/netstandard1.3/System.Threading.Tasks.xml", - "ref/netstandard1.3/de/System.Threading.Tasks.xml", - "ref/netstandard1.3/es/System.Threading.Tasks.xml", - "ref/netstandard1.3/fr/System.Threading.Tasks.xml", - "ref/netstandard1.3/it/System.Threading.Tasks.xml", - "ref/netstandard1.3/ja/System.Threading.Tasks.xml", - "ref/netstandard1.3/ko/System.Threading.Tasks.xml", - "ref/netstandard1.3/ru/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "sha512": "MyOVg+TfJE75GjXQwOYMJF/VLuVvLgRPKCG9e2Rci5PBk+lmFyvMUsqwsZIPiVd17fVkrYQ4PG9pe3PTRifYmQ==", - "type": "package", - "path": "System.Threading.Tasks.Dataflow/4.6.0", - "files": [ - "System.Threading.Tasks.Dataflow.4.6.0.nupkg.sha512", - "System.Threading.Tasks.Dataflow.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Dataflow.XML", - "lib/netstandard1.0/System.Threading.Tasks.Dataflow.dll", - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.XML", - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll" - ] - }, - "System.Threading.Tasks.Extensions/4.0.0": { - "sha512": "CEb+Dxk1mpyLjMSdShNL/36ZxzbSiW7ti8GOs8xVEui5gv3xHqPDOHNfY/MCnyne4x/gYEkds0ai/X9KCgUoyw==", - "type": "package", - "path": "System.Threading.Tasks.Extensions/4.0.0", - "files": [ - "System.Threading.Tasks.Extensions.4.0.0.nupkg.sha512", - "System.Threading.Tasks.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml" - ] - }, - "System.Threading.Tasks.Parallel/4.0.1": { - "sha512": "Y0MBvfr+Z6ojLsIsTmjZ37EB2cGg7nUV8y1uyKIDk0CUg3njckhIfpoWL599Jf15EUO2m1tkCcehcRQrEQX4XQ==", - "type": "package", - "path": "System.Threading.Tasks.Parallel/4.0.1", - "files": [ - "System.Threading.Tasks.Parallel.4.0.1.nupkg.sha512", - "System.Threading.Tasks.Parallel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.Tasks.Parallel.dll", - "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.Parallel.dll", - "ref/netcore50/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/de/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/es/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/fr/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/it/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/ja/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/ko/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/ru/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll", - "ref/netstandard1.1/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/de/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/es/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/fr/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/it/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/ja/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/ko/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/ru/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/zh-hans/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/zh-hant/System.Threading.Tasks.Parallel.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Thread/4.0.0": { - "sha512": "NRqCZ+KcpDqPa8pgFLiUAdE1xEh4iI01lIwLxEjImlzPveSo3EuS0xJgLZHT5eOg7BZ4yfTuuT/3JmXi0aJ0IA==", - "type": "package", - "path": "System.Threading.Thread/4.0.0", - "files": [ - "System.Threading.Thread.4.0.0.nupkg.sha512", - "System.Threading.Thread.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Threading.Thread.dll", - "lib/netcore50/_._", - "lib/netstandard1.3/System.Threading.Thread.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Threading.Thread.dll", - "ref/netstandard1.3/System.Threading.Thread.dll", - "ref/netstandard1.3/System.Threading.Thread.xml", - "ref/netstandard1.3/de/System.Threading.Thread.xml", - "ref/netstandard1.3/es/System.Threading.Thread.xml", - "ref/netstandard1.3/fr/System.Threading.Thread.xml", - "ref/netstandard1.3/it/System.Threading.Thread.xml", - "ref/netstandard1.3/ja/System.Threading.Thread.xml", - "ref/netstandard1.3/ko/System.Threading.Thread.xml", - "ref/netstandard1.3/ru/System.Threading.Thread.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Thread.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Thread.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.ThreadPool/4.0.10": { - "sha512": "PqObppfzXpCiZ4oVYhvDQCeqgcb3jMYCdAzZcBmu2e4toUKxauZccbgV0LAqGpoHNbPuMzQYvcSFsidjHM/b6w==", - "type": "package", - "path": "System.Threading.ThreadPool/4.0.10", - "files": [ - "System.Threading.ThreadPool.4.0.10.nupkg.sha512", - "System.Threading.ThreadPool.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Threading.ThreadPool.dll", - "lib/netcore50/_._", - "lib/netstandard1.3/System.Threading.ThreadPool.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Threading.ThreadPool.dll", - "ref/netstandard1.3/System.Threading.ThreadPool.dll", - "ref/netstandard1.3/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/de/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/es/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/fr/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/it/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/ja/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/ko/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/ru/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/zh-hans/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/zh-hant/System.Threading.ThreadPool.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Timer/4.0.1": { - "sha512": "XqyRQNBWn8ufOUunRZSOb3pvCw8yFYNEcdsFv7Fweln9kM3tewTPdQYqFWM8dSF7l0xvE6IVc6plNkPVq+JSKQ==", - "type": "package", - "path": "System.Threading.Timer/4.0.1", - "files": [ - "System.Threading.Timer.4.0.1.nupkg.sha512", - "System.Threading.Timer.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net451/_._", - "lib/portable-net451+win81+wpa81/_._", - "lib/win81/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/netcore50/de/System.Threading.Timer.xml", - "ref/netcore50/es/System.Threading.Timer.xml", - "ref/netcore50/fr/System.Threading.Timer.xml", - "ref/netcore50/it/System.Threading.Timer.xml", - "ref/netcore50/ja/System.Threading.Timer.xml", - "ref/netcore50/ko/System.Threading.Timer.xml", - "ref/netcore50/ru/System.Threading.Timer.xml", - "ref/netcore50/zh-hans/System.Threading.Timer.xml", - "ref/netcore50/zh-hant/System.Threading.Timer.xml", - "ref/netstandard1.2/System.Threading.Timer.dll", - "ref/netstandard1.2/System.Threading.Timer.xml", - "ref/netstandard1.2/de/System.Threading.Timer.xml", - "ref/netstandard1.2/es/System.Threading.Timer.xml", - "ref/netstandard1.2/fr/System.Threading.Timer.xml", - "ref/netstandard1.2/it/System.Threading.Timer.xml", - "ref/netstandard1.2/ja/System.Threading.Timer.xml", - "ref/netstandard1.2/ko/System.Threading.Timer.xml", - "ref/netstandard1.2/ru/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hans/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hant/System.Threading.Timer.xml", - "ref/portable-net451+win81+wpa81/_._", - "ref/win81/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.ReaderWriter/4.0.11": { - "sha512": "dHSnMBUB+j+IaErbR/agsq+dhUq7LOK4YD6Hi9oT1lqcTCJlVNUafBu6UYIRJl/uyHBZDztSvJn0AsUjJsCUNQ==", - "type": "package", - "path": "System.Xml.ReaderWriter/4.0.11", - "files": [ - "System.Xml.ReaderWriter.4.0.11.nupkg.sha512", - "System.Xml.ReaderWriter.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Xml.ReaderWriter.dll", - "lib/netstandard1.3/System.Xml.ReaderWriter.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.xml", - "ref/netcore50/de/System.Xml.ReaderWriter.xml", - "ref/netcore50/es/System.Xml.ReaderWriter.xml", - "ref/netcore50/fr/System.Xml.ReaderWriter.xml", - "ref/netcore50/it/System.Xml.ReaderWriter.xml", - "ref/netcore50/ja/System.Xml.ReaderWriter.xml", - "ref/netcore50/ko/System.Xml.ReaderWriter.xml", - "ref/netcore50/ru/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/System.Xml.ReaderWriter.dll", - "ref/netstandard1.0/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/System.Xml.ReaderWriter.dll", - "ref/netstandard1.3/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hant/System.Xml.ReaderWriter.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XDocument/4.0.11": { - "sha512": "XLHQfydc7p2RbCzj5ihEHGdqBWoxvcvEJqHp6Ai3GSfI0V8AaDf3EiJGz7OxUmsJ9Ul+Y3BqptgdaJJ+xwEbhQ==", - "type": "package", - "path": "System.Xml.XDocument/4.0.11", - "files": [ - "System.Xml.XDocument.4.0.11.nupkg.sha512", - "System.Xml.XDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Xml.XDocument.dll", - "lib/netstandard1.3/System.Xml.XDocument.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Xml.XDocument.dll", - "ref/netcore50/System.Xml.XDocument.xml", - "ref/netcore50/de/System.Xml.XDocument.xml", - "ref/netcore50/es/System.Xml.XDocument.xml", - "ref/netcore50/fr/System.Xml.XDocument.xml", - "ref/netcore50/it/System.Xml.XDocument.xml", - "ref/netcore50/ja/System.Xml.XDocument.xml", - "ref/netcore50/ko/System.Xml.XDocument.xml", - "ref/netcore50/ru/System.Xml.XDocument.xml", - "ref/netcore50/zh-hans/System.Xml.XDocument.xml", - "ref/netcore50/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.0/System.Xml.XDocument.dll", - "ref/netstandard1.0/System.Xml.XDocument.xml", - "ref/netstandard1.0/de/System.Xml.XDocument.xml", - "ref/netstandard1.0/es/System.Xml.XDocument.xml", - "ref/netstandard1.0/fr/System.Xml.XDocument.xml", - "ref/netstandard1.0/it/System.Xml.XDocument.xml", - "ref/netstandard1.0/ja/System.Xml.XDocument.xml", - "ref/netstandard1.0/ko/System.Xml.XDocument.xml", - "ref/netstandard1.0/ru/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.3/System.Xml.XDocument.dll", - "ref/netstandard1.3/System.Xml.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XDocument.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XmlDocument/4.0.1": { - "sha512": "N+iCqYdwMsMbCJwmq0GLQ3LcqbNHAykiDiOAxPMAvtbUjQCkJ6rnmA1056PcHCn2+mYQMNYvSNkeuB2MkMlXhg==", - "type": "package", - "path": "System.Xml.XmlDocument/4.0.1", - "files": [ - "System.Xml.XmlDocument.4.0.1.nupkg.sha512", - "System.Xml.XmlDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Xml.XmlDocument.dll", - "lib/netstandard1.3/System.Xml.XmlDocument.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Xml.XmlDocument.dll", - "ref/netstandard1.3/System.Xml.XmlDocument.dll", - "ref/netstandard1.3/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/de/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/es/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/it/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XmlDocument.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XPath/4.0.1": { - "sha512": "IEz24tPX9CmGFq3/ml1FrqFfZhIWUdWGcCcYb8o8C5c49QxE8oddNicB7+s7leqkoc9y+iwX+ROV4czAry5MxA==", - "type": "package", - "path": "System.Xml.XPath/4.0.1", - "files": [ - "System.Xml.XPath.4.0.1.nupkg.sha512", - "System.Xml.XPath.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Xml.XPath.dll", - "lib/netstandard1.3/System.Xml.XPath.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Xml.XPath.dll", - "ref/netstandard1.3/System.Xml.XPath.dll", - "ref/netstandard1.3/System.Xml.XPath.xml", - "ref/netstandard1.3/de/System.Xml.XPath.xml", - "ref/netstandard1.3/es/System.Xml.XPath.xml", - "ref/netstandard1.3/fr/System.Xml.XPath.xml", - "ref/netstandard1.3/it/System.Xml.XPath.xml", - "ref/netstandard1.3/ja/System.Xml.XPath.xml", - "ref/netstandard1.3/ko/System.Xml.XPath.xml", - "ref/netstandard1.3/ru/System.Xml.XPath.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XPath.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XPath.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XPath.XDocument/4.0.1": { - "sha512": "Ss+3IwdbmGeUvnRogYM6WhQjP7uxp/wlXMa/GlZLv4HR+xlazQxxJkDA55IhLePeuSC/fkNiIY1W1QvfYnVf/g==", - "type": "package", - "path": "System.Xml.XPath.XDocument/4.0.1", - "files": [ - "System.Xml.XPath.XDocument.4.0.1.nupkg.sha512", - "System.Xml.XPath.XDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Xml.XPath.XDocument.dll", - "lib/netstandard1.3/System.Xml.XPath.XDocument.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Xml.XPath.XDocument.dll", - "ref/netstandard1.3/System.Xml.XPath.XDocument.dll", - "ref/netstandard1.3/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XPath.XDocument.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - } - }, - "projectFileDependencyGroups": { - "": [ - "Newtonsoft.Json >= 9.0.1" - ], - ".NETCoreApp,Version=v1.0": [ - "Microsoft.NETCore.App >= 1.0.1" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_Lua_JSON/JSON.lua b/tests/JSONTestSuite/parsers/test_Lua_JSON/JSON.lua deleted file mode 100644 index cb9d54f7c..000000000 --- a/tests/JSONTestSuite/parsers/test_Lua_JSON/JSON.lua +++ /dev/null @@ -1,1451 +0,0 @@ --- -*- coding: utf-8 -*- --- --- Simple JSON encoding and decoding in pure Lua. --- --- Copyright 2010-2016 Jeffrey Friedl --- http://regex.info/blog/ --- Latest version: http://regex.info/blog/lua/json --- --- This code is released under a Creative Commons CC-BY "Attribution" License: --- http://creativecommons.org/licenses/by/3.0/deed.en_US --- --- It can be used for any purpose so long as the copyright notice above, --- the web-page links above, and the 'AUTHOR_NOTE' string below are --- maintained. Enjoy. --- -local VERSION = 20160916.19 -- version history at end of file -local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20160916.19 ]-" - --- --- The 'AUTHOR_NOTE' variable exists so that information about the source --- of the package is maintained even in compiled versions. It's also --- included in OBJDEF below mostly to quiet warnings about unused variables. --- -local OBJDEF = { - VERSION = VERSION, - AUTHOR_NOTE = AUTHOR_NOTE, -} - - --- --- Simple JSON encoding and decoding in pure Lua. --- JSON definition: http://www.json.org/ --- --- --- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines --- --- local lua_value = JSON:decode(raw_json_text) --- --- local raw_json_text = JSON:encode(lua_table_or_value) --- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability --- --- --- --- DECODING (from a JSON string to a Lua table) --- --- --- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines --- --- local lua_value = JSON:decode(raw_json_text) --- --- If the JSON text is for an object or an array, e.g. --- { "what": "books", "count": 3 } --- or --- [ "Larry", "Curly", "Moe" ] --- --- the result is a Lua table, e.g. --- { what = "books", count = 3 } --- or --- { "Larry", "Curly", "Moe" } --- --- --- The encode and decode routines accept an optional second argument, --- "etc", which is not used during encoding or decoding, but upon error --- is passed along to error handlers. It can be of any type (including nil). --- --- --- --- ERROR HANDLING --- --- With most errors during decoding, this code calls --- --- JSON:onDecodeError(message, text, location, etc) --- --- with a message about the error, and if known, the JSON text being --- parsed and the byte count where the problem was discovered. You can --- replace the default JSON:onDecodeError() with your own function. --- --- The default onDecodeError() merely augments the message with data --- about the text and the location if known (and if a second 'etc' --- argument had been provided to decode(), its value is tacked onto the --- message as well), and then calls JSON.assert(), which itself defaults --- to Lua's built-in assert(), and can also be overridden. --- --- For example, in an Adobe Lightroom plugin, you might use something like --- --- function JSON:onDecodeError(message, text, location, etc) --- LrErrors.throwUserError("Internal Error: invalid JSON data") --- end --- --- or even just --- --- function JSON.assert(message) --- LrErrors.throwUserError("Internal Error: " .. message) --- end --- --- If JSON:decode() is passed a nil, this is called instead: --- --- JSON:onDecodeOfNilError(message, nil, nil, etc) --- --- and if JSON:decode() is passed HTML instead of JSON, this is called: --- --- JSON:onDecodeOfHTMLError(message, text, nil, etc) --- --- The use of the fourth 'etc' argument allows stronger coordination --- between decoding and error reporting, especially when you provide your --- own error-handling routines. Continuing with the the Adobe Lightroom --- plugin example: --- --- function JSON:onDecodeError(message, text, location, etc) --- local note = "Internal Error: invalid JSON data" --- if type(etc) = 'table' and etc.photo then --- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') --- end --- LrErrors.throwUserError(note) --- end --- --- : --- : --- --- for i, photo in ipairs(photosToProcess) do --- : --- : --- local data = JSON:decode(someJsonText, { photo = photo }) --- : --- : --- end --- --- --- --- --- --- DECODING AND STRICT TYPES --- --- Because both JSON objects and JSON arrays are converted to Lua tables, --- it's not normally possible to tell which original JSON type a --- particular Lua table was derived from, or guarantee decode-encode --- round-trip equivalency. --- --- However, if you enable strictTypes, e.g. --- --- JSON = assert(loadfile "JSON.lua")() --load the routines --- JSON.strictTypes = true --- --- then the Lua table resulting from the decoding of a JSON object or --- JSON array is marked via Lua metatable, so that when re-encoded with --- JSON:encode() it ends up as the appropriate JSON type. --- --- (This is not the default because other routines may not work well with --- tables that have a metatable set, for example, Lightroom API calls.) --- --- --- ENCODING (from a lua table to a JSON string) --- --- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines --- --- local raw_json_text = JSON:encode(lua_table_or_value) --- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability --- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) --- --- On error during encoding, this code calls: --- --- JSON:onEncodeError(message, etc) --- --- which you can override in your local JSON object. --- --- The 'etc' in the error call is the second argument to encode() --- and encode_pretty(), or nil if it wasn't provided. --- --- --- ENCODING OPTIONS --- --- An optional third argument, a table of options, can be provided to encode(). --- --- encode_options = { --- -- options for making "pretty" human-readable JSON (see "PRETTY-PRINTING" below) --- pretty = true, --- indent = " ", --- align_keys = false, --- --- -- other output-related options --- null = "\0", -- see "ENCODING JSON NULL VALUES" below --- stringsAreUtf8 = false, -- see "HANDLING UNICODE LINE AND PARAGRAPH SEPARATORS FOR JAVA" below --- } --- --- json_string = JSON:encode(mytable, etc, encode_options) --- --- --- --- For reference, the defaults are: --- --- pretty = false --- null = nil, --- stringsAreUtf8 = false, --- --- --- --- PRETTY-PRINTING --- --- Enabling the 'pretty' encode option helps generate human-readable JSON. --- --- pretty = JSON:encode(val, etc, { --- pretty = true, --- indent = " ", --- align_keys = false, --- }) --- --- encode_pretty() is also provided: it's identical to encode() except --- that encode_pretty() provides a default options table if none given in the call: --- --- { pretty = true, align_keys = false, indent = " " } --- --- For example, if --- --- JSON:encode(data) --- --- produces: --- --- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} --- --- then --- --- JSON:encode_pretty(data) --- --- produces: --- --- { --- "city": "Kyoto", --- "climate": { --- "avg_temp": 16, --- "humidity": "high", --- "snowfall": "minimal" --- }, --- "country": "Japan", --- "wards": 11 --- } --- --- The following three lines return identical results: --- JSON:encode_pretty(data) --- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) --- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) --- --- An example of setting your own indent string: --- --- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) --- --- produces: --- --- { --- | "city": "Kyoto", --- | "climate": { --- | | "avg_temp": 16, --- | | "humidity": "high", --- | | "snowfall": "minimal" --- | }, --- | "country": "Japan", --- | "wards": 11 --- } --- --- An example of setting align_keys to true: --- --- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) --- --- produces: --- --- { --- "city": "Kyoto", --- "climate": { --- "avg_temp": 16, --- "humidity": "high", --- "snowfall": "minimal" --- }, --- "country": "Japan", --- "wards": 11 --- } --- --- which I must admit is kinda ugly, sorry. This was the default for --- encode_pretty() prior to version 20141223.14. --- --- --- HANDLING UNICODE LINE AND PARAGRAPH SEPARATORS FOR JAVA --- --- If the 'stringsAreUtf8' encode option is set to true, consider Lua strings not as a sequence of bytes, --- but as a sequence of UTF-8 characters. --- --- Currently, the only practical effect of setting this option is that Unicode LINE and PARAGRAPH --- separators, if found in a string, are encoded with a JSON escape instead of being dumped as is. --- The JSON is valid either way, but encoding this way, apparently, allows the resulting JSON --- to also be valid Java. --- --- AMBIGUOUS SITUATIONS DURING THE ENCODING --- --- During the encode, if a Lua table being encoded contains both string --- and numeric keys, it fits neither JSON's idea of an object, nor its --- idea of an array. To get around this, when any string key exists (or --- when non-positive numeric keys exist), numeric keys are converted to --- strings. --- --- For example, --- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) --- produces the JSON object --- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} --- --- To prohibit this conversion and instead make it an error condition, set --- JSON.noKeyConversion = true --- --- --- ENCODING JSON NULL VALUES --- --- Lua tables completely omit keys whose value is nil, so without special handling there's --- no way to get a field in a JSON object with a null value. For example --- JSON:encode({ username = "admin", password = nil }) --- produces --- {"username":"admin"} --- --- In order to actually produce --- {"username":"admin", "password":null} --- one can include a string value for a "null" field in the options table passed to encode().... --- any Lua table entry with that value becomes null in the JSON output: --- JSON:encode({ username = "admin", password = "xyzzy" }, nil, { null = "xyzzy" }) --- produces --- {"username":"admin", "password":null} --- --- Just be sure to use a string that is otherwise unlikely to appear in your data. --- The string "\0" (a string with one null byte) may well be appropriate for many applications. --- --- The "null" options also applies to Lua tables that become JSON arrays. --- JSON:encode({ "one", "two", nil, nil }) --- produces --- ["one","two"] --- while --- NULL = "\0" --- JSON:encode({ "one", "two", NULL, NULL}, nil, { null = NULL }) --- produces --- ["one","two",null,null] --- --- --- --- --- HANDLING LARGE AND/OR PRECISE NUMBERS --- --- --- Without special handling, numbers in JSON can lose precision in Lua. --- For example: --- --- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') --- --- print("small: ", type(T.small), T.small) --- print("big: ", type(T.big), T.big) --- print("precise: ", type(T.precise), T.precise) --- --- produces --- --- small: number 12345 --- big: number 1.2345678901235e+28 --- precise: number 9876.6789012346 --- --- Precision is lost with both 'big' and 'precise'. --- --- This package offers ways to try to handle this better (for some definitions of "better")... --- --- The most precise method is by setting the global: --- --- JSON.decodeNumbersAsObjects = true --- --- When this is set, numeric JSON data is encoded into Lua in a form that preserves the exact --- JSON numeric presentation when re-encoded back out to JSON, or accessed in Lua as a string. --- --- (This is done by encoding the numeric data with a Lua table/metatable that returns --- the possibly-imprecise numeric form when accessed numerically, but the original precise --- representation when accessed as a string. You can also explicitly access --- via JSON:forceString() and JSON:forceNumber()) --- --- Consider the example above, with this option turned on: --- --- JSON.decodeNumbersAsObjects = true --- --- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') --- --- print("small: ", type(T.small), T.small) --- print("big: ", type(T.big), T.big) --- print("precise: ", type(T.precise), T.precise) --- --- This now produces: --- --- small: table 12345 --- big: table 12345678901234567890123456789 --- precise: table 9876.67890123456789012345 --- --- However, within Lua you can still use the values (e.g. T.precise in the example above) in numeric --- contexts. In such cases you'll get the possibly-imprecise numeric version, but in string contexts --- and when the data finds its way to this package's encode() function, the original full-precision --- representation is used. --- --- Even without using the JSON.decodeNumbersAsObjects option, you can encode numbers --- in your Lua table that retain high precision upon encoding to JSON, by using the JSON:asNumber() --- function: --- --- T = { --- imprecise = 123456789123456789.123456789123456789, --- precise = JSON:asNumber("123456789123456789.123456789123456789") --- } --- --- print(JSON:encode_pretty(T)) --- --- This produces: --- --- { --- "precise": 123456789123456789.123456789123456789, --- "imprecise": 1.2345678912346e+17 --- } --- --- --- --- A different way to handle big/precise JSON numbers is to have decode() merely return --- the exact string representation of the number instead of the number itself. --- This approach might be useful when the numbers are merely some kind of opaque --- object identifier and you want to work with them in Lua as strings anyway. --- --- This approach is enabled by setting --- --- JSON.decodeIntegerStringificationLength = 10 --- --- The value is the number of digits (of the integer part of the number) at which to stringify numbers. --- --- Consider our previous example with this option set to 10: --- --- JSON.decodeIntegerStringificationLength = 10 --- --- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') --- --- print("small: ", type(T.small), T.small) --- print("big: ", type(T.big), T.big) --- print("precise: ", type(T.precise), T.precise) --- --- This produces: --- --- small: number 12345 --- big: string 12345678901234567890123456789 --- precise: number 9876.6789012346 --- --- The long integer of the 'big' field is at least JSON.decodeIntegerStringificationLength digits --- in length, so it's converted not to a Lua integer but to a Lua string. Using a value of 0 or 1 ensures --- that all JSON numeric data becomes strings in Lua. --- --- Note that unlike --- JSON.decodeNumbersAsObjects = true --- this stringification is simple and unintelligent: the JSON number simply becomes a Lua string, and that's the end of it. --- If the string is then converted back to JSON, it's still a string. After running the code above, adding --- print(JSON:encode(T)) --- produces --- {"big":"12345678901234567890123456789","precise":9876.6789012346,"small":12345} --- which is unlikely to be desired. --- --- There's a comparable option for the length of the decimal part of a number: --- --- JSON.decodeDecimalStringificationLength --- --- This can be used alone or in conjunction with --- --- JSON.decodeIntegerStringificationLength --- --- to trip stringification on precise numbers with at least JSON.decodeIntegerStringificationLength digits after --- the decimal point. --- --- This example: --- --- JSON.decodeIntegerStringificationLength = 10 --- JSON.decodeDecimalStringificationLength = 5 --- --- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') --- --- print("small: ", type(T.small), T.small) --- print("big: ", type(T.big), T.big) --- print("precise: ", type(T.precise), T.precise) --- --- produces: --- --- small: number 12345 --- big: string 12345678901234567890123456789 --- precise: string 9876.67890123456789012345 --- --- --- --- --- --- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT --- --- assert --- onDecodeError --- onDecodeOfNilError --- onDecodeOfHTMLError --- onEncodeError --- --- If you want to create a separate Lua JSON object with its own error handlers, --- you can reload JSON.lua or use the :new() method. --- ---------------------------------------------------------------------------- - -local default_pretty_indent = " " -local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } - -local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray -local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject - -function OBJDEF:newArray(tbl) - return setmetatable(tbl or {}, isArray) -end - -function OBJDEF:newObject(tbl) - return setmetatable(tbl or {}, isObject) -end - - - - -local function getnum(op) - return type(op) == 'number' and op or op.N -end - -local isNumber = { - __tostring = function(T) return T.S end, - __unm = function(op) return getnum(op) end, - - __concat = function(op1, op2) return tostring(op1) .. tostring(op2) end, - __add = function(op1, op2) return getnum(op1) + getnum(op2) end, - __sub = function(op1, op2) return getnum(op1) - getnum(op2) end, - __mul = function(op1, op2) return getnum(op1) * getnum(op2) end, - __div = function(op1, op2) return getnum(op1) / getnum(op2) end, - __mod = function(op1, op2) return getnum(op1) % getnum(op2) end, - __pow = function(op1, op2) return getnum(op1) ^ getnum(op2) end, - __lt = function(op1, op2) return getnum(op1) < getnum(op2) end, - __eq = function(op1, op2) return getnum(op1) == getnum(op2) end, - __le = function(op1, op2) return getnum(op1) <= getnum(op2) end, -} -isNumber.__index = isNumber - -function OBJDEF:asNumber(item) - - if getmetatable(item) == isNumber then - -- it's already a JSON number object. - return item - elseif type(item) == 'table' and type(item.S) == 'string' and type(item.N) == 'number' then - -- it's a number-object table that lost its metatable, so give it one - return setmetatable(item, isNumber) - else - -- the normal situation... given a number or a string representation of a number.... - local holder = { - S = tostring(item), -- S is the representation of the number as a string, which remains precise - N = tonumber(item), -- N is the number as a Lua number. - } - return setmetatable(holder, isNumber) - end -end - --- --- Given an item that might be a normal string or number, or might be an 'isNumber' object defined above, --- return the string version. This shouldn't be needed often because the 'isNumber' object should autoconvert --- to a string in most cases, but it's here to allow it to be forced when needed. --- -function OBJDEF:forceString(item) - if type(item) == 'table' and type(item.S) == 'string' then - return item.S - else - return tostring(item) - end -end - --- --- Given an item that might be a normal string or number, or might be an 'isNumber' object defined above, --- return the numeric version. --- -function OBJDEF:forceNumber(item) - if type(item) == 'table' and type(item.N) == 'number' then - return item.N - else - return tonumber(item) - end -end - - -local function unicode_codepoint_as_utf8(codepoint) - -- - -- codepoint is a number - -- - if codepoint <= 127 then - return string.char(codepoint) - - elseif codepoint <= 2047 then - -- - -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 - -- - local highpart = math.floor(codepoint / 0x40) - local lowpart = codepoint - (0x40 * highpart) - return string.char(0xC0 + highpart, - 0x80 + lowpart) - - elseif codepoint <= 65535 then - -- - -- 1110yyyy 10yyyyxx 10xxxxxx - -- - local highpart = math.floor(codepoint / 0x1000) - local remainder = codepoint - 0x1000 * highpart - local midpart = math.floor(remainder / 0x40) - local lowpart = remainder - 0x40 * midpart - - highpart = 0xE0 + highpart - midpart = 0x80 + midpart - lowpart = 0x80 + lowpart - - -- - -- Check for an invalid character (thanks Andy R. at Adobe). - -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 - -- - if ( highpart == 0xE0 and midpart < 0xA0 ) or - ( highpart == 0xED and midpart > 0x9F ) or - ( highpart == 0xF0 and midpart < 0x90 ) or - ( highpart == 0xF4 and midpart > 0x8F ) - then - return "?" - else - return string.char(highpart, - midpart, - lowpart) - end - - else - -- - -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx - -- - local highpart = math.floor(codepoint / 0x40000) - local remainder = codepoint - 0x40000 * highpart - local midA = math.floor(remainder / 0x1000) - remainder = remainder - 0x1000 * midA - local midB = math.floor(remainder / 0x40) - local lowpart = remainder - 0x40 * midB - - return string.char(0xF0 + highpart, - 0x80 + midA, - 0x80 + midB, - 0x80 + lowpart) - end -end - -function OBJDEF:onDecodeError(message, text, location, etc) - if text then - if location then - message = string.format("%s at char %d of: %s", message, location, text) - else - message = string.format("%s: %s", message, text) - end - end - - if etc ~= nil then - message = message .. " (" .. OBJDEF:encode(etc) .. ")" - end - - if self.assert then - self.assert(false, message) - else - assert(false, message) - end -end - -OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError -OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError - -function OBJDEF:onEncodeError(message, etc) - if etc ~= nil then - message = message .. " (" .. OBJDEF:encode(etc) .. ")" - end - - if self.assert then - self.assert(false, message) - else - assert(false, message) - end -end - -local function grok_number(self, text, start, options) - -- - -- Grab the integer part - -- - local integer_part = text:match('^-?[1-9]%d*', start) - or text:match("^-?0", start) - - if not integer_part then - self:onDecodeError("expected number", text, start, options.etc) - end - - local i = start + integer_part:len() - - -- - -- Grab an optional decimal part - -- - local decimal_part = text:match('^%.%d+', i) or "" - - i = i + decimal_part:len() - - -- - -- Grab an optional exponential part - -- - local exponent_part = text:match('^[eE][-+]?%d+', i) or "" - - i = i + exponent_part:len() - - local full_number_text = integer_part .. decimal_part .. exponent_part - - if options.decodeNumbersAsObjects then - return OBJDEF:asNumber(full_number_text), i - end - - -- - -- If we're told to stringify under certain conditions, so do. - -- We punt a bit when there's an exponent by just stringifying no matter what. - -- I suppose we should really look to see whether the exponent is actually big enough one - -- way or the other to trip stringification, but I'll be lazy about it until someone asks. - -- - if (options.decodeIntegerStringificationLength - and - (integer_part:len() >= options.decodeIntegerStringificationLength or exponent_part:len() > 0)) - - or - - (options.decodeDecimalStringificationLength - and - (decimal_part:len() >= options.decodeDecimalStringificationLength or exponent_part:len() > 0)) - then - return full_number_text, i -- this returns the exact string representation seen in the original JSON - end - - - - local as_number = tonumber(full_number_text) - - if not as_number then - self:onDecodeError("bad number", text, start, options.etc) - end - - return as_number, i -end - - -local function grok_string(self, text, start, options) - - if text:sub(start,start) ~= '"' then - self:onDecodeError("expected string's opening quote", text, start, options.etc) - end - - local i = start + 1 -- +1 to bypass the initial quote - local text_len = text:len() - local VALUE = "" - while i <= text_len do - local c = text:sub(i,i) - if c == '"' then - return VALUE, i + 1 - end - if c ~= '\\' then - VALUE = VALUE .. c - i = i + 1 - elseif text:match('^\\b', i) then - VALUE = VALUE .. "\b" - i = i + 2 - elseif text:match('^\\f', i) then - VALUE = VALUE .. "\f" - i = i + 2 - elseif text:match('^\\n', i) then - VALUE = VALUE .. "\n" - i = i + 2 - elseif text:match('^\\r', i) then - VALUE = VALUE .. "\r" - i = i + 2 - elseif text:match('^\\t', i) then - VALUE = VALUE .. "\t" - i = i + 2 - else - local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) - if hex then - i = i + 6 -- bypass what we just read - - -- We have a Unicode codepoint. It could be standalone, or if in the proper range and - -- followed by another in a specific range, it'll be a two-code surrogate pair. - local codepoint = tonumber(hex, 16) - if codepoint >= 0xD800 and codepoint <= 0xDBFF then - -- it's a hi surrogate... see whether we have a following low - local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) - if lo_surrogate then - i = i + 6 -- bypass the low surrogate we just read - codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) - else - -- not a proper low, so we'll just leave the first codepoint as is and spit it out. - end - end - VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) - - else - - -- just pass through what's escaped - VALUE = VALUE .. text:match('^\\(.)', i) - i = i + 2 - end - end - end - - self:onDecodeError("unclosed string", text, start, options.etc) -end - -local function skip_whitespace(text, start) - - local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 - if match_end then - return match_end + 1 - else - return start - end -end - -local grok_one -- assigned later - -local function grok_object(self, text, start, options) - - if text:sub(start,start) ~= '{' then - self:onDecodeError("expected '{'", text, start, options.etc) - end - - local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' - - local VALUE = self.strictTypes and self:newObject { } or { } - - if text:sub(i,i) == '}' then - return VALUE, i + 1 - end - local text_len = text:len() - while i <= text_len do - local key, new_i = grok_string(self, text, i, options) - - i = skip_whitespace(text, new_i) - - if text:sub(i, i) ~= ':' then - self:onDecodeError("expected colon", text, i, options.etc) - end - - i = skip_whitespace(text, i + 1) - - local new_val, new_i = grok_one(self, text, i, options) - - VALUE[key] = new_val - - -- - -- Expect now either '}' to end things, or a ',' to allow us to continue. - -- - i = skip_whitespace(text, new_i) - - local c = text:sub(i,i) - - if c == '}' then - return VALUE, i + 1 - end - - if text:sub(i, i) ~= ',' then - self:onDecodeError("expected comma or '}'", text, i, options.etc) - end - - i = skip_whitespace(text, i + 1) - end - - self:onDecodeError("unclosed '{'", text, start, options.etc) -end - -local function grok_array(self, text, start, options) - if text:sub(start,start) ~= '[' then - self:onDecodeError("expected '['", text, start, options.etc) - end - - local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' - local VALUE = self.strictTypes and self:newArray { } or { } - if text:sub(i,i) == ']' then - return VALUE, i + 1 - end - - local VALUE_INDEX = 1 - - local text_len = text:len() - while i <= text_len do - local val, new_i = grok_one(self, text, i, options) - - -- can't table.insert(VALUE, val) here because it's a no-op if val is nil - VALUE[VALUE_INDEX] = val - VALUE_INDEX = VALUE_INDEX + 1 - - i = skip_whitespace(text, new_i) - - -- - -- Expect now either ']' to end things, or a ',' to allow us to continue. - -- - local c = text:sub(i,i) - if c == ']' then - return VALUE, i + 1 - end - if text:sub(i, i) ~= ',' then - self:onDecodeError("expected comma or '['", text, i, options.etc) - end - i = skip_whitespace(text, i + 1) - end - self:onDecodeError("unclosed '['", text, start, options.etc) -end - - -grok_one = function(self, text, start, options) - -- Skip any whitespace - start = skip_whitespace(text, start) - - if start > text:len() then - self:onDecodeError("unexpected end of string", text, nil, options.etc) - end - - if text:find('^"', start) then - return grok_string(self, text, start, options.etc) - - elseif text:find('^[-0123456789 ]', start) then - return grok_number(self, text, start, options) - - elseif text:find('^%{', start) then - return grok_object(self, text, start, options) - - elseif text:find('^%[', start) then - return grok_array(self, text, start, options) - - elseif text:find('^true', start) then - return true, start + 4 - - elseif text:find('^false', start) then - return false, start + 5 - - elseif text:find('^null', start) then - return nil, start + 4 - - else - self:onDecodeError("can't parse JSON", text, start, options.etc) - end -end - -function OBJDEF:decode(text, etc, options) - -- - -- If the user didn't pass in a table of decode options, make an empty one. - -- - if type(options) ~= 'table' then - options = {} - end - - -- - -- If they passed in an 'etc' argument, stuff it into the options. - -- (If not, any 'etc' field in the options they passed in remains to be used) - -- - if etc ~= nil then - options.etc = etc - end - - - if type(self) ~= 'table' or self.__index ~= OBJDEF then - OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, options.etc) - end - - if text == nil then - self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, options.etc) - elseif type(text) ~= 'string' then - self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, options.etc) - end - - if text:match('^%s*$') then - return nil - end - - if text:match('^%s*<') then - -- Can't be JSON... we'll assume it's HTML - self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, options.etc) - end - - -- - -- Ensure that it's not UTF-32 or UTF-16. - -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), - -- but this package can't handle them. - -- - if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then - self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, options.etc) - end - - -- - -- apply global options - -- - if options.decodeNumbersAsObjects == nil then - options.decodeNumbersAsObjects = self.decodeNumbersAsObjects - end - if options.decodeIntegerStringificationLength == nil then - options.decodeIntegerStringificationLength = self.decodeIntegerStringificationLength - end - if options.decodeDecimalStringificationLength == nil then - options.decodeDecimalStringificationLength = self.decodeDecimalStringificationLength - end - - local success, value = pcall(grok_one, self, text, 1, options) - - if success then - return value - else - -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. - if self.assert then - self.assert(false, value) - else - assert(false, value) - end - -- and if we're still here, return a nil and throw the error message on as a second arg - return nil, value - end -end - -local function backslash_replacement_function(c) - if c == "\n" then - return "\\n" - elseif c == "\r" then - return "\\r" - elseif c == "\t" then - return "\\t" - elseif c == "\b" then - return "\\b" - elseif c == "\f" then - return "\\f" - elseif c == '"' then - return '\\"' - elseif c == '\\' then - return '\\\\' - else - return string.format("\\u%04x", c:byte()) - end -end - -local chars_to_be_escaped_in_JSON_string - = '[' - .. '"' -- class sub-pattern to match a double quote - .. '%\\' -- class sub-pattern to match a backslash - .. '%z' -- class sub-pattern to match a null - .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters - .. ']' - - -local LINE_SEPARATOR_as_utf8 = unicode_codepoint_as_utf8(0x2028) -local PARAGRAPH_SEPARATOR_as_utf8 = unicode_codepoint_as_utf8(0x2029) -local function json_string_literal(value, options) - local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) - if options.stringsAreUtf8 then - -- - -- This feels really ugly to just look into a string for the sequence of bytes that we know to be a particular utf8 character, - -- but utf8 was designed purposefully to make this kind of thing possible. Still, feels dirty. - -- I'd rather decode the byte stream into a character stream, but it's not technically needed so - -- not technically worth it. - -- - newval = newval:gsub(LINE_SEPARATOR_as_utf8, '\\u2028'):gsub(PARAGRAPH_SEPARATOR_as_utf8,'\\u2029') - end - return '"' .. newval .. '"' -end - -local function object_or_array(self, T, etc) - -- - -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON - -- object. If there are only numbers, it's a JSON array. - -- - -- If we'll be converting to a JSON object, we'll want to sort the keys so that the - -- end result is deterministic. - -- - local string_keys = { } - local number_keys = { } - local number_keys_must_be_strings = false - local maximum_number_key - - for key in pairs(T) do - if type(key) == 'string' then - table.insert(string_keys, key) - elseif type(key) == 'number' then - table.insert(number_keys, key) - if key <= 0 or key >= math.huge then - number_keys_must_be_strings = true - elseif not maximum_number_key or key > maximum_number_key then - maximum_number_key = key - end - else - self:onEncodeError("can't encode table with a key of type " .. type(key), etc) - end - end - - if #string_keys == 0 and not number_keys_must_be_strings then - -- - -- An empty table, or a numeric-only array - -- - if #number_keys > 0 then - return nil, maximum_number_key -- an array - elseif tostring(T) == "JSON array" then - return nil - elseif tostring(T) == "JSON object" then - return { } - else - -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects - return nil - end - end - - table.sort(string_keys) - - local map - if #number_keys > 0 then - -- - -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array - -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. - -- - - if self.noKeyConversion then - self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) - end - - -- - -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings - -- - map = { } - for key, val in pairs(T) do - map[key] = val - end - - table.sort(number_keys) - - -- - -- Throw numeric keys in there as strings - -- - for _, number_key in ipairs(number_keys) do - local string_key = tostring(number_key) - if map[string_key] == nil then - table.insert(string_keys , string_key) - map[string_key] = T[number_key] - else - self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) - end - end - end - - return string_keys, nil, map -end - --- --- Encode --- --- 'options' is nil, or a table with possible keys: --- --- pretty -- If true, return a pretty-printed version. --- --- indent -- A string (usually of spaces) used to indent each nested level. --- --- align_keys -- If true, align all the keys when formatting a table. --- --- null -- If this exists with a string value, table elements with this value are output as JSON null. --- --- stringsAreUtf8 -- If true, consider Lua strings not as a sequence of bytes, but as a sequence of UTF-8 characters. --- (Currently, the only practical effect of setting this option is that Unicode LINE and PARAGRAPH --- separators, if found in a string, are encoded with a JSON escape instead of as raw UTF-8. --- The JSON is valid either way, but encoding this way, apparently, allows the resulting JSON --- to also be valid Java.) --- --- -local encode_value -- must predeclare because it calls itself -function encode_value(self, value, parents, etc, options, indent, for_key) - - -- - -- keys in a JSON object can never be null, so we don't even consider options.null when converting a key value - -- - if value == nil or (not for_key and options and options.null and value == options.null) then - return 'null' - - elseif type(value) == 'string' then - return json_string_literal(value, options) - - elseif type(value) == 'number' then - if value ~= value then - -- - -- NaN (Not a Number). - -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. - -- - return "null" - elseif value >= math.huge then - -- - -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should - -- really be a package option. Note: at least with some implementations, positive infinity - -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. - -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" - -- case first. - -- - return "1e+9999" - elseif value <= -math.huge then - -- - -- Negative infinity. - -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. - -- - return "-1e+9999" - else - return tostring(value) - end - - elseif type(value) == 'boolean' then - return tostring(value) - - elseif type(value) ~= 'table' then - self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) - - elseif getmetatable(value) == isNumber then - return tostring(value) - else - -- - -- A table to be converted to either a JSON object or array. - -- - local T = value - - if type(options) ~= 'table' then - options = {} - end - if type(indent) ~= 'string' then - indent = "" - end - - if parents[T] then - self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) - else - parents[T] = true - end - - local result_value - - local object_keys, maximum_number_key, map = object_or_array(self, T, etc) - if maximum_number_key then - -- - -- An array... - -- - local ITEMS = { } - for i = 1, maximum_number_key do - table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) - end - - if options.pretty then - result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" - else - result_value = "[" .. table.concat(ITEMS, ",") .. "]" - end - - elseif object_keys then - -- - -- An object - -- - local TT = map or T - - if options.pretty then - - local KEYS = { } - local max_key_length = 0 - for _, key in ipairs(object_keys) do - local encoded = encode_value(self, tostring(key), parents, etc, options, indent, true) - if options.align_keys then - max_key_length = math.max(max_key_length, #encoded) - end - table.insert(KEYS, encoded) - end - local key_indent = indent .. tostring(options.indent or "") - local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") - local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" - - local COMBINED_PARTS = { } - for i, key in ipairs(object_keys) do - local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) - table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) - end - result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" - - else - - local PARTS = { } - for _, key in ipairs(object_keys) do - local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) - local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent, true) - table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) - end - result_value = "{" .. table.concat(PARTS, ",") .. "}" - - end - else - -- - -- An empty array/object... we'll treat it as an array, though it should really be an option - -- - result_value = "[]" - end - - parents[T] = false - return result_value - end -end - - -function OBJDEF:encode(value, etc, options) - if type(self) ~= 'table' or self.__index ~= OBJDEF then - OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) - end - - -- - -- If the user didn't pass in a table of decode options, make an empty one. - -- - if type(options) ~= 'table' then - options = {} - end - - return encode_value(self, value, {}, etc, options) -end - -function OBJDEF:encode_pretty(value, etc, options) - if type(self) ~= 'table' or self.__index ~= OBJDEF then - OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) - end - - -- - -- If the user didn't pass in a table of decode options, use the default pretty ones - -- - if type(options) ~= 'table' then - options = default_pretty_options - end - - return encode_value(self, value, {}, etc, options) -end - -function OBJDEF.__tostring() - return "JSON encode/decode package" -end - -OBJDEF.__index = OBJDEF - -function OBJDEF:new(args) - local new = { } - - if args then - for key, val in pairs(args) do - new[key] = val - end - end - - return setmetatable(new, OBJDEF) -end - -return OBJDEF:new() - --- --- Version history: --- --- 20160916.19 Fixed the isNumber.__index assignment (thanks to Jack Taylor) --- --- 20160730.18 Added JSON:forceString() and JSON:forceNumber() --- --- 20160728.17 Added concatenation to the metatable for JSON:asNumber() --- --- 20160709.16 Could crash if not passed an options table (thanks jarno heikkinen ). --- --- Made JSON:asNumber() a bit more resilient to being passed the results of itself. --- --- 20160526.15 Added the ability to easily encode null values in JSON, via the new "null" encoding option. --- (Thanks to Adam B for bringing up the issue.) --- --- Added some support for very large numbers and precise floats via --- JSON.decodeNumbersAsObjects --- JSON.decodeIntegerStringificationLength --- JSON.decodeDecimalStringificationLength --- --- Added the "stringsAreUtf8" encoding option. (Hat tip to http://lua-users.org/wiki/JsonModules ) --- --- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really --- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines --- more flexible, and changed the default encode_pretty() to be more generally useful. --- --- Added a third 'options' argument to the encode() and encode_pretty() routines, to control --- how the encoding takes place. --- --- Updated docs to add assert() call to the loadfile() line, just as good practice so that --- if there is a problem loading JSON.lua, the appropriate error message will percolate up. --- --- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, --- so that the source of the package, and its version number, are visible in compiled copies. --- --- 20140911.12 Minor lua cleanup. --- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. --- (Thanks to SmugMug's David Parry for these.) --- --- 20140418.11 JSON nulls embedded within an array were being ignored, such that --- ["1",null,null,null,null,null,"seven"], --- would return --- {1,"seven"} --- It's now fixed to properly return --- {1, nil, nil, nil, nil, nil, "seven"} --- Thanks to "haddock" for catching the error. --- --- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. --- --- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", --- and this caused some problems. --- --- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, --- and had of course diverged (encode_pretty didn't get the fixes that encode got, so --- sometimes produced incorrect results; thanks to Mattie for the heads up). --- --- Handle encoding tables with non-positive numeric keys (unlikely, but possible). --- --- If a table has both numeric and string keys, or its numeric keys are inappropriate --- (such as being non-positive or infinite), the numeric keys are turned into --- string keys appropriate for a JSON object. So, as before, --- JSON:encode({ "one", "two", "three" }) --- produces the array --- ["one","two","three"] --- but now something with mixed key types like --- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) --- instead of throwing an error produces an object: --- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} --- --- To maintain the prior throw-an-error semantics, set --- JSON.noKeyConversion = true --- --- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. --- --- 20130120.6 Comment update: added a link to the specific page on my blog where this code can --- be found, so that folks who come across the code outside of my blog can find updates --- more easily. --- --- 20111207.5 Added support for the 'etc' arguments, for better error reporting. --- --- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. --- --- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: --- --- * When encoding lua for JSON, Sparse numeric arrays are now handled by --- spitting out full arrays, such that --- JSON:encode({"one", "two", [10] = "ten"}) --- returns --- ["one","two",null,null,null,null,null,null,null,"ten"] --- --- In 20100810.2 and earlier, only up to the first non-null value would have been retained. --- --- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". --- Version 20100810.2 and earlier created invalid JSON in both cases. --- --- * Unicode surrogate pairs are now detected when decoding JSON. --- --- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding --- --- 20100731.1 initial public release --- diff --git a/tests/JSONTestSuite/parsers/test_Lua_JSON/test_JSON.lua b/tests/JSONTestSuite/parsers/test_Lua_JSON/test_JSON.lua deleted file mode 100644 index ea839fd18..000000000 --- a/tests/JSONTestSuite/parsers/test_Lua_JSON/test_JSON.lua +++ /dev/null @@ -1,22 +0,0 @@ --- http://regex.info/blog/lua/json -JSON = (loadfile "parsers/test_Lua_JSON/JSON.lua")() -- one-time load of the routines - -function readAll(file) - local f = io.open(file, "rb") - local content = f:read("*all") - f:close() - return content -end - -local data = readAll(arg[1]) - -local lua_value = JSON:decode(data) - -if lua_value == nil then - print ("Error:", err) - os.exit(1) -end - -print ("--", lua_value ) - -os.exit(0) diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/bin/test_ObjCNSJSONSerializer b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/bin/test_ObjCNSJSONSerializer deleted file mode 100755 index 9cc6d9393..000000000 Binary files a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/bin/test_ObjCNSJSONSerializer and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.pbxproj deleted file mode 100644 index 5d901808c..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.pbxproj +++ /dev/null @@ -1,246 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03A27D3B1D796BB600B2D016 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 03A27D3A1D796BB600B2D016 /* main.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03A27D351D796BB600B2D016 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03A27D371D796BB600B2D016 /* test_ObjCNSJSONSerializer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_ObjCNSJSONSerializer; sourceTree = BUILT_PRODUCTS_DIR; }; - 03A27D3A1D796BB600B2D016 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03A27D341D796BB600B2D016 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03A27D2E1D796BB600B2D016 = { - isa = PBXGroup; - children = ( - 03A27D391D796BB600B2D016 /* test_ObjCNSJSONSerializer */, - 03A27D381D796BB600B2D016 /* Products */, - ); - sourceTree = ""; - }; - 03A27D381D796BB600B2D016 /* Products */ = { - isa = PBXGroup; - children = ( - 03A27D371D796BB600B2D016 /* test_ObjCNSJSONSerializer */, - ); - name = Products; - sourceTree = ""; - }; - 03A27D391D796BB600B2D016 /* test_ObjCNSJSONSerializer */ = { - isa = PBXGroup; - children = ( - 03A27D3A1D796BB600B2D016 /* main.m */, - ); - path = test_ObjCNSJSONSerializer; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03A27D361D796BB600B2D016 /* test_ObjCNSJSONSerializer */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03A27D3E1D796BB600B2D016 /* Build configuration list for PBXNativeTarget "test_ObjCNSJSONSerializer" */; - buildPhases = ( - 03A27D331D796BB600B2D016 /* Sources */, - 03A27D341D796BB600B2D016 /* Frameworks */, - 03A27D351D796BB600B2D016 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_ObjCNSJSONSerializer; - productName = test_ObjCNSJSONSerializer; - productReference = 03A27D371D796BB600B2D016 /* test_ObjCNSJSONSerializer */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03A27D2F1D796BB600B2D016 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = Swissquote; - TargetAttributes = { - 03A27D361D796BB600B2D016 = { - CreatedOnToolsVersion = 7.3.1; - }; - }; - }; - buildConfigurationList = 03A27D321D796BB600B2D016 /* Build configuration list for PBXProject "test_ObjCNSJSONSerializer" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03A27D2E1D796BB600B2D016; - productRefGroup = 03A27D381D796BB600B2D016 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03A27D361D796BB600B2D016 /* test_ObjCNSJSONSerializer */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03A27D331D796BB600B2D016 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03A27D3B1D796BB600B2D016 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03A27D3C1D796BB600B2D016 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03A27D3D1D796BB600B2D016 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03A27D3F1D796BB600B2D016 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03A27D401D796BB600B2D016 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03A27D321D796BB600B2D016 /* Build configuration list for PBXProject "test_ObjCNSJSONSerializer" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03A27D3C1D796BB600B2D016 /* Debug */, - 03A27D3D1D796BB600B2D016 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03A27D3E1D796BB600B2D016 /* Build configuration list for PBXNativeTarget "test_ObjCNSJSONSerializer" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03A27D3F1D796BB600B2D016 /* Debug */, - 03A27D401D796BB600B2D016 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03A27D2F1D796BB600B2D016 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 69a3fa694..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 6d05dbc27..000000000 Binary files a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_ObjCNSJSONSerializer.xcscheme b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_ObjCNSJSONSerializer.xcscheme deleted file mode 100644 index 07a42a313..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_ObjCNSJSONSerializer.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index f82c7588e..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_ObjCNSJSONSerializer.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03A27D361D796BB600B2D016 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out deleted file mode 100755 index 9327c5459..000000000 Binary files a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Info.plist b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Info.plist deleted file mode 100644 index 3679a65b9..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.a.out - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Resources/DWARF/a.out b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Resources/DWARF/a.out deleted file mode 100644 index db7651100..000000000 Binary files a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Resources/DWARF/a.out and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/findings_dir/plot_data b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/findings_dir/plot_data deleted file mode 100644 index 4461bb2fb..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/findings_dir/plot_data +++ /dev/null @@ -1 +0,0 @@ -# unix_time, cycles_done, cur_path, paths_total, pending_total, pending_favs, map_size, unique_crashes, unique_hangs, max_depth, execs_per_sec diff --git a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/main.m b/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/main.m deleted file mode 100644 index 01305560d..000000000 --- a/tests/JSONTestSuite/parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/main.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// main.m -// test_ObjCNSJSONSerializer -// -// Created by Nicolas Seriot on 02/09/16. -// Copyright © 2016 Swissquote. All rights reserved. -// - -#import - -int main(int argc, const char * argv[]) { - @autoreleasepool { - - if ([[NSProcessInfo processInfo].arguments count] != 2) { - NSLog(@"Usage: ./%@ file.json", [NSProcessInfo processInfo].arguments[0]); - return 1; - } - - NSString *path = [NSProcessInfo processInfo].arguments[1]; - NSURL *url = [NSURL fileURLWithPath:path]; - NSData *data = [NSData dataWithContentsOfURL:url]; - - id o = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil]; - - if (o == nil) { - return 1; - } else { - NSLog(@"-- %@", o); - } - } - return 0; -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Accessors.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Accessors.swift deleted file mode 100755 index 215d94fd1..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Accessors.swift +++ /dev/null @@ -1,255 +0,0 @@ -// -// Accessors.swift -// PMJSON -// -// Created by Kevin Ballard on 10/9/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -public extension JSON { - /// Returns `true` iff the receiver is `.null`. - var isNull: Bool { - switch self { - case .null: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.bool`. - var isBool: Bool { - switch self { - case .bool: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.string`. - var isString: Bool { - switch self { - case .string: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.int64`. - var isInt64: Bool { - switch self { - case .int64: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.double`. - var isDouble: Bool { - switch self { - case .double: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.int64` or `.double`. - var isNumber: Bool { - switch self { - case .int64, .double: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.object`. - var isObject: Bool { - switch self { - case .object: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.array`. - var isArray: Bool { - switch self { - case .array: return true - default: return false - } - } -} - -public extension JSON { - /// Returns the boolean value if the receiver is `.bool`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given boolean value, or with - /// null if the value is `nil`. - var bool: Bool? { - get { - switch self { - case .bool(let b): return b - default: return nil - } - } - set { - self = newValue.map(JSON.bool) ?? nil - } - } - - /// Returns the string value if the receiver is `.string`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given string value, or with - /// null if the value is `nil`. - var string: String? { - get { - switch self { - case .string(let s): return s - default: return nil - } - } - set { - self = newValue.map(JSON.string) ?? nil - } - } - - /// Returns the 64-bit integral value if the receiver is `.int64` or `.double`, otherwise `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in 64 bits, `nil` is returned. - /// - /// When setting, replaces the receiver with the given integral value, or with - /// null if the value is `nil`. - var int64: Int64? { - get { - switch self { - case .int64(let i): return i - case .double(let d): return convertDoubleToInt64(d) - default: return nil - } - } set { - self = newValue.map(JSON.int64) ?? nil - } - } - - /// Returns the integral value if the receiver is `.int64` or `.double`, otherwise `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in an `Int`, `nil` is returned. - /// If the receiver is `.int64` and the value does not fit in an `Int`, `nil` is returned. - /// - /// When setting, replaces the receiver with the given integral value, or with - /// null if the value is `nil`. - var int: Int? { - get { - guard let value = self.int64 else { return nil} - let truncated = Int(truncatingBitPattern: value) - guard Int64(truncated) == value else { return nil } - return truncated - } - set { - self = newValue.map({ JSON.int64(Int64($0)) }) ?? nil - } - } - - /// Returns the numeric value as a `Double` if the receiver is `.int64` or `.double`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given double value, or with - /// null if the value is `nil`. - var double: Double? { - get { - switch self { - case .int64(let i): return Double(i) - case .double(let d): return d - default: return nil - } - } - set { - self = newValue.map(JSON.double) ?? nil - } - } - - /// Returns the object dictionary if the receiver is `.object`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given object value, or with - /// null if the value is `nil`. - var object: JSONObject? { - get { - switch self { - case .object(let obj): return obj - default: return nil - } - } - set { - self = newValue.map(JSON.object) ?? nil - } - } - - /// Returns the array if the receiver is `.array`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given array value, or with - /// null if the value is `nil`. - var array: JSONArray? { - get { - switch self { - case .array(let ary): return ary - default: return nil - } - } - set { - self = newValue.map(JSON.array) ?? nil - } - } -} - -public extension JSON { - /// Returns the string value if the receiver is `.string`, coerces the value to a string if - /// the receiver is `.bool`, `.null`, `.int64`, or `.double`, or otherwise returns `nil`. - var asString: String? { - return try? toString() - } - - /// Returns the 64-bit integral value if the receiver is `.int64` or `.double`, coerces the value - /// if the receiver is `.string`, otherwise returns `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in 64 bits, `nil` is returned. - /// If the receiver is `.string`, it must parse fully as an integral or floating-point number. - /// If it parses as a floating-point number, it is truncated. If it does not fit in 64 bits, `nil` is returned. - var asInt64: Int64? { - return try? toInt64() - } - - /// Returns the integral value if the receiver is `.int64` or `.double`, coerces the value - /// if the receiver is `.string`, otherwise returns `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in an `Int`, `nil` is returned. - /// If the receiver is `.string`, it must parse fully as an integral or floating-point number. - /// If it parses as a floating-point number, it is truncated. If it does not fit in an `Int`, `nil` is returned. - var asInt: Int? { - return try? toInt() - } - - /// Returns the double value if the receiver is `.int64` or `.double`, coerces the value - /// if the receiver is `.string`, otherwise returns `nil`. - /// If the receiver is `.string`, it must parse fully as a floating-point number. - var asDouble: Double? { - return try? toDouble() - } -} - -public extension JSON { - /// If the receiver is `.object`, returns the result of subscripting the object. - /// Otherwise, returns `nil`. - subscript(key: String) -> JSON? { - return self.object?[key] - } - - /// If the receiver is `.array` and the index is in range of the array, returns the result of subscripting the array. - /// Otherwise returns `nil`. - subscript(index: Int) -> JSON? { - guard let ary = self.array else { return nil } - guard index >= ary.startIndex && index < ary.endIndex else { return nil } - return ary[index] - } -} - -internal func convertDoubleToInt64(_ d: Double) -> Int64? { - // Int64(Double(Int64.max)) asserts because it interprets it as out of bounds. - // Int64(Double(Int64.min)) works just fine. - if d >= Double(Int64.max) || d < Double(Int64.min) { - return nil - } - return Int64(d) -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/DecimalNumber.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/DecimalNumber.swift deleted file mode 100755 index b07666ae9..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/DecimalNumber.swift +++ /dev/null @@ -1,236 +0,0 @@ -// -// DecimalNumber.swift -// PMJSON -// -// Created by Kevin Ballard on 2/8/16. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -#if os(iOS) || os(OSX) || os(tvOS) || os(watchOS) - - import Foundation - - // MARK: Basic accessors - - public extension JSON { - /// Returns the receiver as an `NSDecimalNumber` if possible. - /// - Returns: An `NSDecimalNumber` if the receiver is `.int64` or `.double`, or is a `.string` - /// that contains a valid decimal number representation, otherwise `nil`. - /// - Note: Whitespace is not allowed in the string representation. - var asDecimalNumber: NSDecimalNumber? { - switch self { - case .int64(let i): return NSDecimalNumber(value: i) - case .double(let d): return NSDecimalNumber(value: d) - case .string(let s) where !s.isEmpty: - // NSDecimalNumber(string:) doesn't tell us if the number was valid. - // We could check for NaN, but that still doesn't tell us if there's anything left in the string. - // I'm pretty sure it uses NSScanner.scanDecimal() internally, so we'll just use that instead. - let scanner = Scanner(string: s) - scanner.charactersToBeSkipped = nil - var decimal = Decimal() - if scanner.scanDecimal(&decimal) && scanner.isAtEnd { - return NSDecimalNumber(decimal: decimal) - } - return nil - default: return nil - } - } - - /// Returns the receiver as an `NSDecimalNumber` if it is `.int64` or `.double`. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the receiver is not an `.int64` or a `.double`. - func getDecimalNumber() throws -> NSDecimalNumber { - switch self { - case .int64(let i): return NSDecimalNumber(value: i) - case .double(let d): return NSDecimalNumber(value: d) - default: throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) - } - } - - /// Returns the receiver as an `NSDecimalNumber` if it is `.int64` or `.double`. - /// - Returns: An `NSDecimalNumber`, or `nil` if the receivre is `null`. - /// - Throws: `JSONError` if the receiver is not an `.int64` or a `.double`. - func getDecimalNumberOrNil() throws -> NSDecimalNumber? { - switch self { - case .int64(let i): return NSDecimalNumber(value: i) - case .double(let d): return NSDecimalNumber(value: d) - case .null: return nil - default: throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) - } - } - - /// Returns the receiver as an `NSDecimalNumber` if possible. - /// - Returns: An `NSDecimalNumber` if the receiver is `.int64` or `.double`, or is a `.string` - /// that contains a valid decimal number representation. - /// - Throws: `JSONError` if the receiver is the wrong type, or is a `.string` that does not contain - /// a valid decimal number representation. - /// - Note: Whitespace is not allowed in the string representation. - func toDecimalNumber() throws -> NSDecimalNumber { - guard let value = asDecimalNumber else { - throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) - } - return value - } - - /// Returns the receiver as an `NSDecimalNumber` if possible. - /// - Returns: An `NSDecimalNumber` if the receiver is `.int64` or `.double`, or is a `.string` - /// that contains a valid decimal number representation, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type, or is a `.string` that does not contain - /// a valid decimal number representation. - /// - Note: Whitespace is not allowed in the string representation. - func toDecimalNumberOrNil() throws -> NSDecimalNumber? { - if let value = asDecimalNumber { return value } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - } - - // MARK: - Keyed accessors - - public extension JSON { - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is the wrong type, or if the receiver is - /// not an object. - func getDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getDecimalNumberOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, or a string that cannot be coerced to a decimal number, or if the - /// receiver is not an object. - func toDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a decimal number, or if the receiver is not an object. - func toDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toDecimalNumberOrNil() } - } - } - - // MARK: - Indexed accessors - - public extension JSON { - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, or if - /// the receiver is not an array. - func getDecimalNumber(_ index: Int) throws -> NSDecimalNumber { - let array = try getArray() - let value = try getRequired(array, index: index, type: .number) - return try scoped(index) { try value.getDecimalNumber() } - } - - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is the wrong type, or if the receiver is not an array. - func getDecimalNumberOrNil(_ index: Int) throws -> NSDecimalNumber? { - let array = try getArray() - guard let value = array[safe: index] else { return nil } - return try scoped(index) { try value.getDecimalNumberOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a decimal number, or - /// if the receiver is not an array. - func toDecimalNumber(_ index: Int) throws -> NSDecimalNumber { - let array = try getArray() - let value = try getRequired(array, index: index, type: .number) - return try scoped(index) { try value.toDecimalNumber() } - } - - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a decimal number, or if the receiver is not an array. - func toDecimalNumberOrNil(_ index: Int) throws -> NSDecimalNumber? { - let array = try getArray() - guard let value = array[safe: index] else { return nil } - return try scoped(index) { try value.toDecimalNumberOrNil() } - } - } - - // MARK: - - - public extension JSONObject { - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is the wrong type, or if the receiver is - /// not an object. - func getDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getDecimalNumberOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, or a string that cannot be coerced to a decimal number, or if the - /// receiver is not an object. - func toDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a decimal number, or if the receiver is not an object. - func toDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toDecimalNumberOrNil() } - } - } - -#endif // os(iOS) || os(OSX) || os(tvOS) || os(watchOS) diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Decoder.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Decoder.swift deleted file mode 100755 index 0a9a0fe31..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Decoder.swift +++ /dev/null @@ -1,294 +0,0 @@ -// -// Decoder.swift -// PMJSON -// -// Created by Kevin Ballard on 10/8/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -extension JSON { - /// Decodes a string as JSON. - /// - Parameter string: A string to parse as JSON. - /// - Parameter strict: If `true`, trailing commas in arrays/objects are treated as an error. Defaults to `false`. - /// - Returns: A `JSON` value. - /// - Throws: `JSONParserError` - public static func decode(_ string: String, strict: Bool = false) throws -> JSON { - return try decode(string.unicodeScalars, strict: strict) - } - - /// Decodes a sequence of `UnicodeScalar`s as JSON. - /// - Parameter scalars: A sequence of `UnicodeScalar`s to parse as JSON. - /// - Parameters strict: If `true`, trailing commas in arrays/objects are treated as an error. Defaults to `false`. - /// - Returns: A `JSON` value. - /// - Throws: `JSONParserError` - public static func decode(_ scalars: Seq, strict: Bool = false) throws -> JSON where Seq.Iterator.Element == UnicodeScalar { - var parser = JSONParser(scalars) - parser.strict = strict - var decoder = JSONDecoder(parser) - return try decoder.decode() - } - - /// Lazily decodes a string as a JSON stream. - /// - /// A JSON stream is a series of top-level JSON values. See `JSONStreamDecoder` for details. - /// - /// - Parameter string: A string to parse as a JSON stream. - /// - Parameter strict: IF `true`, trailing commas in arrays/objects are treated as an error. Defaults to `false`. - /// - Returns: A `JSONStreamDecoder`. - public static func decodeStream(_ string: String, strict: Bool = false) -> JSONStreamDecoder> { - return decodeStream(string.unicodeScalars, strict: strict) - } - - /// Lazily decodes a sequence of `UnicodeScalar`s as a JSON stream. - /// - /// A JSON stream is a series of top-level JSON values. See `JSONStreamDecoder` for details. - /// - /// - Parameter scalars: A sequence of `UnicodeScalar`s to parse as a JSON stream. - /// - Parameter strict: If `true`, trailing commas in arrays/objects are treated as an error. Defaults to `false`. - /// - Returns: A `JSONStreamDecoder`. - public static func decodeStream(_ scalars: Seq, strict: Bool = false) -> JSONStreamDecoder> where Seq.Iterator.Element == UnicodeScalar { - var parser = JSONParser(scalars) - parser.strict = strict - parser.streaming = true - return JSONStreamDecoder(parser) - } -} - -/// A JSON decoder that consumes a stream of JSON events. -/// -/// In most cases, you should use the convenience method `JSON.decode(_:)` to decode values -/// instead of using this class directly. -/// -/// - SeeAlso: `JSONParser`. -public struct JSONDecoder where Seq.Iterator: JSONEventIterator, Seq.Iterator.Element == JSONEvent { - public init(_ parser: Seq) { - iter = parser.makeIterator() - } - - /// If `true`, the decoder will operate in streaming mode, allowing for multiple - /// top-level json values, with each call to `decode()` returning a successive value. - /// The default value of `false` means that `decode()` can only be called once, and - /// any JSON events past the first top-level value are considered an error. - /// - /// See `decode()` for more details on the streaming operation. - /// - /// - Important: When wrapping a `JSONParser`, the parser must separately be put into - /// streaming mode, as `JSONDecoder` operates generically over a sequence of `JSONEvent`s. - public var streaming: Bool = false - - /// Decodes and returns a top-level JSON value from the event stream. - /// - /// When `streaming` is `false`, any events after the top-level value has been consumed - /// will throw an error, and any subsequent calls to `decode()` after the first call - /// will also throw an error. When `streaming` is `false`, after a top-level value has - /// been decoded, no more events will be consumed, and `decode()` can be called repeatedly - /// to decode more top-level events. - /// - /// Because the normal operation of this class is to decode one-shot values rather than - /// streams, this method returns a non-optional value. As such, when operating in a - /// streaming manner, this method will throw the special error `JSONDecoderError.streamEnded` - /// to signal that there are no more values. To make this easier to work with, a convenience - /// method `decodeStream()` is provided that returns an array of `JSON` values and automatically - /// handles `JSONDecoderError.streamEnded`, and the type `JSONStreamDecoder` provides a - /// lazy sequence interface to decoding a JSON stream. - /// - /// - Returns: A single top-level `JSON` value. - /// - /// - Throws: `JSONParserError`, `JSONDecoderError`. - public mutating func decode() throws -> JSON { - bump() - if streaming && token == nil { - throw JSONDecoderError.streamEnded - } - let result = try buildValue() - if !streaming { - bump() - switch token { - case .none: break - case .some(.error(let err)): throw err - case .some: throw JSONDecoderError.unexpectedToken - } - } - return result - } - - /// Decodes and returns an array of top-level JSON values from the event stream. - /// - /// This is a convenience method that sets `streaming` to `true` and then decodes - /// as many top-level JSON values as it can before the stream ends. - /// - /// - Returns: An array of top-level `JSON` values. - /// - /// - SeeAlso: `JSONStreamDecoder`. - public mutating func decodeStream() throws -> [JSON] { - streaming = true - var results: [JSON] = [] - repeat { - do { - results.append(try decode()) - } catch JSONDecoderError.streamEnded { - return results - } - } while true - } - - private mutating func bump() { - token = iter.next() - } - - private mutating func buildValue() throws -> JSON { - switch token { - case .objectStart?: return try buildObject() - case .objectEnd?: throw error(.invalidSyntax) - case .arrayStart?: return try buildArray() - case .arrayEnd?: throw error(.invalidSyntax) - case .booleanValue(let b)?: return .bool(b) - case .int64Value(let i)?: return .int64(i) - case .doubleValue(let d)?: return .double(d) - case .stringValue(let s)?: return .string(s) - case .nullValue?: return .null - case .error(let err)?: throw err - case nil: throw error(.unexpectedEOF) - } - } - - private mutating func buildObject() throws -> JSON { - bump() - var dict: [String: JSON] = Dictionary(minimumCapacity: objectHighWaterMark) - defer { objectHighWaterMark = max(objectHighWaterMark, dict.count) } - while let token = self.token { - let key: String - switch token { - case .objectEnd: return .object(JSONObject(dict)) - case .error(let err): throw err - case .stringValue(let s): key = s - default: throw error(.nonStringKey) - } - bump() - dict[key] = try buildValue() - bump() - } - throw error(.unexpectedEOF) - } - - private mutating func buildArray() throws -> JSON { - bump() - var ary: JSONArray = [] - while let token = self.token { - if case .arrayEnd = token { - return .array(ary) - } - ary.append(try buildValue()) - bump() - } - throw error(.unexpectedEOF) - } - - private func error(_ code: JSONParserError.Code) -> JSONParserError { - return JSONParserError(code: code, line: iter.line, column: iter.column) - } - - private var iter: Seq.Iterator - private var token: JSONEvent? - private var objectHighWaterMark: Int = 0 -} - -/// Errors that may be thrown by the `JSONDecoder` during the decode stage. -public enum JSONDecoderError: Error { - /// Signals that a `JSONDecoder` operating in streaming mode has reached the end of the stream. - case streamEnded - /// Thrown when a `JSONDecoder` operating in one-shot mode finds extra tokens after the first top-level JSON value. - case unexpectedToken -} - -/// A JSON decoder that decodes a stream of JSON events into a lazy sequence of top-level JSON values. -/// -/// This is a sequence of zero or more `JSONStreamValue.json` values, ending with zero or one `JSONStreamValue.error` value. -/// -/// - Important: When wrapping a `JSONParser`, the parser must separately be put into streaming mode, as `JSONStreamDecoder` -/// operates generically over a sequence of `JSONEvent`s. You should consider using `JSON.decodeStream(_:)` instead to -/// create the stream decoder. -/// -/// - SeeAlso: `JSON.decodeStream(_:)`. -public struct JSONStreamDecoder: Sequence, IteratorProtocol where Seq.Iterator: JSONEventIterator, Seq.Iterator.Element == JSONEvent { - public init(_ parser: Seq) { - decoder = JSONDecoder(parser) - decoder.streaming = true - } - - /// Returns an array of all decoded values, or throws an error if one occurs. - /// - /// This eagerly decodes the rest of the JSON stream and returns all values. If a parse error occurs at any point, - /// the error is thrown and all values are discarded. - /// - /// - Returns: An array of `JSON` values. - /// - Throws: `JSONParserError`. - public func values() throws -> [JSON] { - return try map({ try $0.unwrap() }) - } - - public func makeIterator() -> JSONStreamDecoder { - return self - } - - public mutating func next() -> JSONStreamValue? { - do { - return try JSONStreamValue.json(decoder.decode()) - } catch JSONDecoderError.streamEnded { - return nil - } catch let error as JSONParserError { - return JSONStreamValue.error(error) - } catch { - // This shouldn't be reachable. A `JSONDecoder` operating in streaming mode can throw only - // `JSONParserError`s or `JSONDecoderError.streamEnded`. - return nil - } - } - - private var decoder: JSONDecoder -} - -public enum JSONStreamValue: Equatable { - case json(JSON) - case error(JSONParserError) - - /// Returns the contained `JSON` value, otherwise `nil`. - public var json: JSON? { - switch self { - case .json(let json): return json - case .error: return nil - } - } - - /// Returns the contained error, otherwise `nil`. - public var error: JSONParserError? { - switch self { - case .json: return nil - case .error(let error): return error - } - } - - /// Unwraps the contained `JSON` value or throws the contained error. - /// - /// - Throws: `JSONParserError`. - public func unwrap() throws -> JSON { - switch self { - case .json(let value): return value - case .error(let error): throw error - } - } - - public static func ==(lhs: JSONStreamValue, rhs: JSONStreamValue) -> Bool { - switch (lhs, rhs) { - case let (.json(a), .json(b)): return a == b - case let (.error(a), .error(b)): return a == b - default: return false - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Encoder.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Encoder.swift deleted file mode 100755 index 2d34874fd..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Encoder.swift +++ /dev/null @@ -1,167 +0,0 @@ -// -// Encoder.swift -// PMJSON -// -// Created by Kevin Ballard on 2/1/16. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -extension JSON { - /// Encodes a `JSON` to a `String`. - /// - Parameter json: The `JSON` to encode. - /// - Parameter pretty: If `true`, include extra whitespace for formatting. Default is `false`. - /// - Returns: A `String` with the JSON representation of *json*. - public static func encodeAsString(_ json: JSON, pretty: Bool = false) -> String { - var s = "" - encode(json, toStream: &s, pretty: pretty) - return s - } - - /// Encodes a `JSON` to an output stream. - /// - Parameter json: The `JSON` to encode. - /// - Parameter stream: The output stream to write the encoded JSON to. - /// - Parameter pretty: If `true`, include extra whitespace for formatting. Default is `false`. - public static func encode(_ json: JSON, toStream stream: inout Target, pretty: Bool = false) { - encode(json, toStream: &stream, indent: pretty ? 0 : nil) - } - - private static func encode(_ json: JSON, toStream stream: inout Target, indent: Int?) { - switch json { - case .null: encodeNull(&stream) - case .bool(let b): encodeBool(b, toStream: &stream) - case .int64(let i): encodeInt64(i, toStream: &stream) - case .double(let d): encodeDouble(d, toStream: &stream) - case .string(let s): encodeString(s, toStream: &stream) - case .object(let obj): encodeObject(obj, toStream: &stream, indent: indent) - case .array(let ary): encodeArray(ary, toStream: &stream, indent: indent) - } - } - - private static func encodeNull(_ stream: inout Target) { - stream.write("null") - } - - private static func encodeBool(_ value: Bool, toStream stream: inout Target) { - stream.write(value ? "true" : "false") - } - - private static func encodeInt64(_ value: Int64, toStream stream: inout Target) { - stream.write(String(value)) - } - - private static func encodeDouble(_ value: Double, toStream stream: inout Target) { - stream.write(String(value)) - } - - private static func encodeString(_ value: String, toStream stream: inout Target) { - stream.write("\"") - let scalars = value.unicodeScalars - var start = scalars.startIndex - let end = scalars.endIndex - var idx = start - while idx < scalars.endIndex { - let s: String - let c = scalars[idx] - switch c { - case "\\": s = "\\\\" - case "\"": s = "\\\"" - case "\n": s = "\\n" - case "\r": s = "\\r" - case "\t": s = "\\t" - case "\u{8}": s = "\\b" - case "\u{C}": s = "\\f" - case "\0"..<"\u{10}": - s = "\\u000\(String(c.value, radix: 16, uppercase: true))" - case "\u{10}"..<" ": - s = "\\u00\(String(c.value, radix: 16, uppercase: true))" - default: - idx = scalars.index(after: idx) - continue - } - if idx != start { - stream.write(String(scalars[start..(_ object: JSONObject, toStream stream: inout Target, indent: Int?) { - let indented = indent.map({$0+1}) - if let indent = indented { - stream.write("{\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write("{") - } - var first = true - for (key, value) in object { - if first { - first = false - } else if let indent = indented { - stream.write(",\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write(",") - } - encodeString(key, toStream: &stream) - stream.write(indented != nil ? ": " : ":") - encode(value, toStream: &stream, indent: indented) - } - if let indent = indent { - stream.write("\n") - writeIndent(indent, toStream: &stream) - } - stream.write("}") - } - - private static func encodeArray(_ array: JSONArray, toStream stream: inout Target, indent: Int?) { - let indented = indent.map({$0+1}) - if let indent = indented { - stream.write("[\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write("[") - } - var first = true - for elt in array { - if first { - first = false - } else if let indent = indented { - stream.write(",\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write(",") - } - encode(elt, toStream: &stream, indent: indented) - } - if let indent = indent { - stream.write("\n") - writeIndent(indent, toStream: &stream) - } - stream.write("]") - } - - private static func writeIndent(_ indent: Int, toStream stream: inout Target) { - for _ in stride(from: 4, through: indent, by: 4) { - stream.write(" ") - } - switch indent % 4 { - case 1: stream.write(" ") - case 2: stream.write(" ") - case 3: stream.write(" ") - default: break - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSON.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSON.swift deleted file mode 100755 index d54e23fc6..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSON.swift +++ /dev/null @@ -1,170 +0,0 @@ -// -// JSON.swift -// PMJSON -// -// Created by Kevin Ballard on 10/8/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -/// A single JSON-compatible value. -public enum JSON { - /// The null value. - case null - /// A boolean. - case bool(Bool) - /// A string. - case string(String) - /// A 64-bit integer. - case int64(Int64) - /// A number. - /// When decoding, any integer that doesn't fit in 64 bits and any floating-point number - /// is decoded as a `Double`. - case double(Double) - /// An object. - case object(JSONObject) - /// An array. - case array(JSONArray) - - /// Initializes `self` as a boolean with the value `bool`. - public init(_ bool: Bool) { - self = .bool(bool) - } - /// Initializes `self` as a string with the value `str`. - public init(_ str: String) { - self = .string(str) - } - /// Initializes `self` as a 64-bit integer with the value `i`. - public init(_ i: Int64) { - self = .int64(i) - } - /// Initializes `self` as a double with the value `d`. - public init(_ d: Double) { - self = .double(d) - } - /// Initializes `self` as an object with the value `obj`. - public init(_ obj: JSONObject) { - self = .object(obj) - } - /// Initializes `self` as an array with the value `ary`. - public init(_ ary: JSONArray) { - self = .array(ary) - } -} - -// Convenience conversions. -public extension JSON { - /// Initializes `self` as a 64-bit integer with the value `i`. - public init(_ i: Int) { - self = .int64(Int64(i)) - } - - /// Initializes `self` as an array with the contents of the sequence `seq`. - public init(_ seq: S) where S.Iterator.Element == JSON { - self = .array(JSONArray(seq)) - } - - /// Initializes `self` as an array with the contents of the sequence `seq`. - public init(_ seq: S) where S.Iterator.Element == JSONObject { - self = .array(JSONArray(seq.lazy.map(JSON.init))) - } - - /// Initializes `self` as an array with the contents of the sequence `seq`. - public init(_ seq: S) where S.Iterator.Element == JSONArray { - self = .array(JSONArray(seq.lazy.map(JSON.init))) - } -} - -public typealias JSONArray = ContiguousArray - -extension JSON: Equatable { - public static func ==(lhs: JSON, rhs: JSON) -> Bool { - switch (lhs, rhs) { - case (.null, .null): return true - case (.bool(let a), .bool(let b)): return a == b - case (.string(let a), .string(let b)): return a == b - case (.int64(let a), .int64(let b)): return a == b - case (.double(let a), .double(let b)): return a == b - case (.int64(let a), .double(let b)): return Double(a) == b - case (.double(let a), .int64(let b)): return a == Double(b) - case (.object(let a), .object(let b)): return a == b - case (.array(let a), .array(let b)): return a == b - default: return false - } - } -} - -extension JSON: TextOutputStreamable, CustomStringConvertible, CustomDebugStringConvertible { - public func write(to target: inout Target) { - JSON.encode(self, toStream: &target, pretty: false) - } - - public var description: String { - return JSON.encodeAsString(self, pretty: false) - } - - public var debugDescription: String { - let desc = JSON.encodeAsString(self, pretty: false) - return "JSON(\(desc))" - } -} - -extension JSON: ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByBooleanLiteral, ExpressibleByNilLiteral { - public init(integerLiteral value: Int64) { - self = .int64(value) - } - - public init(floatLiteral value: Double) { - self = .double(value) - } - - public init(booleanLiteral value: Bool) { - self = .bool(value) - } - - public init(nilLiteral: ()) { - self = .null - } -} - -extension JSON: ExpressibleByStringLiteral { - public init(stringLiteral value: String) { - self = .string(value) - } - - public init(extendedGraphemeClusterLiteral value: String) { - self = .string(value) - } - - public init(unicodeScalarLiteral value: String) { - self = .string(value) - } -} - -extension JSON: ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral { - public init(arrayLiteral elements: JSON...) { - self = .array(JSONArray(elements)) - } - - public init(dictionaryLiteral elements: (String, JSON)...) { - self = .object(JSONObject(elements)) - } -} - -extension JSON: CustomReflectable { - public var customMirror: Mirror { - switch self { - case .null, .bool, .string, .int64, .double: return Mirror(self, children: []) - case .object(let obj): - let children: LazyMapCollection = obj.lazy.map({ ($0, $1) }) - return Mirror(self, children: children, displayStyle: .dictionary) - case .array(let ary): - return Mirror(self, unlabeledChildren: ary, displayStyle: .collection) - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSONError.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSONError.swift deleted file mode 100755 index a55773e6f..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSONError.swift +++ /dev/null @@ -1,1619 +0,0 @@ -// -// JSONError.swift -// PMJSON -// -// Created by Kevin Ballard on 11/9/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -// MARK: JSONError - -/// Errors thrown by the JSON `get*` or `to*` accessor families. -public enum JSONError: Error, CustomStringConvertible { - /// Thrown when a given path is missing or has the wrong type. - /// - Parameter path: The path of the key that caused the error. - /// - Parameter expected: The type that was expected at this path. - /// - Parameter actual: The type of the value found at the path, or `nil` if there was no value. - case missingOrInvalidType(path: String?, expected: ExpectedType, actual: JSONType?) - /// Thrown when an integral value is coerced to a smaller type (e.g. `Int64` to `Int`) and the - /// value doesn't fit in the smaller type. - /// - Parameter path: The path of the value that cuased the error. - /// - Parameter value: The actual value at that path. - /// - Parameter expected: The type that the value doesn't fit in, e.g. `Int.self`. - case outOfRangeInt64(path: String?, value: Int64, expected: Any.Type) - /// Thrown when a floating-point value is coerced to a smaller type (e.g. `Double` to `Int`) - /// and the value doesn't fit in the smaller type. - /// - Parameter path: The path of the value that cuased the error. - /// - Parameter value: The actual value at that path. - /// - Parameter expected: The type that the value doesn't fit in, e.g. `Int.self`. - case outOfRangeDouble(path: String?, value: Double, expected: Any.Type) - - public var description: String { - switch self { - case let .missingOrInvalidType(path, expected, actual): return "\(path.map({"\($0): "}) ?? "")expected \(expected), found \(actual?.description ?? "missing value")" - case let .outOfRangeInt64(path, value, expected): return "\(path.map({"\($0): "}) ?? "")value \(value) cannot be coerced to type \(expected)" - case let .outOfRangeDouble(path, value, expected): return "\(path.map({"\($0): "}) ?? "")value \(value) cannot be coerced to type \(expected)" - } - } - - fileprivate func withPrefix(_ prefix: String) -> JSONError { - func prefixPath(_ path: String?, with prefix: String) -> String { - guard let path = path, !path.isEmpty else { return prefix } - if path.unicodeScalars.first == "[" { - return prefix + path - } else { - return "\(prefix).\(path)" - } - } - switch self { - case let .missingOrInvalidType(path, expected, actual): - return .missingOrInvalidType(path: prefixPath(path, with: prefix), expected: expected, actual: actual) - case let .outOfRangeInt64(path, value, expected): - return .outOfRangeInt64(path: prefixPath(path, with: prefix), value: value, expected: expected) - case let .outOfRangeDouble(path, value, expected): - return .outOfRangeDouble(path: prefixPath(path, with: prefix), value: value, expected: expected) - } - } - - public enum ExpectedType: CustomStringConvertible { - case required(JSONType) - case optional(JSONType) - - public var description: String { - switch self { - case .required(let type): return type.description - case .optional(let type): return "\(type) or null" - } - } - } - - public enum JSONType: String, CustomStringConvertible { - case null = "null" - case bool = "bool" - case string = "string" - case number = "number" - case object = "object" - case array = "array" - - internal static func forValue(_ value: JSON) -> JSONType { - switch value { - case .null: return .null - case .bool: return .bool - case .string: return .string - case .int64, .double: return .number - case .object: return .object - case .array: return .array - } - } - - public var description: String { - return rawValue - } - } -} - -// MARK: - Basic accessors -public extension JSON { - /// Returns the bool value if the receiver is a bool. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getBool() throws -> Bool { - guard let b = self.bool else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.bool), actual: .forValue(self)) } - return b - } - - /// Returns the bool value if the receiver is a bool. - /// - Returns: A `Bool` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getBoolOrNil() throws -> Bool? { - if let b = self.bool { return b } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.bool), actual: .forValue(self)) } - } - - /// Returns the string value if the receiver is a string. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getString() throws -> String { - guard let str = self.string else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.string), actual: .forValue(self)) } - return str - } - - /// Returns the string value if the receiver is a string. - /// - Returns: A `String` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getStringOrNil() throws -> String? { - if let str = self.string { return str } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.string), actual: .forValue(self)) } - } - - /// Returns the 64-bit integral value if the receiver is a number. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getInt64() throws -> Int64 { - guard let val = self.int64 else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) } - return val - } - - /// Returns the 64-bit integral value value if the receiver is a number. - /// - Returns: An `Int64` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getInt64OrNil() throws -> Int64? { - if let val = self.int64 { return val } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - - /// Returns the integral value if the receiver is a number. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the receiver is the wrong type, or if the 64-bit integral value - /// is too large to fit in an `Int`. - func getInt() throws -> Int { - guard let val = self.int64 else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) } - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } - - /// Returns the integral value if the receiver is a number. - /// - Returns: An `Int` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type, or if the 64-bit integral value - /// is too large to fit in an `Int`. - func getIntOrNil() throws -> Int? { - if let val = self.int64 { - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - - /// Returns the double value if the receiver is a number. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getDouble() throws -> Double { - guard let val = self.double else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) } - return val - } - - /// Returns the double value if the receiver is a number. - /// - Returns: A `Double` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getDoubleOrNil() throws -> Double? { - if let val = self.double { return val } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - - /// Returns the object value if the receiver is an object. - /// - Returns: An object value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getObject() throws -> JSONObject { - guard let dict = self.object else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.object), actual: .forValue(self)) } - return dict - } - - /// Returns the object value if the receiver is an object. - /// - Returns: An object value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getObjectOrNil() throws -> JSONObject? { - if let dict = self.object { return dict } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.object), actual: .forValue(self)) } - } - - /// Returns the array value if the receiver is an array. - /// - Returns: An array value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getArray() throws -> JSONArray { - guard let ary = self.array else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.array), actual: .forValue(self)) } - return ary - } - - /// Returns the array value if the receiver is an array. - /// - Returns: An array value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getArrayOrNil() throws -> JSONArray? { - if let ary = self.array { return ary } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.array), actual: .forValue(self)) } - } -} - -public extension JSON { - /// Returns the receiver coerced to a string value. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the receiver is an object or array. - func toString() throws -> String { - return try toStringMaybeNil(.required(.string)) ?? "null" - } - - /// Returns the receiver coerced to a string value. - /// - Returns: A `String` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is an object or array. - func toStringOrNil() throws -> String? { - return try toStringMaybeNil(.optional(.string)) - } - - private func toStringMaybeNil(_ expected: JSONError.ExpectedType) throws -> String? { - switch self { - case .string(let s): return s - case .null: return nil - case .bool(let b): return String(b) - case .int64(let i): return String(i) - case .double(let d): return String(d) - default: throw JSONError.missingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) - } - } - - /// Returns the receiver coerced to a 64-bit integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int64` value`. - /// - Throws: `JSONError` if the receiver is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to a 64-bit integral value, - /// or a floating-point value that does not fit in 64 bits. - func toInt64() throws -> Int64 { - guard let val = try toInt64MaybeNil(.required(.number)) else { - throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .null) - } - return val - } - - /// Returns the receiver coerced to a 64-bit integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int64` value`, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is a boolean, an object, an array, - /// a string that cannot be coerced to a 64-bit integral value, - /// or a floating-point value that does not fit in 64 bits. - func toInt64OrNil() throws -> Int64? { - return try toInt64MaybeNil(.optional(.number)) - } - - private func toInt64MaybeNil(_ expected: JSONError.ExpectedType) throws -> Int64? { - switch self { - case .int64(let i): - return i - case .double(let d): - guard let val = convertDoubleToInt64(d) else { - throw JSONError.outOfRangeDouble(path: nil, value: d, expected: Int64.self) - } - return val - case .string(let s): - if let i = Int64(s, radix: 10) { - return i - } else if let d = Double(s) { - guard let val = convertDoubleToInt64(d) else { - throw JSONError.outOfRangeDouble(path: nil, value: d, expected: Int64.self) - } - return val - } - case .null: - return nil - default: - break - } - throw JSONError.missingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) - } - - /// Returns the receiver coerced to an integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int` value`. - /// - Throws: `JSONError` if the receiver is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, - /// or a floating-point value that does not fit in an `Int`. - func toInt() throws -> Int { - let val = try toInt64() - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } - - /// Returns the receiver coerced to an integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int` value`, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, - /// or a floating-point value that does not fit in an `Int`. - func toIntOrNil() throws -> Int? { - guard let val = try toInt64OrNil() else { return nil } - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } - - /// Returns the receiver coerced to a `Double`. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the receiver is `null`, a boolean, an object, an array, - /// or a string that cannot be coerced to a floating-point value. - func toDouble() throws -> Double { - guard let val = try toDoubleMaybeNil(.required(.number)) else { - throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .null) - } - return val - } - - /// Returns the receiver coerced to a `Double`. - /// - Returns: A `Double` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is a boolean, an object, an array, - /// or a string that cannot be coerced to a floating-point value. - func toDoubleOrNil() throws -> Double? { - return try toDoubleMaybeNil(.optional(.number)) - } - - private func toDoubleMaybeNil(_ expected: JSONError.ExpectedType) throws -> Double? { - switch self { - case .int64(let i): return Double(i) - case .double(let d): return d - case .string(let s): return Double(s) - case .null: return nil - default: throw JSONError.missingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) - } - } -} - -// MARK: - Keyed accessors -public extension JSON { - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getBool(_ key: String) throws -> Bool { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .string) - return try scoped(key) { try value.getBool() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getBoolOrNil(_ key: String) throws -> Bool? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getBoolOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getString(_ key: String) throws -> String { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .string) - return try scoped(key) { try value.getString() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getStringOrNil(_ key: String) throws -> String? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getInt64(_ key: String) throws -> Int64 { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getInt64() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getInt64OrNil(_ key: String) throws -> Int64? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, - /// or if the 64-bit integral value is too large to fit in an `Int`, or if - /// the receiver is not an object. - func getInt(_ key: String) throws -> Int { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getInt() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the 64-bit integral - /// value is too large to fit in an `Int`, or if the receiver is not an object. - func getIntOrNil(_ key: String) throws -> Int? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getDouble(_ key: String) throws -> Double { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getDouble() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getDoubleOrNil(_ key: String) throws -> Double? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getDoubleOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObject(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - /// - SeeAlso: `getObject(_:_:)` - func getObject(_ key: String) throws -> JSONObject { - return try getObject(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObjectOrNil(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - /// - SeeAlso: `getObjectOrNil(_:_:)` - func getObjectOrNil(_ key: String) throws -> JSONObject? { - return try getObjectOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object, or any error thrown by `transform`. - func getObject(_ key: String, _ transform: (JSONObject) throws -> T) throws -> T { - return try getObject().getObject(key, transform) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object, - /// or any error thrown by `transform`. - func getObjectOrNil(_ key: String, _ transform: (JSONObject) throws -> T?) throws -> T? { - return try getObject().getObjectOrNil(key, transform) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArray(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - /// - SeeAlso: `getArray(_:_:)` - func getArray(_ key: String) throws -> JSONArray { - return try getArray(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArrayOrNil(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An array value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - /// - SeeAlso: `getArrayOrNil(_:_:)` - func getArrayOrNil(_ key: String) throws -> JSONArray? { - return try getArrayOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object, or any error thrown by `transform`. - func getArray(_ key: String, _ transform: (JSONArray) throws -> T) throws -> T { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .array) - return try scoped(key) { try transform(value.getArray()) } - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object, - /// or any error thrown by `transform`. - func getArrayOrNil(_ key: String, _ transform: (JSONArray) throws -> T?) throws -> T? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getArrayOrNil().flatMap(transform) } - } -} - -public extension JSON { - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist, the value is an object or an array, - /// or if the receiver is not an object. - /// - SeeAlso: `toString()`. - func toString(_ key: String) throws -> String { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .string) - return try scoped(key) { try value.toString() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is an object or an array, or if the receiver is not an object. - /// - SeeAlso: `toStringOrNil()`. - func toStringOrNil(_ key: String) throws -> String? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to a 64-bit integral value, or a floating-point - /// value that does not fit in 64 bits, or if the receiver is not an object. - func toInt64(_ key: String) throws -> Int64 { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toInt64() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to a 64-bit integral value, or a floating-point value - /// that does not fit in 64 bits, or if the receiver is not an object. - func toInt64OrNil(_ key: String) throws -> Int64? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, or a floating-point - /// value that does not fit in an `Int`, or if the receiver is not an object. - func toInt(_ key: String) throws -> Int { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toInt() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to an integral value, or a floating-point value - /// that does not fit in an `Int`, or if the receiver is not an object. - func toIntOrNil(_ key: String) throws -> Int? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a floating-point value, - /// or if the receiver is not an object. - func toDouble(_ key: String) throws -> Double { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toDouble() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a floating-point value, or if the receiver is not an object. - func toDoubleOrNil(_ key: String) throws -> Double? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toDoubleOrNil() } - } -} - -// MARK: - Indexed accessors -public extension JSON { - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getBool(_ index: Int) throws -> Bool { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .bool) - return try scoped(index) { try value.getBool() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Bool` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getBoolOrNil(_ index: Int) throws -> Bool? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getBoolOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getString(_ index: Int) throws -> String { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .string) - return try scoped(index) { try value.getString() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getStringOrNil(_ index: Int) throws -> String? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getStringOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getInt64(_ index: Int) throws -> Int64 { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.getInt64() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getInt64OrNil(_ index: Int) throws -> Int64? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getInt64OrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the 64-bit integral value is too large to fit in an `Int`, or if - /// the receiver is not an array. - func getInt(_ index: Int) throws -> Int { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.getInt() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the 64-bit integral value - /// is too large to fit in an `Int`, or if the receiver is not an array. - func getIntOrNil(_ index: Int) throws -> Int? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getIntOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getDouble(_ index: Int) throws -> Double { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.getDouble() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getDoubleOrNil(_ index: Int) throws -> Double? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getDoubleOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getObject(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An object value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - /// - SeeAlso: `getObject(_:_:)` - func getObject(_ index: Int) throws -> JSONObject { - return try getObject(index, { $0 }) - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getObjectOrNil(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An object value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - /// - SeeAlso: `getObjectOrNil(_:_:)` - func getObjectOrNil(_ index: Int) throws -> JSONObject? { - return try getObjectOrNil(index, { $0 }) - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array, or any error thrown by `transform`. - func getObject(_ index: Int, _ f: (JSONObject) throws -> T) throws -> T { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .object) - return try scoped(index) { try f(value.getObject()) } - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array, - //// or any error thrown by `transform`. - func getObjectOrNil(_ index: Int, _ f: (JSONObject) throws -> T?) throws -> T? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getObjectOrNil().flatMap(f) } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getArray(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An array value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - /// - SeeAlso: `getArray(_:_:)` - func getArray(_ index: Int) throws -> JSONArray { - return try getArray(index, { $0 }) - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getArrayOrNil(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An array value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - /// - SeeAlso: `getArrayOrNil(_:_:)` - func getArrayOrNil(_ index: Int) throws -> JSONArray? { - return try getArrayOrNil(index, { $0 }) - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array, or any error thrown by `transform`. - func getArray(_ index: Int, _ f: (JSONArray) throws -> T) throws -> T { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .array) - return try scoped(index) { try f(value.getArray()) } - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array, - /// or any error thrown by `transform`. - func getArrayOrNil(_ index: Int, _ f: (JSONArray) throws -> T?) throws -> T? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getArrayOrNil().flatMap(f) } - } -} - -public extension JSON { - /// Subscripts the receiver with `index` and returns the result coerced to a `String`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is an object or an array, - /// or if the receiver is not an array. - /// - SeeAlso: `toString()`. - func toString(_ index: Int) throws -> String { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .string) - return try scoped(index) { try value.toString() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to a `String`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is an object or an array, or if the receiver is not an array. - /// - SeeAlso: `toStringOrNil()`. - func toStringOrNil(_ index: Int) throws -> String? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toStringOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int64`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, a string that cannot be coerced to a 64-bit integral value, or a - /// floating-point value that does not fit in 64 bits, or if the receiver is not an array. - /// - SeeAlso: `toInt64()`. - func toInt64(_ index: Int) throws -> Int64 { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.toInt64() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int64`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to a 64-bit integral value, or a floating-point value - /// that does not fit in 64 bits, or if the receiver is not an array. - /// - SeeAlso: `toInt64OrNil()`. - func toInt64OrNil(_ index: Int) throws -> Int64? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toInt64OrNil() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, a string that cannot be coerced to an integral value, or a - /// floating-point value that does not fit in an `Int`, or if the receiver is not an array. - /// - SeeAlso: `toInt()`. - func toInt(_ index: Int) throws -> Int { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.toInt() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to an integral value, or a floating-point value - /// that does not fit in an `Int`, or if the receiver is not an array. - /// - SeeAlso: `toIntOrNil()`. - func toIntOrNil(_ index: Int) throws -> Int? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toIntOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to a `Double`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a floating-point value, - /// or if the receiver is not an array. - /// - SeeAlso: `toDouble()`. - func toDouble(_ index: Int) throws -> Double { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.toDouble() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to a `Double`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a floating-point value, or if the receiver is not an array. - /// - SeeAlso: `toDouble()`. - func toDoubleOrNil(_ index: Int) throws -> Double? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toDoubleOrNil() } - } -} - -// MARK: - - -public extension JSONObject { - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getBool(_ key: String) throws -> Bool { - let value = try getRequired(self, key: key, type: .string) - return try scoped(key) { try value.getBool() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getBoolOrNil(_ key: String) throws -> Bool? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getBoolOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getString(_ key: String) throws -> String { - let value = try getRequired(self, key: key, type: .string) - return try scoped(key) { try value.getString() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getStringOrNil(_ key: String) throws -> String? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getInt64(_ key: String) throws -> Int64 { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getInt64() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getInt64OrNil(_ key: String) throws -> Int64? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, - /// or if the 64-bit integral value is too large to fit in an `Int`. - func getInt(_ key: String) throws -> Int { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getInt() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the 64-bit integral - /// value is too large to fit in an `Int`. - func getIntOrNil(_ key: String) throws -> Int? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getDouble(_ key: String) throws -> Double { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getDouble() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getDoubleOrNil(_ key: String) throws -> Double? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getDoubleOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObject(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - /// - SeeAlso: `getObject(_:_:)` - func getObject(_ key: String) throws -> JSONObject { - return try getObject(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObjectOrNil(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - /// - SeeAlso: `getObjectOrNil(_:_:)` - func getObjectOrNil(_ key: String) throws -> JSONObject? { - return try getObjectOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or any - /// error thrown by `transform`. - func getObject(_ key: String, _ f: (JSONObject) throws -> T) throws -> T { - let value = try getRequired(self, key: key, type: .object) - return try scoped(key) { try f(value.getObject()) } - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or any error thrown by `transform`. - func getObjectOrNil(_ key: String, _ f: (JSONObject) throws -> T?) throws -> T? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getObjectOrNil().flatMap(f) } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArray(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - /// - SeeAlso: `getArray(_:_:)` - func getArray(_ key: String) throws -> JSONArray { - return try getArray(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArrayOrNil(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An array value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - /// - SeeAlso: `getArrayOrNil(_:_:)` - func getArrayOrNil(_ key: String) throws -> JSONArray? { - return try getArrayOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or any - /// error thrown by `transform`. - func getArray(_ key: String, _ f: (JSONArray) throws -> T) throws -> T { - let value = try getRequired(self, key: key, type: .array) - return try scoped(key) { try f(value.getArray()) } - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or any error thrown by `transform`. - func getArrayOrNil(_ key: String, _ f: (JSONArray) throws -> T?) throws -> T? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getArrayOrNil().flatMap(f) } - } -} - -public extension JSONObject { - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist, the value is an object or an array, - /// or if the receiver is not an object. - /// - SeeAlso: `toString()`. - func toString(_ key: String) throws -> String { - let value = try getRequired(self, key: key, type: .string) - return try scoped(key) { try value.toString() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is an object or an array, or if the receiver is not an object. - /// - SeeAlso: `toStringOrNil()`. - func toStringOrNil(_ key: String) throws -> String? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to a 64-bit integral value, or a floating-point - /// value that does not fit in 64 bits, or if the receiver is not an object. - func toInt64(_ key: String) throws -> Int64 { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toInt64() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to a 64-bit integral value, or a floating-point value - /// that does not fit in 64 bits, or if the receiver is not an object. - func toInt64OrNil(_ key: String) throws -> Int64? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, or a floating-point - /// value that does not fit in an `Int`, or if the receiver is not an object. - func toInt(_ key: String) throws -> Int { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toInt() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to an integral value, or a floating-point value - /// that does not fit in an `Int`, or if the receiver is not an object. - func toIntOrNil(_ key: String) throws -> Int? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a floating-point value, - /// or if the receiver is not an object. - func toDouble(_ key: String) throws -> Double { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toDouble() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a floating-point value, or if the receiver is not an object. - func toDoubleOrNil(_ key: String) throws -> Double? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toDoubleOrNil() } - } -} - -// MARK: - JSONArray helpers - -public extension JSON { - /// Returns an `Array` containing the results of mapping `transform` over `array`. - /// - /// If `transform` throws a `JSONError`, the error will be modified to include the index - /// of the element that caused the error. - /// - /// - Parameter array: The `JSONArray` to map over. - /// - Parameter transform: A block that is called once for each element of `array`. - /// - Returns: An array with the results of mapping `transform` over `array`. - /// - Throws: Rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - static func map(_ array: JSONArray, _ transform: (JSON) throws -> T) rethrows -> [T] { - return try array.enumerated().map({ i, elt in try scoped(i, { try transform(elt) }) }) - } - - /// Returns an `Array` containing the non-`nil` results of mapping `transform` over `array`. - /// - /// If `transform` throws a `JSONError`, the error will be modified to include the index - /// of the element that caused the error. - /// - /// - Parameter array: The `JSONArray` to map over. - /// - Parameter transform: A block that is called once for each element of `array`. - /// - Returns: An array with the non-`nil` results of mapping `transform` over `array`. - /// - Throws: Rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - static func flatMap(_ array: JSONArray, _ transform: (JSON) throws -> T?) rethrows -> [T] { - return try array.enumerated().flatMap({ i, elt in try scoped(i, { try transform(elt) }) }) - } - - /// Returns an `Array` containing the concatenated results of mapping `transform` over `array`. - /// - /// If `transform` throws a `JSONError`, the error will be modified to include the index - /// of the element that caused the error. - /// - /// - Parameter array: The `JSONArray` to map over. - /// - Parameter transform: A block that is called once for each element of `array`. - /// - Returns: An array with the concatenated results of mapping `transform` over `array`. - /// - Throws: Rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - static func flatMap(_ array: JSONArray, _ transform: (JSON) throws -> S) rethrows -> [S.Iterator.Element] { - return try array.enumerated().flatMap({ (i, elt) in - return try scoped(i, { try transform(elt) }) - }) - } -} - -public extension JSON { - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an object, `key` does not exist, or the value - /// is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArray(_ key: String, _ transform: (JSON) throws -> T) throws -> [T] { - return try getArray(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(index, { try JSON.map($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an array, `index` is out of bounds, or the - /// value is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArray(_ index: Int, _ transform: (JSON) throws -> T) throws -> [T] { - return try getArray(index, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array, or `nil` if - /// `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or `key` exists but the value is not - /// an array or `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// Returns `nil` if `index` is out of bounds or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(index, { try JSON.map($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array, or `nil` if - /// `index` is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or the subscript value is not an - /// array or `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArrayOrNil(_ index: Int, _ transform: (JSON) throws -> T) throws -> [T]? { - return try getArrayOrNil(index, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an object, `key` does not exist, or the value - /// is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArray(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an object, `key` does not exist, or the value - /// is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArray(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an array, `index` is out of bounds, or the - /// value is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArray(_ index: Int, _ transform: (JSON) throws -> T?) throws -> [T] { - return try getArray(index, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an array, `index` is out of bounds, or the - /// value is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArray(_ index: Int, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element] { - return try getArray(index, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array, or - /// `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array, - /// or `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// Returns `nil` if `index` is out of bounds or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array, or - /// `nil` if `index` is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an array or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArrayOrNil(_ index: Int, _ transform: (JSON) throws -> T?) throws -> [T]? { - return try getArrayOrNil(index, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// Returns `nil` if `index` is out of bounds or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array, - /// or `nil` if `index` is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an array or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArrayOrNil(_ index: Int, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element]? { - return try getArrayOrNil(index, { try JSON.flatMap($0, transform) }) - } -} - -public extension JSONObject { - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array. - /// - Throws: `JSONError` if `key` does not exist or the value is not an array. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArray(_ key: String, _ transform: (JSON) throws -> T) throws -> [T] { - return try getArray(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array, or `nil` if - /// `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if `key` exists but the value is not an array or `null`. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array. - /// - Throws: `JSONError` if `key` does not exist or the value is not an array. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArray(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array. - /// - Throws: `JSONError` if `key` does not exist or the value is not an array. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArray(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array, or - /// `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if `key` exists but the value is not an array or `null`. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array, - /// or `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if `key` exists but the value is not an array or `null`. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } -} - -// MARK: - - -internal func getRequired(_ dict: JSONObject, key: String, type: JSONError.JSONType) throws -> JSON { - guard let value = dict[key] else { throw JSONError.missingOrInvalidType(path: key, expected: .required(type), actual: nil) } - return value -} - -internal func getRequired(_ ary: JSONArray, index: Int, type: JSONError.JSONType) throws -> JSON { - guard let value = ary[safe: index] else { throw JSONError.missingOrInvalidType(path: "[\(index)]", expected: .required(type), actual: nil) } - return value -} - -@inline(__always) -internal func scoped(_ key: String, _ f: () throws -> T) rethrows -> T { - do { - return try f() - } catch let error as JSONError { - throw error.withPrefix(key) - } -} - -@inline(__always) -internal func scoped(_ index: Int, _ f: () throws -> T) rethrows -> T { - do { - return try f() - } catch let error as JSONError { - throw error.withPrefix("[\(index)]") - } -} - -internal extension ContiguousArray { - subscript(safe index: Int) -> Element? { - guard index >= startIndex && index < endIndex else { return nil } - return self[index] - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSONObject.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSONObject.swift deleted file mode 100755 index 1d1aa9bbb..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/JSONObject.swift +++ /dev/null @@ -1,215 +0,0 @@ -// -// JSONObject.swift -// PMJSON -// -// Created by Kevin Ballard on 11/10/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -/// A collection of key-value pairs that maps `String` to `JSON`. -/// -/// This collection abstracts away the underlying representation and allows for JSON-specific -/// methods to be added. -public struct JSONObject { - /// Creates an empty object. - public init() { - dictionary = [:] - } - - /// Creates an object from a sequence of `(String,JSON)` pairs. - public init(_ seq: S) where S.Iterator.Element == (String,JSON) { - // optimize for the case where the sequence doesn't contain duplicate keys - dictionary = Dictionary(minimumCapacity: seq.underestimatedCount) - for (key,value) in seq { - dictionary[key] = value - } - } - - /// The JSON object represented as a `[String: JSON]`. - public fileprivate(set) var dictionary: [String: JSON] - - public subscript(key: String) -> JSON? { - @inline(__always) get { - return dictionary[key] - } - @inline(__always) set { - dictionary[key] = newValue - } - } -} - -extension JSONObject: Collection { - /// The position of the first element in a non-empty object. - /// - /// Identical to `endIndex` in an empty object. - public var startIndex: Index { - return Index(dictionary.startIndex) - } - - /// The collection's "past the end" position. - /// - /// `endIndex` is not a valid argument to `subscript`, and is always reachable from `startIndex` - /// by zero or more applications of `successor()`. - public var endIndex: Index { - return Index(dictionary.endIndex) - } - - /// Returns `true` iff `self` is empty. - public var isEmpty: Bool { - return dictionary.isEmpty - } - - /// The number of entries in the object. - public var count: Int { - return dictionary.count - } - - public func makeIterator() -> Iterator { - return Iterator(dictionary.makeIterator()) - } - - public subscript(position: Index) -> (String,JSON) { - return dictionary[position.base] - } - - public func index(after i: Index) -> Index { - return Index(dictionary.index(after: i.base)) - } - - public func formIndex(after i: inout Index) { - dictionary.formIndex(after: &i.base) - } - - /// Represents a position in a `JSONObject`. - public struct Index: Comparable { - fileprivate var base: Dictionary.Index - - fileprivate init(_ base: Dictionary.Index) { - self.base = base - } - - public static func ==(lhs: JSONObject.Index, rhs: JSONObject.Index) -> Bool { - return lhs.base == rhs.base - } - - public static func <(lhs: JSONObject.Index, rhs: JSONObject.Index) -> Bool { - return lhs.base < rhs.base - } - } - - public struct Iterator: IteratorProtocol { - private var base: Dictionary.Iterator - - fileprivate init(_ base: Dictionary.Iterator) { - self.base = base - } - - /// Advance to the next element and return it, or `nil` if no next element exists. - /// - /// - Requires: No preceding call to `self.next()` has returned `nil`. - public mutating func next() -> (String,JSON)? { - return base.next() - } - } -} - -extension JSONObject { - /// A collection containing just the keys of `self`. - /// - /// Keys appear in the same order as they occur as the `.0` member of key-value pairs in `self`. - /// Each key in the result has a unique value. - public var keys: LazyMapCollection { - return lazy.map({ $0.0 }) - } - - /// A collection containing just the values of `self`. - /// - /// Values appear in the same order as they occur as the `.1` member of key-value pairs in `self`. - public var values: LazyMapCollection { - return lazy.map({ $0.1 }) - } - - /// Returns the `Index` for the given key, or `nil` if the key is not present in the object. - public func indexForKey(_ key: String) -> Index? { - return dictionary.index(forKey: key).map(Index.init) - } - - /// Update the value stored in the object for the given key, or, if the key does not exist, - /// add a new key-value pair to the object. - /// - /// Returns the value that was replaced, or `nil` if a new key-value pair was added. - public mutating func updateValue(_ value: JSON, forKey key: String) -> JSON? { - return dictionary.updateValue(value, forKey: key) - } - - /// Remove the key-value pair at `index`. - /// - /// Invalidates all indices with respect to `self`. - public mutating func removeAtIndex(_ index: Index) -> (String,JSON)? { - return dictionary.remove(at: index.base) - } - - /// Remove a given key and the associated value from the object. - /// Returns the value that was removed, or `nil` if the key was not present in the object. - public mutating func removeValueForKey(_ key: String) -> JSON? { - return dictionary.removeValue(forKey: key) - } - - /// Remove all elements. - /// - /// Invalidates all indices with respect to `self`. - public mutating func removeAll() { - dictionary.removeAll() - } - - /// If `!self.isEmpty`, return the first key-value pair in the sequence of elements, otherwise return `nil`. - public mutating func popFirst() -> (String,JSON)? { - return dictionary.popFirst() - } -} - -extension JSONObject: ExpressibleByDictionaryLiteral { - /// Creates an object from a dictionary. - public init(_ dictionary: [String: JSON]) { - self.dictionary = dictionary - } - - /// Creates an object initialized with `elements`. - public init(dictionaryLiteral elements: (String, JSON)...) { - self.init(elements) - } -} - -extension JSONObject: TextOutputStreamable, CustomStringConvertible, CustomDebugStringConvertible { - public func write(to target: inout Target) { - JSON.encode(JSON(self), toStream: &target, pretty: false) - } - - public var description: String { - return JSON.encodeAsString(JSON(self), pretty: false) - } - - public var debugDescription: String { - let desc = JSON.encodeAsString(JSON(self), pretty: false) - return "JSONObject(\(desc))" - } -} - -extension JSONObject: Equatable { - public static func ==(lhs: JSONObject, rhs: JSONObject) -> Bool { - return lhs.dictionary == rhs.dictionary - } -} - -extension JSONObject: CustomReflectable { - public var customMirror: Mirror { - let children: LazyMapCollection, Mirror.Child> = dictionary.lazy.map({ ($0,$1) }) - return Mirror(self, children: children, displayStyle: .dictionary) - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/ObjectiveC.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/ObjectiveC.swift deleted file mode 100755 index 30389ccca..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/ObjectiveC.swift +++ /dev/null @@ -1,233 +0,0 @@ -// -// ObjectiveC.swift -// PMJSON -// -// Created by Kevin Ballard on 10/9/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -#if os(iOS) || os(OSX) || os(watchOS) || os(tvOS) - - import Foundation - - extension JSON { - /// Decodes a `Data` as JSON. - /// - Note: Invalid UTF8 sequences in the data are replaced with U+FFFD. - /// - Parameter strict: If `true`, trailing commas in arrays/objects are treated as errors. Default is `false`. - /// - Returns: A `JSON` value. - /// - Throws: `JSONParserError` if the data does not contain valid JSON. - public static func decode(_ data: Data, strict: Bool = false) throws -> JSON { - return try JSON.decode(UTF8Decoder(data: data), strict: strict) - } - - /// Encodes a `JSON` to a `Data`. - /// - Parameter json: The `JSON` to encode. - /// - Parameter pretty: If `true`, include extra whitespace for formatting. Default is `false`. - /// - Returns: An `NSData` with the JSON representation of *json*. - public static func encodeAsData(_ json: JSON, pretty: Bool = false) -> Data { - struct Output: TextOutputStream { - // NB: We use NSMutableData instead of Data because it's significantly faster as of Xcode 8b3 - var data = NSMutableData() - mutating func write(_ string: String) { - let oldLen = data.length - data.increaseLength(by: string.utf8.count) - let ptr = data.mutableBytes.assumingMemoryBound(to: UInt8.self) + oldLen - for (i, x) in string.utf8.enumerated() { - ptr[i] = x - } - } - } - var output = Output() - JSON.encode(json, toStream: &output, pretty: pretty) - return output.data as Data - } - } - - extension JSON { - /// Converts a JSON-compatible Foundation object into a `JSON` value. - /// - Throws: `JSONFoundationError` if the object is not JSON-compatible. - public init(ns: Any) throws { - let object = ns as AnyObject - if object === kCFBooleanTrue { - self = .bool(true) - return - } else if object === kCFBooleanFalse { - self = .bool(false) - return - } - switch object { - case is NSNull: - self = .null - case let n as NSNumber: - let typeChar: UnicodeScalar - let objCType = n.objCType - if objCType[0] == 0 || objCType[1] != 0 { - typeChar = "?" - } else { - typeChar = UnicodeScalar(UInt8(bitPattern: objCType[0])) - } - switch typeChar { - case "c", "i", "s", "l", "q", "C", "I", "S", "L", "B": - self = .int64(n.int64Value) - case "Q": // unsigned long long - let val = n.uint64Value - if val > UInt64(Int64.max) { - fallthrough - } - self = .int64(Int64(val)) - default: - self = .double(n.doubleValue) - } - case let s as String: - self = .string(s) - case let dict as NSDictionary: - var obj: [String: JSON] = Dictionary(minimumCapacity: dict.count) - for (key, value) in dict { - guard let key = key as? String else { throw JSONFoundationError.nonStringKey } - obj[key] = try JSON(ns: value) - } - self = .object(JSONObject(obj)) - case let array as NSArray: - var ary: JSONArray = [] - ary.reserveCapacity(array.count) - for elt in array { - ary.append(try JSON(ns: elt)) - } - self = .array(ary) - default: - throw JSONFoundationError.incompatibleType - } - } - - /// Returns the JSON as a JSON-compatible Foundation object. - public var ns: Any { - switch self { - case .null: return NSNull() - case .bool(let b): return NSNumber(value: b) - case .string(let s): return s - case .int64(let i): return NSNumber(value: i) - case .double(let d): return d - case .object(let obj): return obj.ns - case .array(let ary): - return ary.map({$0.ns}) - } - } - - /// Returns the JSON as a JSON-compatible Foundation object, discarding any nulls. - public var nsNoNull: Any? { - switch self { - case .null: return nil - case .bool(let b): return NSNumber(value: b) - case .string(let s): return s - case .int64(let i): return NSNumber(value: i) - case .double(let d): return d - case .object(let obj): return obj.nsNoNull - case .array(let ary): - return ary.flatMap({$0.nsNoNull}) - } - } - } - - extension JSONObject { - /// Returns the JSON as a JSON-compatible dictionary. - public var ns: [AnyHashable: Any] { - var dict: [AnyHashable: Any] = Dictionary(minimumCapacity: count) - for (key, value) in self { - dict[key] = value.ns - } - return dict - } - - /// Returns the JSON as a JSON-compatible dictionary, discarding any nulls. - public var nsNoNull: [AnyHashable: Any] { - var dict: [AnyHashable: Any] = Dictionary(minimumCapacity: count) - for (key, value) in self { - if let value = value.nsNoNull { - dict[key] = value - } - } - return dict - } - } - - // MARK: - Errors - - /// An error that is thrown when converting from `AnyObject` to `JSON`. - /// - SeeAlso: `JSON.init(ns:)` - public enum JSONFoundationError: Error { - /// Thrown when a non-JSON-compatible type is found. - case incompatibleType - /// Thrown when a dictionary has a key that is not a string. - case nonStringKey - } - - extension JSONError: LocalizedError { - public var errorDescription: String? { - return String(describing: self) - } - } - - extension JSONParserError: CustomNSError { - public static let errorDomain: String = "PMJSON.JSONParserError" - - public var errorCode: Int { - return code.rawValue - } - - public var errorUserInfo: [String: Any] { - return [NSLocalizedDescriptionKey: String(describing: self)] - } - } - - extension JSONDecoderError: LocalizedError { - public var failureReason: String? { - switch self { - case .streamEnded: return "The JSON event stream ended." - case .unexpectedToken: return "The JSON event stream contained more than one top-level value." - } - } - } - - // MARK: - - - private struct UTF8Decoder: Sequence { - init(data: Data) { - self.data = data as NSData - } - - func makeIterator() -> Iterator { - return Iterator(data: data) - } - - private let data: NSData - - fileprivate struct Iterator: IteratorProtocol { - init(data: NSData) { - // NB: We use NSData instead of using Data's iterator because it's significantly faster as of Xcode 8b3 - self.data = data - let ptr = UnsafeBufferPointer(start: data.bytes.assumingMemoryBound(to: UInt8.self), count: data.length) - iter = ptr.makeIterator() - utf8 = UTF8() - } - - mutating func next() -> UnicodeScalar? { - switch utf8.decode(&iter) { - case .scalarValue(let scalar): return scalar - case .error: return "\u{FFFD}" - case .emptyInput: return nil - } - } - - private let data: NSData - private var iter: UnsafeBufferPointerIterator - private var utf8: UTF8 - } - } - -#endif // os(iOS) || os(OSX) || os(watchOS) || os(tvOS) diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Parser.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Parser.swift deleted file mode 100755 index fb7038983..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/Parser.swift +++ /dev/null @@ -1,674 +0,0 @@ -// -// Decoder.swift -// PMJSON -// -// Created by Kevin Ballard on 10/8/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -#if os(Linux) - import Glibc -#else - import Darwin -#endif - -/// A streaming JSON parser that consumes a sequence of unicode scalars. -public struct JSONParser: Sequence where Seq.Iterator.Element == UnicodeScalar { - public init(_ seq: Seq) { - base = seq - } - - /// If `true`, trailing commas in dictionaries and arrays are treated as an error. - /// Defaults to `false`. - public var strict: Bool = false - - /// If `true`, the parser will parse a stream of json values with optional whitespace delimiters. - /// The default value of `false` makes the parser emit an error if there's any non-whitespace - /// characters after the first JSON value. - /// - /// For example, with the input `"[1] [2,3]"`, if `streaming` is `true` the parser will emit - /// events for the second JSON array after the first one, but if `streaming` is `false` it will - /// emit an error upon encountering the second `[`. - /// - /// - Note: If `streaming` is `true` and the input is empty (or contains only whitespace), the - /// parser will return `nil` instead of emitting an `.unexpectedEOF` error. - public var streaming: Bool = false - - public func makeIterator() -> JSONParserIterator { - var iter = JSONParserIterator(base.makeIterator()) - iter.strict = strict - iter.streaming = streaming - return iter - } - - private let base: Seq -} - -/// The iterator for `JSONParser`. -public struct JSONParserIterator: JSONEventIterator where Iter.Element == UnicodeScalar { - public init(_ iter: Iter) { - base = PeekIterator(iter) - } - - /// If `true`, trailing commas in dictionaries and arrays are treated as an error. - /// Defaults to `false`. - public var strict: Bool = false - - /// If `true`, the parser will parse a stream of json values with optional whitespace delimiters. - /// The default value of `false` makes the parser emit an error if there's any non-whitespace - /// characters after the first JSON value. - /// - /// For example, with the input `"[1] [2,3]"`, if `streaming` is `true` the parser will emit - /// events for the second JSON array after the first one, but if `streaming` is `false` it will - /// emit an error upon encountering the second `[`. - /// - /// - Note: If `streaming` is `true` and the input is empty (or contains only whitespace), the - /// parser will return `nil` instead of emitting an `.unexpectedEOF` error. - public var streaming: Bool = false - - public mutating func next() -> JSONEvent? { - do { - // the only states that may loop are parseArrayComma, parseObjectComma, and (if streaming) parseEnd, - // which are all guaranteed to shift to other states (if they don't return) so the loop is finite - while true { - switch state { - case .parseArrayComma: - switch skipWhitespace() { - case ","?: - state = .parseArray(first: false) - continue - case "]"?: - try popStack() - return .arrayEnd - case .some: - throw error(.invalidSyntax) - case nil: - throw error(.unexpectedEOF) - } - case .parseObjectComma: - switch skipWhitespace() { - case ","?: - state = .parseObjectKey(first: false) - continue - case "}"?: - try popStack() - return .objectEnd - case .some: - throw error(.invalidSyntax) - case nil: - throw error(.unexpectedEOF) - } - case .initial: - guard let c = skipWhitespace() else { - if streaming { - state = .finished - return nil - } else { - throw error(.unexpectedEOF) - } - } - let evt = try parseValue(c) - switch evt { - case .arrayStart, .objectStart: - break - default: - state = .parseEnd - } - return evt - case .parseArray(let first): - guard let c = skipWhitespace() else { throw error(.unexpectedEOF) } - switch c { - case "]": - if !first && strict { - throw error(.trailingComma) - } - try popStack() - return .arrayEnd - case ",": - throw error(.missingValue) - default: - let evt = try parseValue(c) - switch evt { - case .arrayStart, .objectStart: - break - default: - state = .parseArrayComma - } - return evt - } - case .parseObjectKey(let first): - guard let c = skipWhitespace() else { throw error(.unexpectedEOF) } - switch c { - case "}": - if !first && strict { - throw error(.trailingComma) - } - try popStack() - return .objectEnd - case ",", ":": - throw error(.missingKey) - default: - let evt = try parseValue(c) - switch evt { - case .stringValue: - state = .parseObjectValue - default: - throw error(.nonStringKey) - } - return evt - } - case .parseObjectValue: - guard skipWhitespace() == ":" else { throw error(.expectedColon) } - guard let c = skipWhitespace() else { throw error(.unexpectedEOF) } - switch c { - case ",", "}": - throw error(.missingValue) - default: - let evt = try parseValue(c) - switch evt { - case .arrayStart, .objectStart: - break - default: - state = .parseObjectComma - } - return evt - } - case .parseEnd: - if streaming { - state = .initial - } else if skipWhitespace() != nil { - throw error(.trailingCharacters) - } else { - state = .finished - return nil - } - case .finished: - return nil - } - } - } catch let error as JSONParserError { - state = .finished - return .error(error) - } catch { - fatalError("unexpected error \(error)") - } - } - - private mutating func popStack() throws { - if stack.popLast() == nil { - fatalError("exhausted stack") - } - switch stack.last { - case .array?: - state = .parseArrayComma - case .object?: - state = .parseObjectComma - case nil: - state = .parseEnd - } - } - - private mutating func parseValue(_ c: UnicodeScalar) throws -> JSONEvent { - switch c { - case "[": - state = .parseArray(first: true) - stack.append(.array) - return .arrayStart - case "{": - state = .parseObjectKey(first: true) - stack.append(.object) - return .objectStart - case "\"": - var scalars = String.UnicodeScalarView() - while let c = bump() { - switch c { - case "\"": - return .stringValue(String(scalars)) - case "\\": - let c = try bumpRequired() - switch c { - case "\"", "\\", "/": scalars.append(c) - case "b": scalars.append(UnicodeScalar(0x8)) - case "f": scalars.append(UnicodeScalar(0xC)) - case "n": scalars.append("\n" as UnicodeScalar) - case "r": scalars.append("\r" as UnicodeScalar) - case "t": scalars.append("\t" as UnicodeScalar) - case "u": - let codeUnit = try parseFourHex() - if UTF16.isLeadSurrogate(codeUnit) { - guard try (bumpRequired() == "\\" && bumpRequired() == "u") else { - throw error(.loneLeadingSurrogateInUnicodeEscape) - } - let trail = try parseFourHex() - if UTF16.isTrailSurrogate(trail) { - let lead = UInt32(codeUnit) - let trail = UInt32(trail) - // NB: The following is split up to avoid exponential time complexity in the type checker - let leadComponent: UInt32 = (lead - 0xD800) << 10 - let trailComponent: UInt32 = trail - 0xDC00 - let scalar = UnicodeScalar(leadComponent + trailComponent + 0x10000)! - scalars.append(scalar) - } else { - throw error(.loneLeadingSurrogateInUnicodeEscape) - } - } else { - scalars.append(UnicodeScalar(codeUnit)!) - } - default: - throw error(.invalidEscape) - } - case "\0"..."\u{1F}": - throw error(.invalidSyntax) - default: - scalars.append(c) - } - } - throw error(.unexpectedEOF) - case "-", "0"..."9": - var tempBuffer: ContiguousArray - if let buffer = replace(&self.tempBuffer, with: nil) { - tempBuffer = buffer - tempBuffer.removeAll(keepingCapacity: true) - } else { - tempBuffer = ContiguousArray() - tempBuffer.reserveCapacity(12) - } - defer { self.tempBuffer = tempBuffer } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - outerLoop: while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - case ".": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - guard let c = bump(), case "0"..."9" = c else { throw error(.invalidNumber) } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - loop: while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - case "e", "E": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - guard let c = bump() else { throw error(.invalidNumber) } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - switch c { - case "-", "+": - guard let c = bump(), case "0"..."9" = c else { throw error(.invalidNumber) } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - case "0"..."9": break - default: throw error(.invalidNumber) - } - while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - default: - break loop - } - } - break loop - default: - break loop - } - } - tempBuffer.append(0) - return .doubleValue(tempBuffer.withUnsafeBufferPointer({strtod($0.baseAddress, nil)})) - case "e", "E": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - guard let c = bump(), case "0"..."9" = c else { throw error(.invalidNumber) } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - loop: while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - default: - break loop - } - } - tempBuffer.append(0) - return .doubleValue(tempBuffer.withUnsafeBufferPointer({strtod($0.baseAddress, nil)})) - default: - break outerLoop - } - } - if tempBuffer.count == 1 && tempBuffer[0] == 0x2d /* - */ { - throw error(.invalidNumber) - } - tempBuffer.append(0) - let num = tempBuffer.withUnsafeBufferPointer({ ptr -> Int64? in - errno = 0 - let n = strtoll(ptr.baseAddress, nil, 10) - if n == 0 && errno != 0 { - return nil - } else { - return n - } - }) - if let num = num { - return .int64Value(num) - } - // out of range, fall back to Double - return .doubleValue(tempBuffer.withUnsafeBufferPointer({strtod($0.baseAddress, nil)})) - case "t": - let line = self.line, column = self.column - guard case "r"? = bump(), case "u"? = bump(), case "e"? = bump() else { - throw JSONParserError(code: .invalidSyntax, line: line, column: column) - } - return .booleanValue(true) - case "f": - let line = self.line, column = self.column - guard case "a"? = bump(), case "l"? = bump(), case "s"? = bump(), case "e"? = bump() else { - throw JSONParserError(code: .invalidSyntax, line: line, column: column) - } - return .booleanValue(false) - case "n": - let line = self.line, column = self.column - guard case "u"? = bump(), case "l"? = bump(), case "l"? = bump() else { - throw JSONParserError(code: .invalidSyntax, line: line, column: column) - } - return .nullValue - default: - throw error(.invalidSyntax) - } - } - - private mutating func skipWhitespace() -> UnicodeScalar? { - while let c = bump() { - switch c { - case " ", "\t", "\n", "\r": continue - default: return c - } - } - return nil - } - - private mutating func parseFourHex() throws -> UInt16 { - var codepoint: UInt32 = 0 - for _ in 0..<4 { - let c = try bumpRequired() - codepoint <<= 4 - switch c { - case "0"..."9": - codepoint += c.value - 48 - case "a"..."f": - codepoint += c.value - 87 - case "A"..."F": - codepoint += c.value - 55 - default: - throw error(.invalidEscape) - } - } - return UInt16(truncatingBitPattern: codepoint) - } - - @inline(__always) @discardableResult private mutating func bump() -> UnicodeScalar? { - let c = base.next() - if c == "\n" { - line += 1 - column = 0 - } else { - column += 1 - } - return c - } - - @inline(__always) private mutating func bumpRequired() throws -> UnicodeScalar { - guard let c = bump() else { throw error(.unexpectedEOF) } - return c - } - - private func error(_ code: JSONParserError.Code) -> JSONParserError { - return JSONParserError(code: code, line: line, column: column) - } - - /// The line of the last emitted token. - public private(set) var line: UInt = 0 - /// The column of the last emitted token. - public private(set) var column: UInt = 0 - - private var base: PeekIterator - private var state: State = .initial - private var stack: [Stack] = [] - private var tempBuffer: ContiguousArray? -} - -@available(*, renamed: "JSONParserIterator") -typealias JSONParserGenerator = JSONParserIterator where Gen.Element == UnicodeScalar - -private enum State { - /// Initial state - case initial - /// Parse an element or the end of the array - case parseArray(first: Bool) - /// Parse a comma or the end of the array - case parseArrayComma - /// Parse an object key or the end of the array - case parseObjectKey(first: Bool) - /// Parse a colon followed by an object value - case parseObjectValue - /// Parse a comma or the end of the object - case parseObjectComma - /// Parse whitespace or EOF - case parseEnd - /// Parsing has completed - case finished -} - -private enum Stack { - case array - case object -} - -/// A streaming JSON parser event. -public enum JSONEvent: Hashable { - /// The start of an object. - /// Inside of an object, each key/value pair is emitted as a - /// `StringValue` for the key followed by the `JSONEvent` sequence - /// that describes the value. - case objectStart - /// The end of an object. - case objectEnd - /// The start of an array. - case arrayStart - /// The end of an array. - case arrayEnd - /// A boolean value. - case booleanValue(Bool) - /// A signed 64-bit integral value. - case int64Value(Int64) - /// A double value. - case doubleValue(Double) - /// A string value. - case stringValue(String) - /// The null value. - case nullValue - /// A parser error. - case error(JSONParserError) - - public var hashValue: Int { - switch self { - case .objectStart: return 1 - case .objectEnd: return 2 - case .arrayStart: return 3 - case .arrayEnd: return 4 - case .booleanValue(let b): return b.hashValue << 4 + 5 - case .int64Value(let i): return i.hashValue << 4 + 6 - case .doubleValue(let d): return d.hashValue << 4 + 7 - case .stringValue(let s): return s.hashValue << 4 + 8 - case .nullValue: return 9 - case .error(let error): return error.hashValue << 4 + 10 - } - } - - public static func ==(lhs: JSONEvent, rhs: JSONEvent) -> Bool { - switch (lhs, rhs) { - case (.objectStart, .objectStart), (.objectEnd, .objectEnd), - (.arrayStart, .arrayStart), (.arrayEnd, .arrayEnd), (.nullValue, .nullValue): - return true - case let (.booleanValue(a), .booleanValue(b)): - return a == b - case let (.int64Value(a), .int64Value(b)): - return a == b - case let (.doubleValue(a), .doubleValue(b)): - return a == b - case let (.stringValue(a), .stringValue(b)): - return a == b - case let (.error(a), .error(b)): - return a == b - default: - return false - } - } -} - -/// An iterator of `JSONEvent`s that records column/line info. -public protocol JSONEventIterator: IteratorProtocol { - /// The line of the last emitted token. - var line: UInt { get } - /// The column of the last emitted token. - var column: UInt { get } -} - -@available(*, renamed: "JSONEventIterator") -public typealias JSONEventGenerator = JSONEventIterator - -public struct JSONParserError: Error, Hashable, CustomStringConvertible { - /// A generic syntax error. - public static let invalidSyntax: Code = .invalidSyntax - /// An invalid number. - public static let invalidNumber: Code = .invalidNumber - /// An invalid string escape. - public static let invalidEscape: Code = .invalidEscape - /// A unicode string escape with an invalid code point. - public static let invalidUnicodeScalar: Code = .invalidUnicodeScalar - /// A unicode string escape representing a leading surrogate without - /// a corresponding trailing surrogate. - public static let loneLeadingSurrogateInUnicodeEscape: Code = .loneLeadingSurrogateInUnicodeEscape - /// A control character in a string. - public static let controlCharacterInString: Code = .controlCharacterInString - /// A comma was found where a colon was expected in an object. - public static let expectedColon: Code = .expectedColon - /// A comma or colon was found in an object without a key. - public static let missingKey: Code = .missingKey - /// An object key was found that was not a string. - public static let nonStringKey: Code = .nonStringKey - /// A comma or object end was encountered where a value was expected. - public static let missingValue: Code = .missingValue - /// A trailing comma was found in an array or object. Only emitted when `strict` mode is enabled. - public static let trailingComma: Code = .trailingComma - /// Trailing (non-whitespace) characters found after the close - /// of the root value. - /// - Note: This error cannot be thrown if the parser is in streaming mode. - public static let trailingCharacters: Code = .trailingCharacters - /// EOF was found before the root value finished parsing. - public static let unexpectedEOF: Code = .unexpectedEOF - - public let code: Code - public let line: UInt - public let column: UInt - - public init(code: Code, line: UInt, column: UInt) { - self.code = code - self.line = line - self.column = column - } - - public var _code: Int { return code.rawValue } - - public enum Code: Int { - /// A generic syntax error. - case invalidSyntax - /// An invalid number. - case invalidNumber - /// An invalid string escape. - case invalidEscape - /// A unicode string escape with an invalid code point. - case invalidUnicodeScalar - /// A unicode string escape representing a leading surrogate without - /// a corresponding trailing surrogate. - case loneLeadingSurrogateInUnicodeEscape - /// A control character in a string. - case controlCharacterInString - /// A comma was found where a colon was expected in an object. - case expectedColon - /// A comma or colon was found in an object without a key. - case missingKey - /// An object key was found that was not a string. - case nonStringKey - /// A comma or object end was encountered where a value was expected. - case missingValue - /// A trailing comma was found in an array or object. Only emitted when `strict` mode is enabled. - case trailingComma - /// Trailing (non-whitespace) characters found after the close - /// of the root value. - /// - Note: This error cannot be thrown if the parser is in streaming mode. - case trailingCharacters - /// EOF was found before the root value finished parsing. - case unexpectedEOF - - public static func ~=(lhs: Code, rhs: Error) -> Bool { - if let error = rhs as? JSONParserError { - return lhs == error.code - } else { - return false - } - } - } - - public var description: String { - return "JSONParserError(\(code), line: \(line), column: \(column))" - } - - public var hashValue: Int { - return Int(bitPattern: line << 18) ^ Int(bitPattern: column << 4) ^ code.rawValue - } - - public static func ==(lhs: JSONParserError, rhs: JSONParserError) -> Bool { - return (lhs.code, lhs.line, lhs.column) == (rhs.code, rhs.line, rhs.column) - } -} - -private struct PeekIterator { - init(_ base: Base) { - self.base = base - } - - mutating func peek() -> Base.Element? { - if let elt = peeked { - return elt - } - let elt = base.next() - peeked = .some(elt) - return elt - } - - mutating func next() -> Base.Element? { - if let elt = peeked { - peeked = nil - return elt - } - return base.next() - } - - private var base: Base - private var peeked: Base.Element?? -} - -private func replace(_ a: inout T, with b: T) -> T { - var b = b - swap(&a, &b) - return b -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/bin/test_PMJSON b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/bin/test_PMJSON deleted file mode 100755 index 1842434db..000000000 Binary files a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/bin/test_PMJSON and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.pbxproj deleted file mode 100644 index df7c6e7f9..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.pbxproj +++ /dev/null @@ -1,296 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 035C82521DC13EED00CDC48D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82511DC13EED00CDC48D /* main.swift */; }; - 035C82611DC13F1B00CDC48D /* Accessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82581DC13F1B00CDC48D /* Accessors.swift */; }; - 035C82621DC13F1B00CDC48D /* DecimalNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82591DC13F1B00CDC48D /* DecimalNumber.swift */; }; - 035C82631DC13F1B00CDC48D /* Decoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825A1DC13F1B00CDC48D /* Decoder.swift */; }; - 035C82641DC13F1B00CDC48D /* Encoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825B1DC13F1B00CDC48D /* Encoder.swift */; }; - 035C82651DC13F1B00CDC48D /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825C1DC13F1B00CDC48D /* JSON.swift */; }; - 035C82661DC13F1B00CDC48D /* JSONError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825D1DC13F1B00CDC48D /* JSONError.swift */; }; - 035C82671DC13F1B00CDC48D /* JSONObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825E1DC13F1B00CDC48D /* JSONObject.swift */; }; - 035C82681DC13F1B00CDC48D /* ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825F1DC13F1B00CDC48D /* ObjectiveC.swift */; }; - 035C82691DC13F1B00CDC48D /* Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82601DC13F1B00CDC48D /* Parser.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 035C824C1DC13EED00CDC48D /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 035C824E1DC13EED00CDC48D /* test_PMJSON */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_PMJSON; sourceTree = BUILT_PRODUCTS_DIR; }; - 035C82511DC13EED00CDC48D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 035C82581DC13F1B00CDC48D /* Accessors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Accessors.swift; sourceTree = ""; }; - 035C82591DC13F1B00CDC48D /* DecimalNumber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecimalNumber.swift; sourceTree = ""; }; - 035C825A1DC13F1B00CDC48D /* Decoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Decoder.swift; sourceTree = ""; }; - 035C825B1DC13F1B00CDC48D /* Encoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Encoder.swift; sourceTree = ""; }; - 035C825C1DC13F1B00CDC48D /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSON.swift; sourceTree = ""; }; - 035C825D1DC13F1B00CDC48D /* JSONError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONError.swift; sourceTree = ""; }; - 035C825E1DC13F1B00CDC48D /* JSONObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONObject.swift; sourceTree = ""; }; - 035C825F1DC13F1B00CDC48D /* ObjectiveC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectiveC.swift; sourceTree = ""; }; - 035C82601DC13F1B00CDC48D /* Parser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Parser.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 035C824B1DC13EED00CDC48D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 035C82451DC13EED00CDC48D = { - isa = PBXGroup; - children = ( - 035C82581DC13F1B00CDC48D /* Accessors.swift */, - 035C82591DC13F1B00CDC48D /* DecimalNumber.swift */, - 035C825A1DC13F1B00CDC48D /* Decoder.swift */, - 035C825B1DC13F1B00CDC48D /* Encoder.swift */, - 035C825C1DC13F1B00CDC48D /* JSON.swift */, - 035C825D1DC13F1B00CDC48D /* JSONError.swift */, - 035C825E1DC13F1B00CDC48D /* JSONObject.swift */, - 035C825F1DC13F1B00CDC48D /* ObjectiveC.swift */, - 035C82601DC13F1B00CDC48D /* Parser.swift */, - 035C82501DC13EED00CDC48D /* test_PMJSON */, - 035C824F1DC13EED00CDC48D /* Products */, - ); - sourceTree = ""; - }; - 035C824F1DC13EED00CDC48D /* Products */ = { - isa = PBXGroup; - children = ( - 035C824E1DC13EED00CDC48D /* test_PMJSON */, - ); - name = Products; - sourceTree = ""; - }; - 035C82501DC13EED00CDC48D /* test_PMJSON */ = { - isa = PBXGroup; - children = ( - 035C82511DC13EED00CDC48D /* main.swift */, - ); - path = test_PMJSON; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 035C824D1DC13EED00CDC48D /* test_PMJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = 035C82551DC13EED00CDC48D /* Build configuration list for PBXNativeTarget "test_PMJSON" */; - buildPhases = ( - 035C824A1DC13EED00CDC48D /* Sources */, - 035C824B1DC13EED00CDC48D /* Frameworks */, - 035C824C1DC13EED00CDC48D /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_PMJSON; - productName = test_PMJSON; - productReference = 035C824E1DC13EED00CDC48D /* test_PMJSON */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 035C82461DC13EED00CDC48D /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 035C824D1DC13EED00CDC48D = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 035C82491DC13EED00CDC48D /* Build configuration list for PBXProject "test_PMJSON" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 035C82451DC13EED00CDC48D; - productRefGroup = 035C824F1DC13EED00CDC48D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 035C824D1DC13EED00CDC48D /* test_PMJSON */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 035C824A1DC13EED00CDC48D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 035C82611DC13F1B00CDC48D /* Accessors.swift in Sources */, - 035C82661DC13F1B00CDC48D /* JSONError.swift in Sources */, - 035C82691DC13F1B00CDC48D /* Parser.swift in Sources */, - 035C82521DC13EED00CDC48D /* main.swift in Sources */, - 035C82641DC13F1B00CDC48D /* Encoder.swift in Sources */, - 035C82671DC13F1B00CDC48D /* JSONObject.swift in Sources */, - 035C82651DC13F1B00CDC48D /* JSON.swift in Sources */, - 035C82631DC13F1B00CDC48D /* Decoder.swift in Sources */, - 035C82621DC13F1B00CDC48D /* DecimalNumber.swift in Sources */, - 035C82681DC13F1B00CDC48D /* ObjectiveC.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 035C82531DC13EED00CDC48D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 035C82541DC13EED00CDC48D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 035C82561DC13EED00CDC48D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 035C82571DC13EED00CDC48D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 035C82491DC13EED00CDC48D /* Build configuration list for PBXProject "test_PMJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035C82531DC13EED00CDC48D /* Debug */, - 035C82541DC13EED00CDC48D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 035C82551DC13EED00CDC48D /* Build configuration list for PBXNativeTarget "test_PMJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035C82561DC13EED00CDC48D /* Debug */, - 035C82571DC13EED00CDC48D /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 035C82461DC13EED00CDC48D /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index a539b94c6..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index aeb912832..000000000 Binary files a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_PMJSON.xcscheme b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_PMJSON.xcscheme deleted file mode 100644 index f7dc9e855..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_PMJSON.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 650243533..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_PMJSON.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 035C824D1DC13EED00CDC48D - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON/main.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON/main.swift deleted file mode 100644 index 7d3b201f5..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_1_0/test_PMJSON/main.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// main.swift -// test_PMJSON -// -// Created by nst on 26.10.16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard ProcessInfo.processInfo.arguments.count == 2 else { - let url = URL(fileURLWithPath: ProcessInfo.processInfo.arguments[0]) - let programName = url.lastPathComponent - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = ProcessInfo.processInfo.arguments[1] - let url = NSURL.fileURL(withPath:path) - - do { - let data = try Data(contentsOf:url) - - - do { - let json = try JSON.decode(data, strict:true) - - guard json != nil else { - exit(1) - } - - exit(0) - } catch let e { - print(e) - exit(1) - } - } catch let e { - print("*** CANNOT READ DATA AT \(url)") - print(e) - exit(1) - } -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Accessors.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Accessors.swift deleted file mode 100755 index 215d94fd1..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Accessors.swift +++ /dev/null @@ -1,255 +0,0 @@ -// -// Accessors.swift -// PMJSON -// -// Created by Kevin Ballard on 10/9/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -public extension JSON { - /// Returns `true` iff the receiver is `.null`. - var isNull: Bool { - switch self { - case .null: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.bool`. - var isBool: Bool { - switch self { - case .bool: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.string`. - var isString: Bool { - switch self { - case .string: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.int64`. - var isInt64: Bool { - switch self { - case .int64: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.double`. - var isDouble: Bool { - switch self { - case .double: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.int64` or `.double`. - var isNumber: Bool { - switch self { - case .int64, .double: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.object`. - var isObject: Bool { - switch self { - case .object: return true - default: return false - } - } - - /// Returns `true` iff the receiver is `.array`. - var isArray: Bool { - switch self { - case .array: return true - default: return false - } - } -} - -public extension JSON { - /// Returns the boolean value if the receiver is `.bool`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given boolean value, or with - /// null if the value is `nil`. - var bool: Bool? { - get { - switch self { - case .bool(let b): return b - default: return nil - } - } - set { - self = newValue.map(JSON.bool) ?? nil - } - } - - /// Returns the string value if the receiver is `.string`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given string value, or with - /// null if the value is `nil`. - var string: String? { - get { - switch self { - case .string(let s): return s - default: return nil - } - } - set { - self = newValue.map(JSON.string) ?? nil - } - } - - /// Returns the 64-bit integral value if the receiver is `.int64` or `.double`, otherwise `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in 64 bits, `nil` is returned. - /// - /// When setting, replaces the receiver with the given integral value, or with - /// null if the value is `nil`. - var int64: Int64? { - get { - switch self { - case .int64(let i): return i - case .double(let d): return convertDoubleToInt64(d) - default: return nil - } - } set { - self = newValue.map(JSON.int64) ?? nil - } - } - - /// Returns the integral value if the receiver is `.int64` or `.double`, otherwise `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in an `Int`, `nil` is returned. - /// If the receiver is `.int64` and the value does not fit in an `Int`, `nil` is returned. - /// - /// When setting, replaces the receiver with the given integral value, or with - /// null if the value is `nil`. - var int: Int? { - get { - guard let value = self.int64 else { return nil} - let truncated = Int(truncatingBitPattern: value) - guard Int64(truncated) == value else { return nil } - return truncated - } - set { - self = newValue.map({ JSON.int64(Int64($0)) }) ?? nil - } - } - - /// Returns the numeric value as a `Double` if the receiver is `.int64` or `.double`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given double value, or with - /// null if the value is `nil`. - var double: Double? { - get { - switch self { - case .int64(let i): return Double(i) - case .double(let d): return d - default: return nil - } - } - set { - self = newValue.map(JSON.double) ?? nil - } - } - - /// Returns the object dictionary if the receiver is `.object`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given object value, or with - /// null if the value is `nil`. - var object: JSONObject? { - get { - switch self { - case .object(let obj): return obj - default: return nil - } - } - set { - self = newValue.map(JSON.object) ?? nil - } - } - - /// Returns the array if the receiver is `.array`, otherwise `nil`. - /// - /// When setting, replaces the receiver with the given array value, or with - /// null if the value is `nil`. - var array: JSONArray? { - get { - switch self { - case .array(let ary): return ary - default: return nil - } - } - set { - self = newValue.map(JSON.array) ?? nil - } - } -} - -public extension JSON { - /// Returns the string value if the receiver is `.string`, coerces the value to a string if - /// the receiver is `.bool`, `.null`, `.int64`, or `.double`, or otherwise returns `nil`. - var asString: String? { - return try? toString() - } - - /// Returns the 64-bit integral value if the receiver is `.int64` or `.double`, coerces the value - /// if the receiver is `.string`, otherwise returns `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in 64 bits, `nil` is returned. - /// If the receiver is `.string`, it must parse fully as an integral or floating-point number. - /// If it parses as a floating-point number, it is truncated. If it does not fit in 64 bits, `nil` is returned. - var asInt64: Int64? { - return try? toInt64() - } - - /// Returns the integral value if the receiver is `.int64` or `.double`, coerces the value - /// if the receiver is `.string`, otherwise returns `nil`. - /// If the receiver is `.double`, the value is truncated. If it does not fit in an `Int`, `nil` is returned. - /// If the receiver is `.string`, it must parse fully as an integral or floating-point number. - /// If it parses as a floating-point number, it is truncated. If it does not fit in an `Int`, `nil` is returned. - var asInt: Int? { - return try? toInt() - } - - /// Returns the double value if the receiver is `.int64` or `.double`, coerces the value - /// if the receiver is `.string`, otherwise returns `nil`. - /// If the receiver is `.string`, it must parse fully as a floating-point number. - var asDouble: Double? { - return try? toDouble() - } -} - -public extension JSON { - /// If the receiver is `.object`, returns the result of subscripting the object. - /// Otherwise, returns `nil`. - subscript(key: String) -> JSON? { - return self.object?[key] - } - - /// If the receiver is `.array` and the index is in range of the array, returns the result of subscripting the array. - /// Otherwise returns `nil`. - subscript(index: Int) -> JSON? { - guard let ary = self.array else { return nil } - guard index >= ary.startIndex && index < ary.endIndex else { return nil } - return ary[index] - } -} - -internal func convertDoubleToInt64(_ d: Double) -> Int64? { - // Int64(Double(Int64.max)) asserts because it interprets it as out of bounds. - // Int64(Double(Int64.min)) works just fine. - if d >= Double(Int64.max) || d < Double(Int64.min) { - return nil - } - return Int64(d) -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/DecimalNumber.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/DecimalNumber.swift deleted file mode 100755 index b07666ae9..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/DecimalNumber.swift +++ /dev/null @@ -1,236 +0,0 @@ -// -// DecimalNumber.swift -// PMJSON -// -// Created by Kevin Ballard on 2/8/16. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -#if os(iOS) || os(OSX) || os(tvOS) || os(watchOS) - - import Foundation - - // MARK: Basic accessors - - public extension JSON { - /// Returns the receiver as an `NSDecimalNumber` if possible. - /// - Returns: An `NSDecimalNumber` if the receiver is `.int64` or `.double`, or is a `.string` - /// that contains a valid decimal number representation, otherwise `nil`. - /// - Note: Whitespace is not allowed in the string representation. - var asDecimalNumber: NSDecimalNumber? { - switch self { - case .int64(let i): return NSDecimalNumber(value: i) - case .double(let d): return NSDecimalNumber(value: d) - case .string(let s) where !s.isEmpty: - // NSDecimalNumber(string:) doesn't tell us if the number was valid. - // We could check for NaN, but that still doesn't tell us if there's anything left in the string. - // I'm pretty sure it uses NSScanner.scanDecimal() internally, so we'll just use that instead. - let scanner = Scanner(string: s) - scanner.charactersToBeSkipped = nil - var decimal = Decimal() - if scanner.scanDecimal(&decimal) && scanner.isAtEnd { - return NSDecimalNumber(decimal: decimal) - } - return nil - default: return nil - } - } - - /// Returns the receiver as an `NSDecimalNumber` if it is `.int64` or `.double`. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the receiver is not an `.int64` or a `.double`. - func getDecimalNumber() throws -> NSDecimalNumber { - switch self { - case .int64(let i): return NSDecimalNumber(value: i) - case .double(let d): return NSDecimalNumber(value: d) - default: throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) - } - } - - /// Returns the receiver as an `NSDecimalNumber` if it is `.int64` or `.double`. - /// - Returns: An `NSDecimalNumber`, or `nil` if the receivre is `null`. - /// - Throws: `JSONError` if the receiver is not an `.int64` or a `.double`. - func getDecimalNumberOrNil() throws -> NSDecimalNumber? { - switch self { - case .int64(let i): return NSDecimalNumber(value: i) - case .double(let d): return NSDecimalNumber(value: d) - case .null: return nil - default: throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) - } - } - - /// Returns the receiver as an `NSDecimalNumber` if possible. - /// - Returns: An `NSDecimalNumber` if the receiver is `.int64` or `.double`, or is a `.string` - /// that contains a valid decimal number representation. - /// - Throws: `JSONError` if the receiver is the wrong type, or is a `.string` that does not contain - /// a valid decimal number representation. - /// - Note: Whitespace is not allowed in the string representation. - func toDecimalNumber() throws -> NSDecimalNumber { - guard let value = asDecimalNumber else { - throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) - } - return value - } - - /// Returns the receiver as an `NSDecimalNumber` if possible. - /// - Returns: An `NSDecimalNumber` if the receiver is `.int64` or `.double`, or is a `.string` - /// that contains a valid decimal number representation, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type, or is a `.string` that does not contain - /// a valid decimal number representation. - /// - Note: Whitespace is not allowed in the string representation. - func toDecimalNumberOrNil() throws -> NSDecimalNumber? { - if let value = asDecimalNumber { return value } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - } - - // MARK: - Keyed accessors - - public extension JSON { - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is the wrong type, or if the receiver is - /// not an object. - func getDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getDecimalNumberOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, or a string that cannot be coerced to a decimal number, or if the - /// receiver is not an object. - func toDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a decimal number, or if the receiver is not an object. - func toDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toDecimalNumberOrNil() } - } - } - - // MARK: - Indexed accessors - - public extension JSON { - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, or if - /// the receiver is not an array. - func getDecimalNumber(_ index: Int) throws -> NSDecimalNumber { - let array = try getArray() - let value = try getRequired(array, index: index, type: .number) - return try scoped(index) { try value.getDecimalNumber() } - } - - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is the wrong type, or if the receiver is not an array. - func getDecimalNumberOrNil(_ index: Int) throws -> NSDecimalNumber? { - let array = try getArray() - guard let value = array[safe: index] else { return nil } - return try scoped(index) { try value.getDecimalNumberOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a decimal number, or - /// if the receiver is not an array. - func toDecimalNumber(_ index: Int) throws -> NSDecimalNumber { - let array = try getArray() - let value = try getRequired(array, index: index, type: .number) - return try scoped(index) { try value.toDecimalNumber() } - } - - /// Subscripts the receiver with `index` and returns the result as an `NSDecimalNumber`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a decimal number, or if the receiver is not an array. - func toDecimalNumberOrNil(_ index: Int) throws -> NSDecimalNumber? { - let array = try getArray() - guard let value = array[safe: index] else { return nil } - return try scoped(index) { try value.toDecimalNumberOrNil() } - } - } - - // MARK: - - - public extension JSONObject { - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is the wrong type, or if the receiver is - /// not an object. - func getDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getDecimalNumberOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, or a string that cannot be coerced to a decimal number, or if the - /// receiver is not an object. - func toDecimalNumber(_ key: String) throws -> NSDecimalNumber { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toDecimalNumber() } - } - - /// Subscripts the receiver with `key` and returns the result as an `NSDecimalNumber`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `NSDecimalNumber`, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a decimal number, or if the receiver is not an object. - func toDecimalNumberOrNil(_ key: String) throws -> NSDecimalNumber? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toDecimalNumberOrNil() } - } - } - -#endif // os(iOS) || os(OSX) || os(tvOS) || os(watchOS) diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Decoder.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Decoder.swift deleted file mode 100755 index 14c9ae7f0..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Decoder.swift +++ /dev/null @@ -1,502 +0,0 @@ -// -// Decoder.swift -// PMJSON -// -// Created by Kevin Ballard on 10/8/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -extension JSON { - /// Decodes a string as JSON. - /// - Parameter string: A string to parse as JSON. - /// - Parameter options: Options that controls JSON parsing. Defaults to no options. See `JSONOptions` for details. - /// - Returns: A `JSON` value. - /// - Throws: `JSONParserError` - public static func decode(_ string: String, options: JSONOptions = []) throws -> JSON { - return try decode(string.unicodeScalars, options: options) - } - - @available(*, deprecated, message: "Use JSON.decode(_:options:) instead") - public static func decode(_ string: String, strict: Bool) throws -> JSON { - return try decode(string, options: JSONOptions(strict: strict)) - } - - /// Decodes a sequence of `UnicodeScalar`s as JSON. - /// - Parameter scalars: A sequence of `UnicodeScalar`s to parse as JSON. - /// - Parameter options: Options that controls JSON parsing. Defaults to no options. See `JSONOptions` for details. - /// - Returns: A `JSON` value. - /// - Throws: `JSONParserError` - public static func decode(_ scalars: Seq, options: JSONOptions = []) throws -> JSON where Seq.Iterator.Element == UnicodeScalar { - let parser = JSONParser(scalars, options: options.parserOptions) - var decoder = JSONDecoder(parser, options: options.decoderOptions) - return try decoder.decode() - } - - @available(*, deprecated, message: "Use JSON.decode(_:options:) instead") - public static func decode(_ scalars: Seq, strict: Bool) throws -> JSON where Seq.Iterator.Element == UnicodeScalar { - return try decode(scalars, options: JSONOptions(strict: strict)) - } - - /// Lazily decodes a string as a JSON stream. - /// - /// A JSON stream is a series of top-level JSON values. See `JSONStreamDecoder` for details. - /// - /// - Parameter string: A string to parse as a JSON stream. - /// - Parameter options: Options that controls JSON parsing. Defaults to no options. See `JSONOptions` for details. - /// - Returns: A `JSONStreamDecoder`. - public static func decodeStream(_ string: String, options: JSONOptions = []) -> JSONStreamDecoder> { - return decodeStream(string.unicodeScalars, options: options) - } - - @available(*, deprecated, message: "Use JSON.decodeStream(_:options:) instead") - public static func decodeStream(_ string: String, strict: Bool) -> JSONStreamDecoder> { - return decodeStream(string, options: JSONOptions(strict: strict)) - } - - /// Lazily decodes a sequence of `UnicodeScalar`s as a JSON stream. - /// - /// A JSON stream is a series of top-level JSON values. See `JSONStreamDecoder` for details. - /// - /// - Parameter scalars: A sequence of `UnicodeScalar`s to parse as a JSON stream. - /// - Parameter options: Options that controls JSON parsing. Defaults to no options. See `JSONOptions` for details. - /// - Returns: A `JSONStreamDecoder`. - public static func decodeStream(_ scalars: Seq, options: JSONOptions = []) -> JSONStreamDecoder> where Seq.Iterator.Element == UnicodeScalar { - var parserOptions = options.parserOptions - parserOptions.streaming = true - let parser = JSONParser(scalars, options: parserOptions) - return JSONStreamDecoder(parser) - } - - @available(*, deprecated, message: "Use JSON.decodeStream(_:options:) instead") - public static func decodeStream(_ scalars: Seq, strict: Bool) -> JSONStreamDecoder> where Seq.Iterator.Element == UnicodeScalar { - return decodeStream(scalars, options: JSONOptions(strict: strict)) - } -} - -/// Options that can be used with `JSON.decode(…)`. -public struct JSONOptions { - /// If `true`, the parser strictly conforms to RFC 7159. - /// If `false`, the parser accepts the following extensions: - /// - Trailing commas. - /// - Less restrictive about numbers, such as `-01` or `-.123`. - /// - /// The default value is `false`. - public var strict: Bool = false - - /// A maximum depth limit to apply to nested arrays/dictionaries. - /// If `nil`, there is no depth limit. - /// - /// The default value is `10_000`. - public var depthLimit: Int? = 10_000 - - /// Returns a new `JSONOptions` with default values. - public init() {} - - /// Returns a new `JSONOptions`. - /// - Parameter strict: Whether the parser should be strict. Defaults to `false`. - /// - Parameter depthLimit: A maximum depth limit to use. Default is `10_000`. - public init(strict: Bool = false, depthLimit: Int? = 10_000) { - self.strict = strict - self.depthLimit = depthLimit - } - - public var decoderOptions: JSONDecoderOptions { - return JSONDecoderOptions(depthLimit: depthLimit) - } - - public var streamDecoderOptions: JSONStreamDecoderOptions { - return JSONStreamDecoderOptions(depthLimit: depthLimit) - } - - public var parserOptions: JSONParserOptions { - return JSONParserOptions(strict: strict) - } -} - -extension JSONOptions: ExpressibleByArrayLiteral { - public enum Element { - /// Makes the parser strictly conform to RFC 7159. - /// - SeeAlso: `JSONOptions.strict`. - case strict - /// Sets a maximum depth limit for nested arrays/dictionaries. - /// If specified multiple times, the last specified limit is used. - /// Specifying `nil` removes the default depth limit of `10_000`. - /// - SeeAlso: `JSONOptions.depthLimit`. - case depthLimit(Int?) - } - - public init(arrayLiteral elements: Element...) { - for elt in elements { - switch elt { - case .strict: strict = true - case .depthLimit(let limit): - depthLimit = limit - } - } - } -} - -/// A JSON decoder that consumes a stream of JSON events. -/// -/// In most cases, you should use the convenience method `JSON.decode(_:)` to decode values -/// instead of using this class directly. -/// -/// - SeeAlso: `JSONParser`. -public struct JSONDecoder where Seq.Iterator: JSONEventIterator, Seq.Iterator.Element == JSONEvent { - public init(_ parser: Seq, options: JSONDecoderOptions = []) { - iter = parser.makeIterator() - self.options = options - } - - /// Options to apply to the decoder. - /// See `JSONDecoderOptions` for details. - var options: JSONDecoderOptions - - @available(*, deprecated, renamed: "options.streaming") - public var streaming: Bool { - get { return options.streaming } - set { options.streaming = newValue } - } - - /// Decodes and returns a top-level JSON value from the event stream. - /// - /// When `streaming` is `false`, any events after the top-level value has been consumed - /// will throw an error, and any subsequent calls to `decode()` after the first call - /// will also throw an error. When `streaming` is `false`, after a top-level value has - /// been decoded, no more events will be consumed, and `decode()` can be called repeatedly - /// to decode more top-level events. - /// - /// Because the normal operation of this class is to decode one-shot values rather than - /// streams, this method returns a non-optional value. As such, when operating in a - /// streaming manner, this method will throw the special error `JSONDecoderError.streamEnded` - /// to signal that there are no more values. To make this easier to work with, a convenience - /// method `decodeStream()` is provided that returns an array of `JSON` values and automatically - /// handles `JSONDecoderError.streamEnded`, and the type `JSONStreamDecoder` provides a - /// lazy sequence interface to decoding a JSON stream. - /// - /// - Returns: A single top-level `JSON` value. - /// - /// - Throws: `JSONParserError`, `JSONDecoderError`. - public mutating func decode() throws -> JSON { - bump() - if options.streaming && token == nil { - throw JSONDecoderError.streamEnded - } - let result = try buildValue(depth: 0) - if !options.streaming { - bump() - switch token { - case .none: break - case .some(.error(let err)): throw err - case .some: throw JSONDecoderError.unexpectedToken - } - } - return result - } - - /// Decodes and returns an array of top-level JSON values from the event stream. - /// - /// This is a convenience method that sets `streaming` to `true` and then decodes - /// as many top-level JSON values as it can before the stream ends. - /// - /// - Returns: An array of top-level `JSON` values. - /// - /// - SeeAlso: `JSONStreamDecoder`. - public mutating func decodeStream() throws -> [JSON] { - options.streaming = true - var results: [JSON] = [] - repeat { - do { - results.append(try decode()) - } catch JSONDecoderError.streamEnded { - return results - } - } while true - } - - private mutating func bump() { - token = iter.next() - } - - private mutating func buildValue(depth: Int) throws -> JSON { - switch token { - case .objectStart?: - let newDepth = depth + 1 - if let limit = options.depthLimit, newDepth > limit { - throw JSONDecoderError.exceededDepthLimit - } - return try buildObject(depth: newDepth) - case .objectEnd?: throw error(.invalidSyntax) - case .arrayStart?: - let newDepth = depth + 1 - if let limit = options.depthLimit, newDepth > limit { - throw JSONDecoderError.exceededDepthLimit - } - return try buildArray(depth: newDepth) - case .arrayEnd?: throw error(.invalidSyntax) - case .booleanValue(let b)?: return .bool(b) - case .int64Value(let i)?: return .int64(i) - case .doubleValue(let d)?: return .double(d) - case .stringValue(let s)?: return .string(s) - case .nullValue?: return .null - case .error(let err)?: throw err - case nil: throw error(.unexpectedEOF) - } - } - - private mutating func buildObject(depth: Int) throws -> JSON { - bump() - var dict: [String: JSON] = Dictionary(minimumCapacity: objectHighWaterMark) - defer { objectHighWaterMark = max(objectHighWaterMark, dict.count) } - while let token = self.token { - let key: String - switch token { - case .objectEnd: return .object(JSONObject(dict)) - case .error(let err): throw err - case .stringValue(let s): key = s - default: throw error(.nonStringKey) - } - bump() - dict[key] = try buildValue(depth: depth) - bump() - } - throw error(.unexpectedEOF) - } - - private mutating func buildArray(depth: Int) throws -> JSON { - bump() - var ary: JSONArray = [] - while let token = self.token { - if case .arrayEnd = token { - return .array(ary) - } - ary.append(try buildValue(depth: depth)) - bump() - } - throw error(.unexpectedEOF) - } - - private func error(_ code: JSONParserError.Code) -> JSONParserError { - return JSONParserError(code: code, line: iter.line, column: iter.column) - } - - private var iter: Seq.Iterator - private var token: JSONEvent? - private var objectHighWaterMark: Int = 0 -} - -/// Options that can be used with `JSONDecoder`. -public struct JSONDecoderOptions { - /// A maximum depth limit to apply to nested arrays/dictionaries. - /// If `nil`, there is no depth limit. - /// - /// The default value is `10_000`. - public var depthLimit: Int? = 10_000 - - /// If `true`, the decoder will operate in streaming mode, allowing for multiple - /// top-level json values, with each call to `decode()` returning a successive value. - /// The default value of `false` means that `decode()` can only be called once, and - /// any JSON events past the first top-level value are considered an error. - /// - /// See `JSONDecoder.decode()` for more details on the streaming operation. - /// - /// The default value is `false`. - /// - /// - Important: When wrapping a `JSONParser`, the parser must separately be put into - /// streaming mode, as `JSONDecoder` operates generically over a sequence of `JSONEvent`s. - public var streaming: Bool = false - - /// Returns a new `JSONDecoderOptions` with default values. - public init() {} - - /// Returns a new `JSONDecoderOptions`. - /// - Parameter depthLimit: A maximum depth limit to use. Default is `10_000`. - /// - Parameter streaming: Whether the decode should operate in streaming mode. Default is `false`. - public init(depthLimit: Int? = 10_000, streaming: Bool = false) { - self.depthLimit = depthLimit - self.streaming = streaming - } -} - -extension JSONDecoderOptions: ExpressibleByArrayLiteral { - public enum Element { - /// Sets a maximum depth limit for nested arrays/dictionaries. - /// If specified multiple times, the last specified limit is used. - /// Specifying `nil` removes the default depth limit of `10_000`. - /// - SeeAlso: `JSONDecoderOptions.depthLimit`. - case depthLimit(Int?) - /// Puts the decoder into streaming mode. - /// - SeeAlso: `JSONDecoderOptions.streaming`. - case streaming - } - - public init(arrayLiteral elements: Element...) { - for elt in elements { - switch elt { - case .depthLimit(let limit): - depthLimit = limit - case .streaming: - streaming = true - } - } - } -} - -/// Errors that may be thrown by the `JSONDecoder` during the decode stage. -public enum JSONDecoderError: Error { - /// Signals that a `JSONDecoder` operating in streaming mode has reached the end of the stream. - case streamEnded - /// Thrown when a `JSONDecoder` operating in one-shot mode finds extra tokens after the first top-level JSON value. - case unexpectedToken - /// Thrown when a `JSONDecoder` exceeds the specified depth limit. - case exceededDepthLimit -} - -/// A JSON decoder that decodes a stream of JSON events into a lazy sequence of top-level JSON values. -/// -/// This is a sequence of zero or more `JSONStreamValue.json` values, ending with zero or one `JSONStreamValue.error` value. -/// -/// - Important: When wrapping a `JSONParser`, the parser must separately be put into streaming mode, as `JSONStreamDecoder` -/// operates generically over a sequence of `JSONEvent`s. You should consider using `JSON.decodeStream(_:)` instead to -/// create the stream decoder. -/// -/// - SeeAlso: `JSON.decodeStream(_:)`. -public struct JSONStreamDecoder: Sequence, IteratorProtocol where Seq.Iterator: JSONEventIterator, Seq.Iterator.Element == JSONEvent { - public init(_ parser: Seq, options: JSONStreamDecoderOptions = []) { - decoder = JSONDecoder(parser, options: options.decoderOptions) - } - - /// Options to apply to the decoder. - /// See `JSONStreamDecoderOptions` for details. - public var options: JSONStreamDecoderOptions { - get { return decoder.options.streamDecoderOptions } - set { decoder.options.update(with: newValue) } - } - - /// Returns an array of all decoded values, or throws an error if one occurs. - /// - /// This eagerly decodes the rest of the JSON stream and returns all values. If a parse error occurs at any point, - /// the error is thrown and all values are discarded. - /// - /// - Returns: An array of `JSON` values. - /// - Throws: `JSONParserError`. - public func values() throws -> [JSON] { - return try map({ try $0.unwrap() }) - } - - public func makeIterator() -> JSONStreamDecoder { - return self - } - - public mutating func next() -> JSONStreamValue? { - do { - return try JSONStreamValue.json(decoder.decode()) - } catch JSONDecoderError.streamEnded { - return nil - } catch let error as JSONParserError { - return JSONStreamValue.error(error) - } catch { - // This shouldn't be reachable. A `JSONDecoder` operating in streaming mode can throw only - // `JSONParserError`s or `JSONDecoderError.streamEnded`. - return nil - } - } - - private var decoder: JSONDecoder -} - -/// Options that can be used with `JSONStreamDecoder`. -public struct JSONStreamDecoderOptions { - /// A maximum depth limit to apply to nested arrays/dictionaries. - /// If `nil`, there is no depth limit. - /// - /// The default value is `10_000`. - public var depthLimit: Int? = 10_000 - - /// Returns a new `JSONStreamDecoderOptions` with default values. - public init() {} - - /// Returns a new `JSONStreamDecoderOptions`. - /// - Parameter depthLimit: A maximum depth limit to use. Default is `10_000`. - public init(depthLimit: Int? = 10_000) { - self.depthLimit = depthLimit - } - - fileprivate var decoderOptions: JSONDecoderOptions { - return JSONDecoderOptions(depthLimit: depthLimit, streaming: true) - } -} - -private extension JSONDecoderOptions { - var streamDecoderOptions: JSONStreamDecoderOptions { - return JSONStreamDecoderOptions(depthLimit: depthLimit) - } - - mutating func update(with options: JSONStreamDecoderOptions) { - depthLimit = options.depthLimit - } -} - -extension JSONStreamDecoderOptions: ExpressibleByArrayLiteral { - public enum Element { - /// Sets a maximum depth limit for nested arrays/dictionaries. - /// If specified multiple times, the last specified limit is used. - /// Specifying `nil` removes the default depth limit of `10_000`. - /// - SeeAlso: `JSONStreamDecoderOptions.depthLimit`. - case depthLimit(Int?) - } - - public init(arrayLiteral elements: Element...) { - for elt in elements { - switch elt { - case .depthLimit(let limit): - depthLimit = limit - } - } - } -} - -public enum JSONStreamValue: Equatable { - case json(JSON) - case error(JSONParserError) - - /// Returns the contained `JSON` value, otherwise `nil`. - public var json: JSON? { - switch self { - case .json(let json): return json - case .error: return nil - } - } - - /// Returns the contained error, otherwise `nil`. - public var error: JSONParserError? { - switch self { - case .json: return nil - case .error(let error): return error - } - } - - /// Unwraps the contained `JSON` value or throws the contained error. - /// - /// - Throws: `JSONParserError`. - public func unwrap() throws -> JSON { - switch self { - case .json(let value): return value - case .error(let error): throw error - } - } - - public static func ==(lhs: JSONStreamValue, rhs: JSONStreamValue) -> Bool { - switch (lhs, rhs) { - case let (.json(a), .json(b)): return a == b - case let (.error(a), .error(b)): return a == b - default: return false - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Encoder.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Encoder.swift deleted file mode 100755 index 0c83165d4..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Encoder.swift +++ /dev/null @@ -1,215 +0,0 @@ -// -// Encoder.swift -// PMJSON -// -// Created by Kevin Ballard on 2/1/16. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -extension JSON { - /// Encodes a `JSON` to a `String`. - /// - Parameter json: The `JSON` to encode. - /// - Parameters options: Options that controls JSON encoding. Defaults to no options. See `JSONEncoderOptions` for details. - /// - Returns: A `String` with the JSON representation of *json*. - public static func encodeAsString(_ json: JSON, options: JSONEncoderOptions = []) -> String { - var s = "" - encode(json, to: &s, options: options) - return s - } - - @available(*, deprecated, message: "Use JSON.encodeAsString(_:options:) instead") - public static func encodeAsString(_ json: JSON, pretty: Bool) -> String { - return encodeAsString(json, options: JSONEncoderOptions(pretty: pretty)) - } - - /// Encodes a `JSON` to an output stream. - /// - Parameter json: The `JSON` to encode. - /// - Parameter stream: The output stream to write the encoded JSON to. - /// - Parameters options: Options that controls JSON encoding. Defaults to no options. See `JSONEncoderOptions` for details. - public static func encode(_ json: JSON, to stream: inout Target, options: JSONEncoderOptions = []) { - encode(json, to: &stream, indent: options.pretty ? 0 : nil) - } - - @available(*, deprecated, message: "Use JSON.encode(_:to:options:) instead") - public static func encode(_ json: JSON, to stream: inout Target, pretty: Bool) { - encode(json, to: &stream, options: JSONEncoderOptions(pretty: pretty)) - } - - @available(*, deprecated, renamed: "encode(_:to:pretty:)") - public static func encode(_ json: JSON, toStream stream: inout Target, pretty: Bool) { - encode(json, to: &stream, options: JSONEncoderOptions(pretty: pretty)) - } - - private static func encode(_ json: JSON, to stream: inout Target, indent: Int?) { - switch json { - case .null: encodeNull(&stream) - case .bool(let b): encodeBool(b, toStream: &stream) - case .int64(let i): encodeInt64(i, toStream: &stream) - case .double(let d): encodeDouble(d, toStream: &stream) - case .string(let s): encodeString(s, toStream: &stream) - case .object(let obj): encodeObject(obj, toStream: &stream, indent: indent) - case .array(let ary): encodeArray(ary, toStream: &stream, indent: indent) - } - } - - private static func encodeNull(_ stream: inout Target) { - stream.write("null") - } - - private static func encodeBool(_ value: Bool, toStream stream: inout Target) { - stream.write(value ? "true" : "false") - } - - private static func encodeInt64(_ value: Int64, toStream stream: inout Target) { - stream.write(String(value)) - } - - private static func encodeDouble(_ value: Double, toStream stream: inout Target) { - stream.write(String(value)) - } - - private static func encodeString(_ value: String, toStream stream: inout Target) { - stream.write("\"") - let scalars = value.unicodeScalars - var start = scalars.startIndex - let end = scalars.endIndex - var idx = start - while idx < scalars.endIndex { - let s: String - let c = scalars[idx] - switch c { - case "\\": s = "\\\\" - case "\"": s = "\\\"" - case "\n": s = "\\n" - case "\r": s = "\\r" - case "\t": s = "\\t" - case "\u{8}": s = "\\b" - case "\u{C}": s = "\\f" - case "\0"..<"\u{10}": - s = "\\u000\(String(c.value, radix: 16, uppercase: true))" - case "\u{10}"..<" ": - s = "\\u00\(String(c.value, radix: 16, uppercase: true))" - default: - idx = scalars.index(after: idx) - continue - } - if idx != start { - stream.write(String(scalars[start..(_ object: JSONObject, toStream stream: inout Target, indent: Int?) { - let indented = indent.map({$0+1}) - if let indent = indented { - stream.write("{\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write("{") - } - var first = true - for (key, value) in object { - if first { - first = false - } else if let indent = indented { - stream.write(",\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write(",") - } - encodeString(key, toStream: &stream) - stream.write(indented != nil ? ": " : ":") - encode(value, to: &stream, indent: indented) - } - if let indent = indent { - stream.write("\n") - writeIndent(indent, toStream: &stream) - } - stream.write("}") - } - - private static func encodeArray(_ array: JSONArray, toStream stream: inout Target, indent: Int?) { - let indented = indent.map({$0+1}) - if let indent = indented { - stream.write("[\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write("[") - } - var first = true - for elt in array { - if first { - first = false - } else if let indent = indented { - stream.write(",\n") - writeIndent(indent, toStream: &stream) - } else { - stream.write(",") - } - encode(elt, to: &stream, indent: indented) - } - if let indent = indent { - stream.write("\n") - writeIndent(indent, toStream: &stream) - } - stream.write("]") - } - - private static func writeIndent(_ indent: Int, toStream stream: inout Target) { - for _ in stride(from: 4, through: indent, by: 4) { - stream.write(" ") - } - switch indent % 4 { - case 1: stream.write(" ") - case 2: stream.write(" ") - case 3: stream.write(" ") - default: break - } - } -} - -public struct JSONEncoderOptions { - /// If `true`, the output is formatted with whitespace to be easier to read. - /// If `false`, the output omits any unnecessary whitespace. - /// - /// The default value is `false`. - public var pretty: Bool = false - - /// Returns a new `JSONEncoderOptions` with default values. - public init() {} - - /// Returns a new `JSONEncoderOptions`. - /// - Parameter pretty: Whether the output should be formatted nicely. Defaults to `false`. - public init(pretty: Bool = false) { - self.pretty = pretty - } -} - -extension JSONEncoderOptions: ExpressibleByArrayLiteral { - public enum Element { - /// Formats the output with whitespace to be easier to read. - /// - SeeAlso: `JSONEncoderOptions.pretty`. - case pretty - } - - public init(arrayLiteral elements: Element...) { - for elt in elements { - switch elt { - case .pretty: pretty = true - } - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSON.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSON.swift deleted file mode 100755 index da0b91280..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSON.swift +++ /dev/null @@ -1,170 +0,0 @@ -// -// JSON.swift -// PMJSON -// -// Created by Kevin Ballard on 10/8/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -/// A single JSON-compatible value. -public enum JSON { - /// The null value. - case null - /// A boolean. - case bool(Bool) - /// A string. - case string(String) - /// A 64-bit integer. - case int64(Int64) - /// A number. - /// When decoding, any integer that doesn't fit in 64 bits and any floating-point number - /// is decoded as a `Double`. - case double(Double) - /// An object. - case object(JSONObject) - /// An array. - case array(JSONArray) - - /// Initializes `self` as a boolean with the value `bool`. - public init(_ bool: Bool) { - self = .bool(bool) - } - /// Initializes `self` as a string with the value `str`. - public init(_ str: String) { - self = .string(str) - } - /// Initializes `self` as a 64-bit integer with the value `i`. - public init(_ i: Int64) { - self = .int64(i) - } - /// Initializes `self` as a double with the value `d`. - public init(_ d: Double) { - self = .double(d) - } - /// Initializes `self` as an object with the value `obj`. - public init(_ obj: JSONObject) { - self = .object(obj) - } - /// Initializes `self` as an array with the value `ary`. - public init(_ ary: JSONArray) { - self = .array(ary) - } -} - -// Convenience conversions. -public extension JSON { - /// Initializes `self` as a 64-bit integer with the value `i`. - public init(_ i: Int) { - self = .int64(Int64(i)) - } - - /// Initializes `self` as an array with the contents of the sequence `seq`. - public init(_ seq: S) where S.Iterator.Element == JSON { - self = .array(JSONArray(seq)) - } - - /// Initializes `self` as an array with the contents of the sequence `seq`. - public init(_ seq: S) where S.Iterator.Element == JSONObject { - self = .array(JSONArray(seq.lazy.map(JSON.init))) - } - - /// Initializes `self` as an array with the contents of the sequence `seq`. - public init(_ seq: S) where S.Iterator.Element == JSONArray { - self = .array(JSONArray(seq.lazy.map(JSON.init))) - } -} - -public typealias JSONArray = ContiguousArray - -extension JSON: Equatable { - public static func ==(lhs: JSON, rhs: JSON) -> Bool { - switch (lhs, rhs) { - case (.null, .null): return true - case (.bool(let a), .bool(let b)): return a == b - case (.string(let a), .string(let b)): return a == b - case (.int64(let a), .int64(let b)): return a == b - case (.double(let a), .double(let b)): return a == b - case (.int64(let a), .double(let b)): return Double(a) == b - case (.double(let a), .int64(let b)): return a == Double(b) - case (.object(let a), .object(let b)): return a == b - case (.array(let a), .array(let b)): return a == b - default: return false - } - } -} - -extension JSON: TextOutputStreamable, CustomStringConvertible, CustomDebugStringConvertible { - public func write(to target: inout Target) { - JSON.encode(self, to: &target) - } - - public var description: String { - return JSON.encodeAsString(self) - } - - public var debugDescription: String { - let desc = JSON.encodeAsString(self) - return "JSON(\(desc))" - } -} - -extension JSON: ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByBooleanLiteral, ExpressibleByNilLiteral { - public init(integerLiteral value: Int64) { - self = .int64(value) - } - - public init(floatLiteral value: Double) { - self = .double(value) - } - - public init(booleanLiteral value: Bool) { - self = .bool(value) - } - - public init(nilLiteral: ()) { - self = .null - } -} - -extension JSON: ExpressibleByStringLiteral { - public init(stringLiteral value: String) { - self = .string(value) - } - - public init(extendedGraphemeClusterLiteral value: String) { - self = .string(value) - } - - public init(unicodeScalarLiteral value: String) { - self = .string(value) - } -} - -extension JSON: ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral { - public init(arrayLiteral elements: JSON...) { - self = .array(JSONArray(elements)) - } - - public init(dictionaryLiteral elements: (String, JSON)...) { - self = .object(JSONObject(elements)) - } -} - -extension JSON: CustomReflectable { - public var customMirror: Mirror { - switch self { - case .null, .bool, .string, .int64, .double: return Mirror(self, children: []) - case .object(let obj): - let children: LazyMapCollection = obj.lazy.map({ ($0, $1) }) - return Mirror(self, children: children, displayStyle: .dictionary) - case .array(let ary): - return Mirror(self, unlabeledChildren: ary, displayStyle: .collection) - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSONError.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSONError.swift deleted file mode 100755 index a55773e6f..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSONError.swift +++ /dev/null @@ -1,1619 +0,0 @@ -// -// JSONError.swift -// PMJSON -// -// Created by Kevin Ballard on 11/9/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -// MARK: JSONError - -/// Errors thrown by the JSON `get*` or `to*` accessor families. -public enum JSONError: Error, CustomStringConvertible { - /// Thrown when a given path is missing or has the wrong type. - /// - Parameter path: The path of the key that caused the error. - /// - Parameter expected: The type that was expected at this path. - /// - Parameter actual: The type of the value found at the path, or `nil` if there was no value. - case missingOrInvalidType(path: String?, expected: ExpectedType, actual: JSONType?) - /// Thrown when an integral value is coerced to a smaller type (e.g. `Int64` to `Int`) and the - /// value doesn't fit in the smaller type. - /// - Parameter path: The path of the value that cuased the error. - /// - Parameter value: The actual value at that path. - /// - Parameter expected: The type that the value doesn't fit in, e.g. `Int.self`. - case outOfRangeInt64(path: String?, value: Int64, expected: Any.Type) - /// Thrown when a floating-point value is coerced to a smaller type (e.g. `Double` to `Int`) - /// and the value doesn't fit in the smaller type. - /// - Parameter path: The path of the value that cuased the error. - /// - Parameter value: The actual value at that path. - /// - Parameter expected: The type that the value doesn't fit in, e.g. `Int.self`. - case outOfRangeDouble(path: String?, value: Double, expected: Any.Type) - - public var description: String { - switch self { - case let .missingOrInvalidType(path, expected, actual): return "\(path.map({"\($0): "}) ?? "")expected \(expected), found \(actual?.description ?? "missing value")" - case let .outOfRangeInt64(path, value, expected): return "\(path.map({"\($0): "}) ?? "")value \(value) cannot be coerced to type \(expected)" - case let .outOfRangeDouble(path, value, expected): return "\(path.map({"\($0): "}) ?? "")value \(value) cannot be coerced to type \(expected)" - } - } - - fileprivate func withPrefix(_ prefix: String) -> JSONError { - func prefixPath(_ path: String?, with prefix: String) -> String { - guard let path = path, !path.isEmpty else { return prefix } - if path.unicodeScalars.first == "[" { - return prefix + path - } else { - return "\(prefix).\(path)" - } - } - switch self { - case let .missingOrInvalidType(path, expected, actual): - return .missingOrInvalidType(path: prefixPath(path, with: prefix), expected: expected, actual: actual) - case let .outOfRangeInt64(path, value, expected): - return .outOfRangeInt64(path: prefixPath(path, with: prefix), value: value, expected: expected) - case let .outOfRangeDouble(path, value, expected): - return .outOfRangeDouble(path: prefixPath(path, with: prefix), value: value, expected: expected) - } - } - - public enum ExpectedType: CustomStringConvertible { - case required(JSONType) - case optional(JSONType) - - public var description: String { - switch self { - case .required(let type): return type.description - case .optional(let type): return "\(type) or null" - } - } - } - - public enum JSONType: String, CustomStringConvertible { - case null = "null" - case bool = "bool" - case string = "string" - case number = "number" - case object = "object" - case array = "array" - - internal static func forValue(_ value: JSON) -> JSONType { - switch value { - case .null: return .null - case .bool: return .bool - case .string: return .string - case .int64, .double: return .number - case .object: return .object - case .array: return .array - } - } - - public var description: String { - return rawValue - } - } -} - -// MARK: - Basic accessors -public extension JSON { - /// Returns the bool value if the receiver is a bool. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getBool() throws -> Bool { - guard let b = self.bool else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.bool), actual: .forValue(self)) } - return b - } - - /// Returns the bool value if the receiver is a bool. - /// - Returns: A `Bool` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getBoolOrNil() throws -> Bool? { - if let b = self.bool { return b } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.bool), actual: .forValue(self)) } - } - - /// Returns the string value if the receiver is a string. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getString() throws -> String { - guard let str = self.string else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.string), actual: .forValue(self)) } - return str - } - - /// Returns the string value if the receiver is a string. - /// - Returns: A `String` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getStringOrNil() throws -> String? { - if let str = self.string { return str } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.string), actual: .forValue(self)) } - } - - /// Returns the 64-bit integral value if the receiver is a number. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getInt64() throws -> Int64 { - guard let val = self.int64 else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) } - return val - } - - /// Returns the 64-bit integral value value if the receiver is a number. - /// - Returns: An `Int64` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getInt64OrNil() throws -> Int64? { - if let val = self.int64 { return val } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - - /// Returns the integral value if the receiver is a number. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the receiver is the wrong type, or if the 64-bit integral value - /// is too large to fit in an `Int`. - func getInt() throws -> Int { - guard let val = self.int64 else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) } - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } - - /// Returns the integral value if the receiver is a number. - /// - Returns: An `Int` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type, or if the 64-bit integral value - /// is too large to fit in an `Int`. - func getIntOrNil() throws -> Int? { - if let val = self.int64 { - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - - /// Returns the double value if the receiver is a number. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getDouble() throws -> Double { - guard let val = self.double else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .forValue(self)) } - return val - } - - /// Returns the double value if the receiver is a number. - /// - Returns: A `Double` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getDoubleOrNil() throws -> Double? { - if let val = self.double { return val } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.number), actual: .forValue(self)) } - } - - /// Returns the object value if the receiver is an object. - /// - Returns: An object value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getObject() throws -> JSONObject { - guard let dict = self.object else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.object), actual: .forValue(self)) } - return dict - } - - /// Returns the object value if the receiver is an object. - /// - Returns: An object value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getObjectOrNil() throws -> JSONObject? { - if let dict = self.object { return dict } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.object), actual: .forValue(self)) } - } - - /// Returns the array value if the receiver is an array. - /// - Returns: An array value. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getArray() throws -> JSONArray { - guard let ary = self.array else { throw JSONError.missingOrInvalidType(path: nil, expected: .required(.array), actual: .forValue(self)) } - return ary - } - - /// Returns the array value if the receiver is an array. - /// - Returns: An array value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is the wrong type. - func getArrayOrNil() throws -> JSONArray? { - if let ary = self.array { return ary } - else if isNull { return nil } - else { throw JSONError.missingOrInvalidType(path: nil, expected: .optional(.array), actual: .forValue(self)) } - } -} - -public extension JSON { - /// Returns the receiver coerced to a string value. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the receiver is an object or array. - func toString() throws -> String { - return try toStringMaybeNil(.required(.string)) ?? "null" - } - - /// Returns the receiver coerced to a string value. - /// - Returns: A `String` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is an object or array. - func toStringOrNil() throws -> String? { - return try toStringMaybeNil(.optional(.string)) - } - - private func toStringMaybeNil(_ expected: JSONError.ExpectedType) throws -> String? { - switch self { - case .string(let s): return s - case .null: return nil - case .bool(let b): return String(b) - case .int64(let i): return String(i) - case .double(let d): return String(d) - default: throw JSONError.missingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) - } - } - - /// Returns the receiver coerced to a 64-bit integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int64` value`. - /// - Throws: `JSONError` if the receiver is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to a 64-bit integral value, - /// or a floating-point value that does not fit in 64 bits. - func toInt64() throws -> Int64 { - guard let val = try toInt64MaybeNil(.required(.number)) else { - throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .null) - } - return val - } - - /// Returns the receiver coerced to a 64-bit integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int64` value`, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is a boolean, an object, an array, - /// a string that cannot be coerced to a 64-bit integral value, - /// or a floating-point value that does not fit in 64 bits. - func toInt64OrNil() throws -> Int64? { - return try toInt64MaybeNil(.optional(.number)) - } - - private func toInt64MaybeNil(_ expected: JSONError.ExpectedType) throws -> Int64? { - switch self { - case .int64(let i): - return i - case .double(let d): - guard let val = convertDoubleToInt64(d) else { - throw JSONError.outOfRangeDouble(path: nil, value: d, expected: Int64.self) - } - return val - case .string(let s): - if let i = Int64(s, radix: 10) { - return i - } else if let d = Double(s) { - guard let val = convertDoubleToInt64(d) else { - throw JSONError.outOfRangeDouble(path: nil, value: d, expected: Int64.self) - } - return val - } - case .null: - return nil - default: - break - } - throw JSONError.missingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) - } - - /// Returns the receiver coerced to an integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int` value`. - /// - Throws: `JSONError` if the receiver is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, - /// or a floating-point value that does not fit in an `Int`. - func toInt() throws -> Int { - let val = try toInt64() - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } - - /// Returns the receiver coerced to an integral value. - /// If the receiver is a floating-point value, the value will be truncated - /// to an integer. - /// - Returns: An `Int` value`, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, - /// or a floating-point value that does not fit in an `Int`. - func toIntOrNil() throws -> Int? { - guard let val = try toInt64OrNil() else { return nil } - let truncated = Int(truncatingBitPattern: val) - guard Int64(truncated) == val else { throw JSONError.outOfRangeInt64(path: nil, value: val, expected: Int.self) } - return truncated - } - - /// Returns the receiver coerced to a `Double`. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the receiver is `null`, a boolean, an object, an array, - /// or a string that cannot be coerced to a floating-point value. - func toDouble() throws -> Double { - guard let val = try toDoubleMaybeNil(.required(.number)) else { - throw JSONError.missingOrInvalidType(path: nil, expected: .required(.number), actual: .null) - } - return val - } - - /// Returns the receiver coerced to a `Double`. - /// - Returns: A `Double` value, or `nil` if the receiver is `null`. - /// - Throws: `JSONError` if the receiver is a boolean, an object, an array, - /// or a string that cannot be coerced to a floating-point value. - func toDoubleOrNil() throws -> Double? { - return try toDoubleMaybeNil(.optional(.number)) - } - - private func toDoubleMaybeNil(_ expected: JSONError.ExpectedType) throws -> Double? { - switch self { - case .int64(let i): return Double(i) - case .double(let d): return d - case .string(let s): return Double(s) - case .null: return nil - default: throw JSONError.missingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) - } - } -} - -// MARK: - Keyed accessors -public extension JSON { - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getBool(_ key: String) throws -> Bool { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .string) - return try scoped(key) { try value.getBool() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getBoolOrNil(_ key: String) throws -> Bool? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getBoolOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getString(_ key: String) throws -> String { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .string) - return try scoped(key) { try value.getString() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getStringOrNil(_ key: String) throws -> String? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getInt64(_ key: String) throws -> Int64 { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getInt64() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getInt64OrNil(_ key: String) throws -> Int64? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, - /// or if the 64-bit integral value is too large to fit in an `Int`, or if - /// the receiver is not an object. - func getInt(_ key: String) throws -> Int { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getInt() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the 64-bit integral - /// value is too large to fit in an `Int`, or if the receiver is not an object. - func getIntOrNil(_ key: String) throws -> Int? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - func getDouble(_ key: String) throws -> Double { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.getDouble() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - func getDoubleOrNil(_ key: String) throws -> Double? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getDoubleOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObject(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - /// - SeeAlso: `getObject(_:_:)` - func getObject(_ key: String) throws -> JSONObject { - return try getObject(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObjectOrNil(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object. - /// - SeeAlso: `getObjectOrNil(_:_:)` - func getObjectOrNil(_ key: String) throws -> JSONObject? { - return try getObjectOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object, or any error thrown by `transform`. - func getObject(_ key: String, _ transform: (JSONObject) throws -> T) throws -> T { - return try getObject().getObject(key, transform) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object, - /// or any error thrown by `transform`. - func getObjectOrNil(_ key: String, _ transform: (JSONObject) throws -> T?) throws -> T? { - return try getObject().getObjectOrNil(key, transform) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArray(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object. - /// - SeeAlso: `getArray(_:_:)` - func getArray(_ key: String) throws -> JSONArray { - return try getArray(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArrayOrNil(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An array value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - /// - SeeAlso: `getArrayOrNil(_:_:)` - func getArrayOrNil(_ key: String) throws -> JSONArray? { - return try getArrayOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or if - /// the receiver is not an object, or any error thrown by `transform`. - func getArray(_ key: String, _ transform: (JSONArray) throws -> T) throws -> T { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .array) - return try scoped(key) { try transform(value.getArray()) } - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an object, - /// or any error thrown by `transform`. - func getArrayOrNil(_ key: String, _ transform: (JSONArray) throws -> T?) throws -> T? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.getArrayOrNil().flatMap(transform) } - } -} - -public extension JSON { - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist, the value is an object or an array, - /// or if the receiver is not an object. - /// - SeeAlso: `toString()`. - func toString(_ key: String) throws -> String { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .string) - return try scoped(key) { try value.toString() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is an object or an array, or if the receiver is not an object. - /// - SeeAlso: `toStringOrNil()`. - func toStringOrNil(_ key: String) throws -> String? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to a 64-bit integral value, or a floating-point - /// value that does not fit in 64 bits, or if the receiver is not an object. - func toInt64(_ key: String) throws -> Int64 { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toInt64() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to a 64-bit integral value, or a floating-point value - /// that does not fit in 64 bits, or if the receiver is not an object. - func toInt64OrNil(_ key: String) throws -> Int64? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, or a floating-point - /// value that does not fit in an `Int`, or if the receiver is not an object. - func toInt(_ key: String) throws -> Int { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toInt() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to an integral value, or a floating-point value - /// that does not fit in an `Int`, or if the receiver is not an object. - func toIntOrNil(_ key: String) throws -> Int? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a floating-point value, - /// or if the receiver is not an object. - func toDouble(_ key: String) throws -> Double { - let dict = try getObject() - let value = try getRequired(dict, key: key, type: .number) - return try scoped(key) { try value.toDouble() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a floating-point value, or if the receiver is not an object. - func toDoubleOrNil(_ key: String) throws -> Double? { - let dict = try getObject() - guard let value = dict[key] else { return nil } - return try scoped(key) { try value.toDoubleOrNil() } - } -} - -// MARK: - Indexed accessors -public extension JSON { - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getBool(_ index: Int) throws -> Bool { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .bool) - return try scoped(index) { try value.getBool() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Bool` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getBoolOrNil(_ index: Int) throws -> Bool? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getBoolOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getString(_ index: Int) throws -> String { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .string) - return try scoped(index) { try value.getString() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getStringOrNil(_ index: Int) throws -> String? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getStringOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getInt64(_ index: Int) throws -> Int64 { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.getInt64() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getInt64OrNil(_ index: Int) throws -> Int64? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getInt64OrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the 64-bit integral value is too large to fit in an `Int`, or if - /// the receiver is not an array. - func getInt(_ index: Int) throws -> Int { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.getInt() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the 64-bit integral value - /// is too large to fit in an `Int`, or if the receiver is not an array. - func getIntOrNil(_ index: Int) throws -> Int? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getIntOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - func getDouble(_ index: Int) throws -> Double { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.getDouble() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - func getDoubleOrNil(_ index: Int) throws -> Double? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getDoubleOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getObject(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An object value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - /// - SeeAlso: `getObject(_:_:)` - func getObject(_ index: Int) throws -> JSONObject { - return try getObject(index, { $0 }) - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getObjectOrNil(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An object value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - /// - SeeAlso: `getObjectOrNil(_:_:)` - func getObjectOrNil(_ index: Int) throws -> JSONObject? { - return try getObjectOrNil(index, { $0 }) - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array, or any error thrown by `transform`. - func getObject(_ index: Int, _ f: (JSONObject) throws -> T) throws -> T { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .object) - return try scoped(index) { try f(value.getObject()) } - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array, - //// or any error thrown by `transform`. - func getObjectOrNil(_ index: Int, _ f: (JSONObject) throws -> T?) throws -> T? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getObjectOrNil().flatMap(f) } - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getArray(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An array value. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array. - /// - SeeAlso: `getArray(_:_:)` - func getArray(_ index: Int) throws -> JSONArray { - return try getArray(index, { $0 }) - } - - /// Subscripts the receiver with `index` and returns the result. - /// - Note: Use `getArrayOrNil(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An array value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array. - /// - SeeAlso: `getArrayOrNil(_:_:)` - func getArrayOrNil(_ index: Int) throws -> JSONArray? { - return try getArrayOrNil(index, { $0 }) - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the index is out of bounds or the value is the wrong type, - /// or if the receiver is not an array, or any error thrown by `transform`. - func getArray(_ index: Int, _ f: (JSONArray) throws -> T) throws -> T { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .array) - return try scoped(index) { try f(value.getArray()) } - } - - /// Subscripts the receiver with `index` and passes the result to the given block. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `index`. - /// - Returns: The result of calling the given block, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the receiver is not an array, - /// or any error thrown by `transform`. - func getArrayOrNil(_ index: Int, _ f: (JSONArray) throws -> T?) throws -> T? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.getArrayOrNil().flatMap(f) } - } -} - -public extension JSON { - /// Subscripts the receiver with `index` and returns the result coerced to a `String`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is an object or an array, - /// or if the receiver is not an array. - /// - SeeAlso: `toString()`. - func toString(_ index: Int) throws -> String { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .string) - return try scoped(index) { try value.toString() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to a `String`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is an object or an array, or if the receiver is not an array. - /// - SeeAlso: `toStringOrNil()`. - func toStringOrNil(_ index: Int) throws -> String? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toStringOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int64`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, a string that cannot be coerced to a 64-bit integral value, or a - /// floating-point value that does not fit in 64 bits, or if the receiver is not an array. - /// - SeeAlso: `toInt64()`. - func toInt64(_ index: Int) throws -> Int64 { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.toInt64() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int64`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to a 64-bit integral value, or a floating-point value - /// that does not fit in 64 bits, or if the receiver is not an array. - /// - SeeAlso: `toInt64OrNil()`. - func toInt64OrNil(_ index: Int) throws -> Int64? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toInt64OrNil() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, a string that cannot be coerced to an integral value, or a - /// floating-point value that does not fit in an `Int`, or if the receiver is not an array. - /// - SeeAlso: `toInt()`. - func toInt(_ index: Int) throws -> Int { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.toInt() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to an `Int`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to an integral value, or a floating-point value - /// that does not fit in an `Int`, or if the receiver is not an array. - /// - SeeAlso: `toIntOrNil()`. - func toIntOrNil(_ index: Int) throws -> Int? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toIntOrNil() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to a `Double`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the index is out of bounds or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a floating-point value, - /// or if the receiver is not an array. - /// - SeeAlso: `toDouble()`. - func toDouble(_ index: Int) throws -> Double { - let ary = try getArray() - let value = try getRequired(ary, index: index, type: .number) - return try scoped(index) { try value.toDouble() } - } - - /// Subscripts the receiver with `index` and returns the result coerced to a `Double`. - /// - Parameter index: The index that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the index is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a floating-point value, or if the receiver is not an array. - /// - SeeAlso: `toDouble()`. - func toDoubleOrNil(_ index: Int) throws -> Double? { - let ary = try getArray() - guard let value = ary[safe: index] else { return nil } - return try scoped(index) { try value.toDoubleOrNil() } - } -} - -// MARK: - - -public extension JSONObject { - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getBool(_ key: String) throws -> Bool { - let value = try getRequired(self, key: key, type: .string) - return try scoped(key) { try value.getBool() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Bool` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getBoolOrNil(_ key: String) throws -> Bool? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getBoolOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getString(_ key: String) throws -> String { - let value = try getRequired(self, key: key, type: .string) - return try scoped(key) { try value.getString() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getStringOrNil(_ key: String) throws -> String? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getInt64(_ key: String) throws -> Int64 { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getInt64() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getInt64OrNil(_ key: String) throws -> Int64? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, - /// or if the 64-bit integral value is too large to fit in an `Int`. - func getInt(_ key: String) throws -> Int { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getInt() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or if the 64-bit integral - /// value is too large to fit in an `Int`. - func getIntOrNil(_ key: String) throws -> Int? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - func getDouble(_ key: String) throws -> Double { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.getDouble() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - func getDoubleOrNil(_ key: String) throws -> Double? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getDoubleOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObject(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - /// - SeeAlso: `getObject(_:_:)` - func getObject(_ key: String) throws -> JSONObject { - return try getObject(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getObjectOrNil(_:_:)` when using throwing accessors on the resulting - /// object value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An object value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - /// - SeeAlso: `getObjectOrNil(_:_:)` - func getObjectOrNil(_ key: String) throws -> JSONObject? { - return try getObjectOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or any - /// error thrown by `transform`. - func getObject(_ key: String, _ f: (JSONObject) throws -> T) throws -> T { - let value = try getRequired(self, key: key, type: .object) - return try scoped(key) { try f(value.getObject()) } - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or any error thrown by `transform`. - func getObjectOrNil(_ key: String, _ f: (JSONObject) throws -> T?) throws -> T? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getObjectOrNil().flatMap(f) } - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArray(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type. - /// - SeeAlso: `getArray(_:_:)` - func getArray(_ key: String) throws -> JSONArray { - return try getArray(key, { $0 }) - } - - /// Subscripts the receiver with `key` and returns the result. - /// - Note: Use `getArrayOrNil(_:_:)` when using throwing accessors on the resulting - /// array value to produce better errors. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An array value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type. - /// - SeeAlso: `getArrayOrNil(_:_:)` - func getArrayOrNil(_ key: String) throws -> JSONArray? { - return try getArrayOrNil(key, { $0 }) - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block. - /// - Throws: `JSONError` if the key doesn't exist or the value is the wrong type, or any - /// error thrown by `transform`. - func getArray(_ key: String, _ f: (JSONArray) throws -> T) throws -> T { - let value = try getRequired(self, key: key, type: .array) - return try scoped(key) { try f(value.getArray()) } - } - - /// Subscripts the receiver with `key` and passes the result to the given block. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Parameter transform: A block that's called with the result of subscripting the receiver with `key`. - /// - Returns: The result of calling the given block, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value has the wrong type, or any error thrown by `transform`. - func getArrayOrNil(_ key: String, _ f: (JSONArray) throws -> T?) throws -> T? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.getArrayOrNil().flatMap(f) } - } -} - -public extension JSONObject { - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value. - /// - Throws: `JSONError` if the key doesn't exist, the value is an object or an array, - /// or if the receiver is not an object. - /// - SeeAlso: `toString()`. - func toString(_ key: String) throws -> String { - let value = try getRequired(self, key: key, type: .string) - return try scoped(key) { try value.toString() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `String`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `String` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is an object or an array, or if the receiver is not an object. - /// - SeeAlso: `toStringOrNil()`. - func toStringOrNil(_ key: String) throws -> String? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toStringOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to a 64-bit integral value, or a floating-point - /// value that does not fit in 64 bits, or if the receiver is not an object. - func toInt64(_ key: String) throws -> Int64 { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toInt64() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int64`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int64` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to a 64-bit integral value, or a floating-point value - /// that does not fit in 64 bits, or if the receiver is not an object. - func toInt64OrNil(_ key: String) throws -> Int64? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toInt64OrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, an object, - /// an array, a string that cannot be coerced to an integral value, or a floating-point - /// value that does not fit in an `Int`, or if the receiver is not an object. - func toInt(_ key: String) throws -> Int { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toInt() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to an `Int`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: An `Int` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the the value is a boolean, an object, an array, a string - /// that cannot be coerced to an integral value, or a floating-point value - /// that does not fit in an `Int`, or if the receiver is not an object. - func toIntOrNil(_ key: String) throws -> Int? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toIntOrNil() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value. - /// - Throws: `JSONError` if the key doesn't exist or the value is `null`, a boolean, - /// an object, an array, or a string that cannot be coerced to a floating-point value, - /// or if the receiver is not an object. - func toDouble(_ key: String) throws -> Double { - let value = try getRequired(self, key: key, type: .number) - return try scoped(key) { try value.toDouble() } - } - - /// Subscripts the receiver with `key` and returns the result coerced to a `Double`. - /// - Parameter key: The key that's used to subscript the receiver. - /// - Returns: A `Double` value, or `nil` if the key doesn't exist or the value is `null`. - /// - Throws: `JSONError` if the value is a boolean, an object, an array, or a string that - /// cannot be coerced to a floating-point value, or if the receiver is not an object. - func toDoubleOrNil(_ key: String) throws -> Double? { - guard let value = self[key] else { return nil } - return try scoped(key) { try value.toDoubleOrNil() } - } -} - -// MARK: - JSONArray helpers - -public extension JSON { - /// Returns an `Array` containing the results of mapping `transform` over `array`. - /// - /// If `transform` throws a `JSONError`, the error will be modified to include the index - /// of the element that caused the error. - /// - /// - Parameter array: The `JSONArray` to map over. - /// - Parameter transform: A block that is called once for each element of `array`. - /// - Returns: An array with the results of mapping `transform` over `array`. - /// - Throws: Rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - static func map(_ array: JSONArray, _ transform: (JSON) throws -> T) rethrows -> [T] { - return try array.enumerated().map({ i, elt in try scoped(i, { try transform(elt) }) }) - } - - /// Returns an `Array` containing the non-`nil` results of mapping `transform` over `array`. - /// - /// If `transform` throws a `JSONError`, the error will be modified to include the index - /// of the element that caused the error. - /// - /// - Parameter array: The `JSONArray` to map over. - /// - Parameter transform: A block that is called once for each element of `array`. - /// - Returns: An array with the non-`nil` results of mapping `transform` over `array`. - /// - Throws: Rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - static func flatMap(_ array: JSONArray, _ transform: (JSON) throws -> T?) rethrows -> [T] { - return try array.enumerated().flatMap({ i, elt in try scoped(i, { try transform(elt) }) }) - } - - /// Returns an `Array` containing the concatenated results of mapping `transform` over `array`. - /// - /// If `transform` throws a `JSONError`, the error will be modified to include the index - /// of the element that caused the error. - /// - /// - Parameter array: The `JSONArray` to map over. - /// - Parameter transform: A block that is called once for each element of `array`. - /// - Returns: An array with the concatenated results of mapping `transform` over `array`. - /// - Throws: Rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - static func flatMap(_ array: JSONArray, _ transform: (JSON) throws -> S) rethrows -> [S.Iterator.Element] { - return try array.enumerated().flatMap({ (i, elt) in - return try scoped(i, { try transform(elt) }) - }) - } -} - -public extension JSON { - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an object, `key` does not exist, or the value - /// is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArray(_ key: String, _ transform: (JSON) throws -> T) throws -> [T] { - return try getArray(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(index, { try JSON.map($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an array, `index` is out of bounds, or the - /// value is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArray(_ index: Int, _ transform: (JSON) throws -> T) throws -> [T] { - return try getArray(index, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array, or `nil` if - /// `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or `key` exists but the value is not - /// an array or `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// Returns `nil` if `index` is out of bounds or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(index, { try JSON.map($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array, or `nil` if - /// `index` is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or the subscript value is not an - /// array or `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArrayOrNil(_ index: Int, _ transform: (JSON) throws -> T) throws -> [T]? { - return try getArrayOrNil(index, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an object, `key` does not exist, or the value - /// is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArray(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an object, `key` does not exist, or the value - /// is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArray(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an array, `index` is out of bounds, or the - /// value is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArray(_ index: Int, _ transform: (JSON) throws -> T?) throws -> [T] { - return try getArray(index, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array. - /// - Throws: `JSONError` if the receiver is not an array, `index` is out of bounds, or the - /// value is not an array. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArray(_ index: Int, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element] { - return try getArray(index, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array, or - /// `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array, - /// or `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an object or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// Returns `nil` if `index` is out of bounds or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array, or - /// `nil` if `index` is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an array or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArrayOrNil(_ index: Int, _ transform: (JSON) throws -> T?) throws -> [T]? { - return try getArrayOrNil(index, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `index`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// Returns `nil` if `index` is out of bounds or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(index, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter index: The index to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array, - /// or `nil` if `index` is out of bounds or the value is `null`. - /// - Throws: `JSONError` if the receiver is not an array or the value is not an array or - /// `null`. Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArrayOrNil(_ index: Int, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element]? { - return try getArrayOrNil(index, { try JSON.flatMap($0, transform) }) - } -} - -public extension JSONObject { - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array. - /// - Throws: `JSONError` if `key` does not exist or the value is not an array. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArray(_ key: String, _ transform: (JSON) throws -> T) throws -> [T] { - return try getArray(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.map($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the results of mapping `transform` over the array, or `nil` if - /// `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if `key` exists but the value is not an array or `null`. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func mapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.map($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array. - /// - Throws: `JSONError` if `key` does not exist or the value is not an array. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArray(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// - Note: This method is equivalent to `getArray(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array. - /// - Throws: `JSONError` if `key` does not exist or the value is not an array. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArray(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element] { - return try getArray(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the non-`nil` results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the non-`nil` results of mapping `transform` over the array, or - /// `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if `key` exists but the value is not an array or `null`. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*N*). - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> T?) throws -> [T]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } - - /// Subscripts the receiver with `key`, converts the value to an array, and returns an `Array` - /// containing the concatenated results of mapping `transform` over the value. - /// - /// Returns `nil` if `key` doesn't exist or the value is `null`. - /// - /// - Note: This method is equivalent to `getArrayOrNil(key, { try JSON.flatMap($0, transform) })`. - /// - /// - Parameter key: The key to subscript the receiver with. - /// - Parameter transform: A block that is called once for each element of the resulting array. - /// - Returns: An array with the concatenated results of mapping `transform` over the array, - /// or `nil` if `key` does not exist or the value is `null`. - /// - Throws: `JSONError` if `key` exists but the value is not an array or `null`. - /// Also rethrows any error thrown by `transform`. - /// - Complexity: O(*M* + *N*) where *M* is the length of `array` and *N* is the length of the result. - func flatMapArrayOrNil(_ key: String, _ transform: (JSON) throws -> S) throws -> [S.Iterator.Element]? { - return try getArrayOrNil(key, { try JSON.flatMap($0, transform) }) - } -} - -// MARK: - - -internal func getRequired(_ dict: JSONObject, key: String, type: JSONError.JSONType) throws -> JSON { - guard let value = dict[key] else { throw JSONError.missingOrInvalidType(path: key, expected: .required(type), actual: nil) } - return value -} - -internal func getRequired(_ ary: JSONArray, index: Int, type: JSONError.JSONType) throws -> JSON { - guard let value = ary[safe: index] else { throw JSONError.missingOrInvalidType(path: "[\(index)]", expected: .required(type), actual: nil) } - return value -} - -@inline(__always) -internal func scoped(_ key: String, _ f: () throws -> T) rethrows -> T { - do { - return try f() - } catch let error as JSONError { - throw error.withPrefix(key) - } -} - -@inline(__always) -internal func scoped(_ index: Int, _ f: () throws -> T) rethrows -> T { - do { - return try f() - } catch let error as JSONError { - throw error.withPrefix("[\(index)]") - } -} - -internal extension ContiguousArray { - subscript(safe index: Int) -> Element? { - guard index >= startIndex && index < endIndex else { return nil } - return self[index] - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSONObject.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSONObject.swift deleted file mode 100755 index dc484c71d..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/JSONObject.swift +++ /dev/null @@ -1,215 +0,0 @@ -// -// JSONObject.swift -// PMJSON -// -// Created by Kevin Ballard on 11/10/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -/// A collection of key-value pairs that maps `String` to `JSON`. -/// -/// This collection abstracts away the underlying representation and allows for JSON-specific -/// methods to be added. -public struct JSONObject { - /// Creates an empty object. - public init() { - dictionary = [:] - } - - /// Creates an object from a sequence of `(String,JSON)` pairs. - public init(_ seq: S) where S.Iterator.Element == (String,JSON) { - // optimize for the case where the sequence doesn't contain duplicate keys - dictionary = Dictionary(minimumCapacity: seq.underestimatedCount) - for (key,value) in seq { - dictionary[key] = value - } - } - - /// The JSON object represented as a `[String: JSON]`. - public fileprivate(set) var dictionary: [String: JSON] - - public subscript(key: String) -> JSON? { - @inline(__always) get { - return dictionary[key] - } - @inline(__always) set { - dictionary[key] = newValue - } - } -} - -extension JSONObject: Collection { - /// The position of the first element in a non-empty object. - /// - /// Identical to `endIndex` in an empty object. - public var startIndex: Index { - return Index(dictionary.startIndex) - } - - /// The collection's "past the end" position. - /// - /// `endIndex` is not a valid argument to `subscript`, and is always reachable from `startIndex` - /// by zero or more applications of `successor()`. - public var endIndex: Index { - return Index(dictionary.endIndex) - } - - /// Returns `true` iff `self` is empty. - public var isEmpty: Bool { - return dictionary.isEmpty - } - - /// The number of entries in the object. - public var count: Int { - return dictionary.count - } - - public func makeIterator() -> Iterator { - return Iterator(dictionary.makeIterator()) - } - - public subscript(position: Index) -> (String,JSON) { - return dictionary[position.base] - } - - public func index(after i: Index) -> Index { - return Index(dictionary.index(after: i.base)) - } - - public func formIndex(after i: inout Index) { - dictionary.formIndex(after: &i.base) - } - - /// Represents a position in a `JSONObject`. - public struct Index: Comparable { - fileprivate var base: Dictionary.Index - - fileprivate init(_ base: Dictionary.Index) { - self.base = base - } - - public static func ==(lhs: JSONObject.Index, rhs: JSONObject.Index) -> Bool { - return lhs.base == rhs.base - } - - public static func <(lhs: JSONObject.Index, rhs: JSONObject.Index) -> Bool { - return lhs.base < rhs.base - } - } - - public struct Iterator: IteratorProtocol { - private var base: Dictionary.Iterator - - fileprivate init(_ base: Dictionary.Iterator) { - self.base = base - } - - /// Advance to the next element and return it, or `nil` if no next element exists. - /// - /// - Requires: No preceding call to `self.next()` has returned `nil`. - public mutating func next() -> (String,JSON)? { - return base.next() - } - } -} - -extension JSONObject { - /// A collection containing just the keys of `self`. - /// - /// Keys appear in the same order as they occur as the `.0` member of key-value pairs in `self`. - /// Each key in the result has a unique value. - public var keys: LazyMapCollection { - return lazy.map({ $0.0 }) - } - - /// A collection containing just the values of `self`. - /// - /// Values appear in the same order as they occur as the `.1` member of key-value pairs in `self`. - public var values: LazyMapCollection { - return lazy.map({ $0.1 }) - } - - /// Returns the `Index` for the given key, or `nil` if the key is not present in the object. - public func indexForKey(_ key: String) -> Index? { - return dictionary.index(forKey: key).map(Index.init) - } - - /// Update the value stored in the object for the given key, or, if the key does not exist, - /// add a new key-value pair to the object. - /// - /// Returns the value that was replaced, or `nil` if a new key-value pair was added. - public mutating func updateValue(_ value: JSON, forKey key: String) -> JSON? { - return dictionary.updateValue(value, forKey: key) - } - - /// Remove the key-value pair at `index`. - /// - /// Invalidates all indices with respect to `self`. - public mutating func removeAtIndex(_ index: Index) -> (String,JSON)? { - return dictionary.remove(at: index.base) - } - - /// Remove a given key and the associated value from the object. - /// Returns the value that was removed, or `nil` if the key was not present in the object. - public mutating func removeValueForKey(_ key: String) -> JSON? { - return dictionary.removeValue(forKey: key) - } - - /// Remove all elements. - /// - /// Invalidates all indices with respect to `self`. - public mutating func removeAll() { - dictionary.removeAll() - } - - /// If `!self.isEmpty`, return the first key-value pair in the sequence of elements, otherwise return `nil`. - public mutating func popFirst() -> (String,JSON)? { - return dictionary.popFirst() - } -} - -extension JSONObject: ExpressibleByDictionaryLiteral { - /// Creates an object from a dictionary. - public init(_ dictionary: [String: JSON]) { - self.dictionary = dictionary - } - - /// Creates an object initialized with `elements`. - public init(dictionaryLiteral elements: (String, JSON)...) { - self.init(elements) - } -} - -extension JSONObject: TextOutputStreamable, CustomStringConvertible, CustomDebugStringConvertible { - public func write(to target: inout Target) { - JSON.encode(JSON(self), to: &target) - } - - public var description: String { - return JSON.encodeAsString(JSON(self)) - } - - public var debugDescription: String { - let desc = JSON.encodeAsString(JSON(self)) - return "JSONObject(\(desc))" - } -} - -extension JSONObject: Equatable { - public static func ==(lhs: JSONObject, rhs: JSONObject) -> Bool { - return lhs.dictionary == rhs.dictionary - } -} - -extension JSONObject: CustomReflectable { - public var customMirror: Mirror { - let children: LazyMapCollection, Mirror.Child> = dictionary.lazy.map({ ($0,$1) }) - return Mirror(self, children: children, displayStyle: .dictionary) - } -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/ObjectiveC.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/ObjectiveC.swift deleted file mode 100755 index 8631a96c9..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/ObjectiveC.swift +++ /dev/null @@ -1,331 +0,0 @@ -// -// ObjectiveC.swift -// PMJSON -// -// Created by Kevin Ballard on 10/9/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -#if os(iOS) || os(OSX) || os(watchOS) || os(tvOS) - - import Foundation - - extension JSON { - /// Decodes a `Data` as JSON. - /// - Note: Invalid unicode sequences in the data are replaced with U+FFFD. - /// - Parameter data: The data to decode. Must be either UTF-8, or UTF-16 with a BOM. - /// - Parameter options: Options that controls JSON parsing. Defaults to no options. See `JSONOptions` for details. - /// - Returns: A `JSON` value. - /// - Throws: `JSONParserError` if the data does not contain valid JSON. - public static func decode(_ data: Data, options: JSONOptions = []) throws -> JSON { - if let endian = UTF16Decoder.checkBOM(for: data) { - return try JSON.decode(UTF16Decoder(data: data, endian: endian)) - } else { - return try JSON.decode(UTF8Decoder(data: data), options: options) - } - } - - @available(*, deprecated, message: "Use JSON.decode(_:options:) instead") - public static func decode(_ data: Data, strict: Bool) throws -> JSON { - return try JSON.decode(data, options: [.strict]) - } - - /// Encodes a `JSON` to a `Data`. - /// - Parameter json: The `JSON` to encode. - /// - Parameter options: Options that controls JSON encoding. Defaults to no options. See `JSONEncoderOptions` for details. - /// - Returns: An `NSData` with the JSON representation of *json*. - public static func encodeAsData(_ json: JSON, options: JSONEncoderOptions = []) -> Data { - struct Output: TextOutputStream { - // NB: We use NSMutableData instead of Data because it's significantly faster as of Xcode 8b3 - var data = NSMutableData() - mutating func write(_ string: String) { - let oldLen = data.length - data.increaseLength(by: string.utf8.count) - let ptr = data.mutableBytes.assumingMemoryBound(to: UInt8.self) + oldLen - for (i, x) in string.utf8.enumerated() { - ptr[i] = x - } - } - } - var output = Output() - JSON.encode(json, to: &output, options: options) - return output.data as Data - } - - @available(*, deprecated, message: "Use JSON.encodeAsData(_:options:) instead") - public static func encodeAsData(_ json: JSON, pretty: Bool) -> Data { - return encodeAsData(json, options: JSONEncoderOptions(pretty: pretty)) - } - } - - extension JSON { - /// Converts a JSON-compatible Foundation object into a `JSON` value. - /// - Throws: `JSONFoundationError` if the object is not JSON-compatible. - public init(ns: Any) throws { - let object = ns as AnyObject - if object === kCFBooleanTrue { - self = .bool(true) - return - } else if object === kCFBooleanFalse { - self = .bool(false) - return - } - switch object { - case is NSNull: - self = .null - case let n as NSNumber: - let typeChar: UnicodeScalar - let objCType = n.objCType - if objCType[0] == 0 || objCType[1] != 0 { - typeChar = "?" - } else { - typeChar = UnicodeScalar(UInt8(bitPattern: objCType[0])) - } - switch typeChar { - case "c", "i", "s", "l", "q", "C", "I", "S", "L", "B": - self = .int64(n.int64Value) - case "Q": // unsigned long long - let val = n.uint64Value - if val > UInt64(Int64.max) { - fallthrough - } - self = .int64(Int64(val)) - default: - self = .double(n.doubleValue) - } - case let s as String: - self = .string(s) - case let dict as NSDictionary: - var obj: [String: JSON] = Dictionary(minimumCapacity: dict.count) - for (key, value) in dict { - guard let key = key as? String else { throw JSONFoundationError.nonStringKey } - obj[key] = try JSON(ns: value) - } - self = .object(JSONObject(obj)) - case let array as NSArray: - var ary: JSONArray = [] - ary.reserveCapacity(array.count) - for elt in array { - ary.append(try JSON(ns: elt)) - } - self = .array(ary) - default: - throw JSONFoundationError.incompatibleType - } - } - - /// Returns the JSON as a JSON-compatible Foundation object. - public var ns: Any { - switch self { - case .null: return NSNull() - case .bool(let b): return NSNumber(value: b) - case .string(let s): return s - case .int64(let i): return NSNumber(value: i) - case .double(let d): return d - case .object(let obj): return obj.ns - case .array(let ary): - return ary.map({$0.ns}) - } - } - - /// Returns the JSON as a JSON-compatible Foundation object, discarding any nulls. - public var nsNoNull: Any? { - switch self { - case .null: return nil - case .bool(let b): return NSNumber(value: b) - case .string(let s): return s - case .int64(let i): return NSNumber(value: i) - case .double(let d): return d - case .object(let obj): return obj.nsNoNull - case .array(let ary): - return ary.flatMap({$0.nsNoNull}) - } - } - } - - extension JSONObject { - /// Returns the JSON as a JSON-compatible dictionary. - public var ns: [AnyHashable: Any] { - var dict: [AnyHashable: Any] = Dictionary(minimumCapacity: count) - for (key, value) in self { - dict[key] = value.ns - } - return dict - } - - /// Returns the JSON as a JSON-compatible dictionary, discarding any nulls. - public var nsNoNull: [AnyHashable: Any] { - var dict: [AnyHashable: Any] = Dictionary(minimumCapacity: count) - for (key, value) in self { - if let value = value.nsNoNull { - dict[key] = value - } - } - return dict - } - } - - // MARK: - Errors - - /// An error that is thrown when converting from `AnyObject` to `JSON`. - /// - SeeAlso: `JSON.init(ns:)` - public enum JSONFoundationError: Error { - /// Thrown when a non-JSON-compatible type is found. - case incompatibleType - /// Thrown when a dictionary has a key that is not a string. - case nonStringKey - } - - extension JSONError: LocalizedError { - public var errorDescription: String? { - return String(describing: self) - } - } - - extension JSONParserError: CustomNSError { - public static let errorDomain: String = "PMJSON.JSONParserError" - - public var errorCode: Int { - return code.rawValue - } - - public var errorUserInfo: [String: Any] { - return [NSLocalizedDescriptionKey: String(describing: self)] - } - } - - extension JSONDecoderError: LocalizedError { - public var failureReason: String? { - switch self { - case .streamEnded: return "The JSON event stream ended." - case .unexpectedToken: return "The JSON event stream contained more than one top-level value." - case .exceededDepthLimit: return "The JSON event stream exceeded the nesting depth limit." - } - } - } - - // MARK: - - - private struct UTF8Decoder: Sequence { - init(data: Data) { - self.data = data as NSData - } - - func makeIterator() -> Iterator { - return Iterator(data: data) - } - - private let data: NSData - - fileprivate struct Iterator: IteratorProtocol { - init(data: NSData) { - // NB: We use NSData instead of using Data's iterator because it's significantly faster as of Xcode 8b3 - self.data = data - let ptr = UnsafeBufferPointer(start: data.bytes.assumingMemoryBound(to: UInt8.self), count: data.length) - iter = ptr.makeIterator() - if ptr.count >= 3 && ptr[0] == 0xEF && ptr[1] == 0xBB && ptr[2] == 0xBF { - // UTF-8 BOM detected. Skip it. - _ = iter.next(); _ = iter.next(); _ = iter.next() - } - utf8 = UTF8() - } - - mutating func next() -> UnicodeScalar? { - switch utf8.decode(&iter) { - case .scalarValue(let scalar): return scalar - case .error: return "\u{FFFD}" - case .emptyInput: return nil - } - } - - private let data: NSData - private var iter: UnsafeBufferPointerIterator - private var utf8: UTF8 - } - } - - private struct UTF16Decoder: Sequence { - /// Checks if the data has a UTF-16 BOM, and if so, returns the endianness. - static func checkBOM(for data: Data) -> Endian? { - guard data.count >= 2 else { return nil } - switch (data[0], data[1]) { - case (0xFE, 0xFF): return .big - case (0xFF, 0xFE): return .little - default: return nil - } - } - - enum Endian { - case big - case little - } - - init(data: Data, endian: Endian) { - self.data = data as NSData - self.endian = endian - } - - func makeIterator() -> Iterator { - return Iterator(data: data, endian: endian) - } - - private let data: NSData - private let endian: Endian - - fileprivate struct Iterator: IteratorProtocol { - init(data: NSData, endian: Endian) { - iter = DataIterator(data: data, endian: endian) - utf16 = UTF16() - } - - mutating func next() -> UnicodeScalar? { - switch utf16.decode(&iter) { - case .scalarValue(let scalar): return scalar - case .error: return "\u{FFFD}" - case .emptyInput: return nil - } - } - - private var iter: DataIterator - private var utf16: UTF16 - } - - private struct DataIterator: IteratorProtocol { - init(data: NSData, endian: Endian) { - // NB: We use NSData instead of using Data's iterator because it's significantly faster as of Xcode 8b3 - self.data = data - self.endian = endian - let ptr = UnsafeBufferPointer(start: data.bytes.assumingMemoryBound(to: UInt16.self), count: data.length / 2) - iter = ptr.makeIterator() - if !ptr.isEmpty && (ptr[0] == 0xFEFF || ptr[0] == 0xFFFE) { - // Skip the BOM - _ = iter.next() - } - trailingFFFD = data.length % 2 == 1 - } - - mutating func next() -> UInt16? { - switch (iter.next(), endian) { - case (let x?, .big): return UInt16(bigEndian: x) - case (let x?, .little): return UInt16(littleEndian: x) - case (nil, _) where trailingFFFD: - trailingFFFD = false - return 0xFFFD - default: return nil - } - } - - private let data: NSData - private let endian: Endian - private var iter: UnsafeBufferPointerIterator - private var trailingFFFD: Bool - } - } - -#endif // os(iOS) || os(OSX) || os(watchOS) || os(tvOS) diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Parser.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Parser.swift deleted file mode 100755 index 0e1560be6..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/Parser.swift +++ /dev/null @@ -1,745 +0,0 @@ -// -// Decoder.swift -// PMJSON -// -// Created by Kevin Ballard on 10/8/15. -// Copyright © 2016 Postmates. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// - -#if os(Linux) - import Glibc -#else - import Darwin -#endif - -/// A streaming JSON parser that consumes a sequence of unicode scalars. -public struct JSONParser: Sequence where Seq.Iterator.Element == UnicodeScalar { - public init(_ seq: Seq, options: JSONParserOptions = []) { - base = seq - self.options = options - } - - /// Options to apply to the parser. - /// See `JSONParserOptions` for details. - var options: JSONParserOptions - - @available(*, deprecated, renamed: "options.strict") - public var strict: Bool { - get { return options.strict } - set { options.strict = newValue } - } - - @available(*, deprecated, renamed: "options.streaming") - public var streaming: Bool { - get { return options.streaming } - set { options.streaming = newValue } - } - - public func makeIterator() -> JSONParserIterator { - return JSONParserIterator(base.makeIterator(), options: options) - } - - private let base: Seq -} - - - -/// Options that can be used to configure a `JSONParser`. -public struct JSONParserOptions { - /// If `true`, the parser strictly conforms to RFC 7159. - /// If `false`, the parser accepts the following extensions: - /// - Trailing commas. - /// - Less restrictive about numbers, such as `-01` or `-.123`. - /// - /// The default value is `false`. - public var strict: Bool = false - - /// If `true`, the parser will parse a stream of json values with optional whitespace delimiters. - /// The default value of `false` makes the parser emit an error if there are any non-whitespace - /// characters after the first JSON value. - /// - /// For example, with the input `"[1] [2,3]"`, if `streaming` is `true` the parser will emit - /// events for the second JSON array after the first one, but if `streaming` is `false` it will - /// emit an error upon encountering the second `[`. - /// - /// - Note: If `streaming` is `true` and the input is empty (or contains only whitespace), the - /// parser will return `nil` instead of emitting an `.unexpectedEOF` error. - /// - /// The default value is `false`. - public var streaming: Bool = false - - /// Returns a new `JSONParserOptions` with default values. - public init() {} - - /// Returns a new `JSONParserOptions`. - /// - Parameter strict: Whether the parser should be strict. Defaults to `false`. - /// - Parameter streaming: Whether the parser should operate in streaming mode. Defaults to `false`. - public init(strict: Bool = false, streaming: Bool = false) { - self.strict = strict - self.streaming = streaming - } -} - -extension JSONParserOptions: ExpressibleByArrayLiteral { - public enum Element { - case strict - case streaming - } - - public init(arrayLiteral elements: Element...) { - for elt in elements { - switch elt { - case .strict: strict = true - case .streaming: streaming = true - } - } - } -} - -/// The iterator for `JSONParser`. -public struct JSONParserIterator: JSONEventIterator where Iter.Element == UnicodeScalar { - public init(_ iter: Iter, options: JSONParserOptions = []) { - base = PeekIterator(iter) - self.options = options - } - - /// Options to apply to the parser. - /// See `JSONParserOptions` for details. - public var options: JSONParserOptions - - @available(*, deprecated, renamed: "options.strict") - public var strict: Bool { - get { return options.strict } - set { options.strict = newValue } - } - - @available(*, deprecated, renamed: "options.strict") - public var streaming: Bool { - get { return options.streaming } - set { options.streaming = newValue } - } - - public mutating func next() -> JSONEvent? { - do { - // the only states that may loop are parseArrayComma, parseObjectComma, and (if streaming) parseEnd, - // which are all guaranteed to shift to other states (if they don't return) so the loop is finite - while true { - switch state { - case .parseArrayComma: - switch skipWhitespace() { - case ","?: - state = .parseArray(first: false) - continue - case "]"?: - try popStack() - return .arrayEnd - case .some: - throw error(.invalidSyntax) - case nil: - throw error(.unexpectedEOF) - } - case .parseObjectComma: - switch skipWhitespace() { - case ","?: - state = .parseObjectKey(first: false) - continue - case "}"?: - try popStack() - return .objectEnd - case .some: - throw error(.invalidSyntax) - case nil: - throw error(.unexpectedEOF) - } - case .initial: - guard let c = skipWhitespace() else { - if options.streaming { - state = .finished - return nil - } else { - throw error(.unexpectedEOF) - } - } - let evt = try parseValue(c) - switch evt { - case .arrayStart, .objectStart: - break - default: - state = .parseEnd - } - return evt - case .parseArray(let first): - guard let c = skipWhitespace() else { throw error(.unexpectedEOF) } - switch c { - case "]": - if !first && options.strict { - throw error(.trailingComma) - } - try popStack() - return .arrayEnd - case ",": - throw error(.missingValue) - default: - let evt = try parseValue(c) - switch evt { - case .arrayStart, .objectStart: - break - default: - state = .parseArrayComma - } - return evt - } - case .parseObjectKey(let first): - guard let c = skipWhitespace() else { throw error(.unexpectedEOF) } - switch c { - case "}": - if !first && options.strict { - throw error(.trailingComma) - } - try popStack() - return .objectEnd - case ",", ":": - throw error(.missingKey) - default: - let evt = try parseValue(c) - switch evt { - case .stringValue: - state = .parseObjectValue - default: - throw error(.nonStringKey) - } - return evt - } - case .parseObjectValue: - guard skipWhitespace() == ":" else { throw error(.expectedColon) } - guard let c = skipWhitespace() else { throw error(.unexpectedEOF) } - switch c { - case ",", "}": - throw error(.missingValue) - default: - let evt = try parseValue(c) - switch evt { - case .arrayStart, .objectStart: - break - default: - state = .parseObjectComma - } - return evt - } - case .parseEnd: - if options.streaming { - state = .initial - } else if skipWhitespace() != nil { - throw error(.trailingCharacters) - } else { - state = .finished - return nil - } - case .finished: - return nil - } - } - } catch let error as JSONParserError { - state = .finished - return .error(error) - } catch { - fatalError("unexpected error \(error)") - } - } - - private mutating func popStack() throws { - if stack.popLast() == nil { - fatalError("exhausted stack") - } - switch stack.last { - case .array?: - state = .parseArrayComma - case .object?: - state = .parseObjectComma - case nil: - state = .parseEnd - } - } - - private mutating func parseValue(_ c: UnicodeScalar) throws -> JSONEvent { - switch c { - case "[": - state = .parseArray(first: true) - stack.append(.array) - return .arrayStart - case "{": - state = .parseObjectKey(first: true) - stack.append(.object) - return .objectStart - case "\"": - var scalars = String.UnicodeScalarView() - while let c = bump() { - switch c { - case "\"": - return .stringValue(String(scalars)) - case "\\": - let c = try bumpRequired() - switch c { - case "\"", "\\", "/": scalars.append(c) - case "b": scalars.append(UnicodeScalar(0x8)) - case "f": scalars.append(UnicodeScalar(0xC)) - case "n": scalars.append("\n" as UnicodeScalar) - case "r": scalars.append("\r" as UnicodeScalar) - case "t": scalars.append("\t" as UnicodeScalar) - case "u": - let codeUnit = try parseFourHex() - if UTF16.isLeadSurrogate(codeUnit) { - guard try (bumpRequired() == "\\" && bumpRequired() == "u") else { - throw error(.invalidSurrogateEscape) - } - let trail = try parseFourHex() - if UTF16.isTrailSurrogate(trail) { - let lead = UInt32(codeUnit) - let trail = UInt32(trail) - // NB: The following is split up to avoid exponential time complexity in the type checker - let leadComponent: UInt32 = (lead - 0xD800) << 10 - let trailComponent: UInt32 = trail - 0xDC00 - let scalar = UnicodeScalar(leadComponent + trailComponent + 0x10000)! - scalars.append(scalar) - } else { - throw error(.invalidSurrogateEscape) - } - } else if let scalar = UnicodeScalar(codeUnit) { - scalars.append(scalar) - } else { - // Must be a lone trail surrogate - throw error(.invalidSurrogateEscape) - } - default: - throw error(.invalidEscape) - } - case "\0"..."\u{1F}": - throw error(.invalidSyntax) - default: - scalars.append(c) - } - } - throw error(.unexpectedEOF) - case "-", "0"..."9": - var tempBuffer: ContiguousArray - if let buffer = replace(&self.tempBuffer, with: nil) { - tempBuffer = buffer - tempBuffer.removeAll(keepingCapacity: true) - } else { - tempBuffer = ContiguousArray() - tempBuffer.reserveCapacity(12) - } - defer { self.tempBuffer = tempBuffer } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - if options.strict { - let digit: UnicodeScalar - if c == "-" { - guard let c2 = bump(), case "0"..."9" = c2 else { throw error(.invalidNumber) } - digit = c2 - tempBuffer.append(Int8(truncatingBitPattern: digit.value)) - } else { - digit = c - } - if digit == "0", case ("0"..."9")? = base.peek() { - // In strict mode, you can't have numbers like 01 - throw error(.invalidNumber) - } - } - /// Invoke this after parsing the "e" character. - @inline(__always) func parseExponent() throws -> Double { - let c = try bumpRequired() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - switch c { - case "-", "+": - guard let c = bump(), case "0"..."9" = c else { throw error(.invalidNumber) } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - case "0"..."9": break - default: throw error(.invalidNumber) - } - loop: while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - default: - break loop - } - } - tempBuffer.append(0) - return tempBuffer.withUnsafeBufferPointer({strtod($0.baseAddress, nil)}) - } - outerLoop: while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - case ".": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - guard let c = bump(), case "0"..."9" = c else { throw error(.invalidNumber) } - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - loop: while let c = base.peek() { - switch c { - case "0"..."9": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - case "e", "E": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - return try .doubleValue(parseExponent()) - default: - break loop - } - } - tempBuffer.append(0) - return .doubleValue(tempBuffer.withUnsafeBufferPointer({strtod($0.baseAddress, nil)})) - case "e", "E": - bump() - tempBuffer.append(Int8(truncatingBitPattern: c.value)) - return try .doubleValue(parseExponent()) - default: - break outerLoop - } - } - if tempBuffer.count == 1 && tempBuffer[0] == 0x2d /* - */ { - throw error(.invalidNumber) - } - tempBuffer.append(0) - let num = tempBuffer.withUnsafeBufferPointer({ ptr -> Int64? in - errno = 0 - let n = strtoll(ptr.baseAddress, nil, 10) - if n == 0 && errno != 0 { - return nil - } else { - return n - } - }) - if let num = num { - return .int64Value(num) - } - // out of range, fall back to Double - return .doubleValue(tempBuffer.withUnsafeBufferPointer({strtod($0.baseAddress, nil)})) - case "t": - let line = self.line, column = self.column - guard case "r"? = bump(), case "u"? = bump(), case "e"? = bump() else { - throw JSONParserError(code: .invalidSyntax, line: line, column: column) - } - return .booleanValue(true) - case "f": - let line = self.line, column = self.column - guard case "a"? = bump(), case "l"? = bump(), case "s"? = bump(), case "e"? = bump() else { - throw JSONParserError(code: .invalidSyntax, line: line, column: column) - } - return .booleanValue(false) - case "n": - let line = self.line, column = self.column - guard case "u"? = bump(), case "l"? = bump(), case "l"? = bump() else { - throw JSONParserError(code: .invalidSyntax, line: line, column: column) - } - return .nullValue - default: - throw error(.invalidSyntax) - } - } - - private mutating func skipWhitespace() -> UnicodeScalar? { - while let c = bump() { - switch c { - case " ", "\t", "\n", "\r": continue - default: return c - } - } - return nil - } - - private mutating func parseFourHex() throws -> UInt16 { - var codepoint: UInt32 = 0 - for _ in 0..<4 { - let c = try bumpRequired() - codepoint <<= 4 - switch c { - case "0"..."9": - codepoint += c.value - 48 - case "a"..."f": - codepoint += c.value - 87 - case "A"..."F": - codepoint += c.value - 55 - default: - throw error(.invalidEscape) - } - } - return UInt16(truncatingBitPattern: codepoint) - } - - @inline(__always) @discardableResult private mutating func bump() -> UnicodeScalar? { - let c = base.next() - if c == "\n" { - line += 1 - column = 0 - } else { - column += 1 - } - return c - } - - @inline(__always) private mutating func bumpRequired() throws -> UnicodeScalar { - guard let c = bump() else { throw error(.unexpectedEOF) } - return c - } - - private func error(_ code: JSONParserError.Code) -> JSONParserError { - return JSONParserError(code: code, line: line, column: column) - } - - /// The line of the last emitted token. - public private(set) var line: UInt = 0 - /// The column of the last emitted token. - public private(set) var column: UInt = 0 - - private var base: PeekIterator - private var state: State = .initial - private var stack: [Stack] = [] - private var tempBuffer: ContiguousArray? -} - -@available(*, renamed: "JSONParserIterator") -typealias JSONParserGenerator = JSONParserIterator where Gen.Element == UnicodeScalar - -private enum State { - /// Initial state - case initial - /// Parse an element or the end of the array - case parseArray(first: Bool) - /// Parse a comma or the end of the array - case parseArrayComma - /// Parse an object key or the end of the array - case parseObjectKey(first: Bool) - /// Parse a colon followed by an object value - case parseObjectValue - /// Parse a comma or the end of the object - case parseObjectComma - /// Parse whitespace or EOF - case parseEnd - /// Parsing has completed - case finished -} - -private enum Stack { - case array - case object -} - -/// A streaming JSON parser event. -public enum JSONEvent: Hashable { - /// The start of an object. - /// Inside of an object, each key/value pair is emitted as a - /// `StringValue` for the key followed by the `JSONEvent` sequence - /// that describes the value. - case objectStart - /// The end of an object. - case objectEnd - /// The start of an array. - case arrayStart - /// The end of an array. - case arrayEnd - /// A boolean value. - case booleanValue(Bool) - /// A signed 64-bit integral value. - case int64Value(Int64) - /// A double value. - case doubleValue(Double) - /// A string value. - case stringValue(String) - /// The null value. - case nullValue - /// A parser error. - case error(JSONParserError) - - public var hashValue: Int { - switch self { - case .objectStart: return 1 - case .objectEnd: return 2 - case .arrayStart: return 3 - case .arrayEnd: return 4 - case .booleanValue(let b): return b.hashValue << 4 + 5 - case .int64Value(let i): return i.hashValue << 4 + 6 - case .doubleValue(let d): return d.hashValue << 4 + 7 - case .stringValue(let s): return s.hashValue << 4 + 8 - case .nullValue: return 9 - case .error(let error): return error.hashValue << 4 + 10 - } - } - - public static func ==(lhs: JSONEvent, rhs: JSONEvent) -> Bool { - switch (lhs, rhs) { - case (.objectStart, .objectStart), (.objectEnd, .objectEnd), - (.arrayStart, .arrayStart), (.arrayEnd, .arrayEnd), (.nullValue, .nullValue): - return true - case let (.booleanValue(a), .booleanValue(b)): - return a == b - case let (.int64Value(a), .int64Value(b)): - return a == b - case let (.doubleValue(a), .doubleValue(b)): - return a == b - case let (.stringValue(a), .stringValue(b)): - return a == b - case let (.error(a), .error(b)): - return a == b - default: - return false - } - } -} - -/// An iterator of `JSONEvent`s that records column/line info. -public protocol JSONEventIterator: IteratorProtocol { - /// The line of the last emitted token. - var line: UInt { get } - /// The column of the last emitted token. - var column: UInt { get } -} - -@available(*, renamed: "JSONEventIterator") -public typealias JSONEventGenerator = JSONEventIterator - -public struct JSONParserError: Error, Hashable, CustomStringConvertible { - /// A generic syntax error. - public static let invalidSyntax: Code = .invalidSyntax - /// An invalid number. - public static let invalidNumber: Code = .invalidNumber - /// An invalid string escape. - public static let invalidEscape: Code = .invalidEscape - /// A unicode string escape with an invalid code point. - public static let invalidUnicodeScalar: Code = .invalidUnicodeScalar - /// A unicode string escape representing a leading surrogate that wasn't followed - /// by a trailing surrogate, or a trailing surrogate that wasn't preceeded - /// by a leading surrogate. - public static let invalidSurrogateEscape: Code = .invalidSurrogateEscape - /// A control character in a string. - public static let controlCharacterInString: Code = .controlCharacterInString - /// A comma was found where a colon was expected in an object. - public static let expectedColon: Code = .expectedColon - /// A comma or colon was found in an object without a key. - public static let missingKey: Code = .missingKey - /// An object key was found that was not a string. - public static let nonStringKey: Code = .nonStringKey - /// A comma or object end was encountered where a value was expected. - public static let missingValue: Code = .missingValue - /// A trailing comma was found in an array or object. Only emitted when the parser is in strict mode. - public static let trailingComma: Code = .trailingComma - /// Trailing (non-whitespace) characters found after the close - /// of the root value. - /// - Note: This error cannot be thrown if the parser is in streaming mode. - public static let trailingCharacters: Code = .trailingCharacters - /// EOF was found before the root value finished parsing. - public static let unexpectedEOF: Code = .unexpectedEOF - - @available(*, unavailable, renamed: "invalidSurrogateEscape") - public static let loneLeadingSurrogateInUnicodeEscape: Code = .invalidSurrogateEscape - - public let code: Code - public let line: UInt - public let column: UInt - - public init(code: Code, line: UInt, column: UInt) { - self.code = code - self.line = line - self.column = column - } - - public var _code: Int { return code.rawValue } - - public enum Code: Int { - /// A generic syntax error. - case invalidSyntax - /// An invalid number. - case invalidNumber - /// An invalid string escape. - case invalidEscape - /// A unicode string escape with an invalid code point. - case invalidUnicodeScalar - /// A unicode string escape representing a leading surrogate that wasn't followed - /// by a trailing surrogate, or a trailing surrogate that wasn't preceeded - /// by a leading surrogate. - case invalidSurrogateEscape - /// A control character in a string. - case controlCharacterInString - /// A comma was found where a colon was expected in an object. - case expectedColon - /// A comma or colon was found in an object without a key. - case missingKey - /// An object key was found that was not a string. - case nonStringKey - /// A comma or object end was encountered where a value was expected. - case missingValue - /// A trailing comma was found in an array or object. Only emitted when the parser is in strict mode. - case trailingComma - /// Trailing (non-whitespace) characters found after the close - /// of the root value. - /// - Note: This error cannot be thrown if the parser is in streaming mode. - case trailingCharacters - /// EOF was found before the root value finished parsing. - case unexpectedEOF - - @available(*, unavailable, renamed: "invalidSurrogateEscape") - static let loneLeadingSurrogateInUnicodeEscape: Code = .invalidSurrogateEscape - - public static func ~=(lhs: Code, rhs: Error) -> Bool { - if let error = rhs as? JSONParserError { - return lhs == error.code - } else { - return false - } - } - } - - public var description: String { - return "JSONParserError(\(code), line: \(line), column: \(column))" - } - - public var hashValue: Int { - return Int(bitPattern: line << 18) ^ Int(bitPattern: column << 4) ^ code.rawValue - } - - public static func ==(lhs: JSONParserError, rhs: JSONParserError) -> Bool { - return (lhs.code, lhs.line, lhs.column) == (rhs.code, rhs.line, rhs.column) - } -} - -private struct PeekIterator { - init(_ base: Base) { - self.base = base - } - - mutating func peek() -> Base.Element? { - if let elt = peeked { - return elt - } - let elt = base.next() - peeked = .some(elt) - return elt - } - - mutating func next() -> Base.Element? { - if let elt = peeked { - peeked = nil - return elt - } - return base.next() - } - - private var base: Base - private var peeked: Base.Element?? -} - -private func replace(_ a: inout T, with b: T) -> T { - var b = b - swap(&a, &b) - return b -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/bin/test_PMJSON b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/bin/test_PMJSON deleted file mode 100755 index 5379441a2..000000000 Binary files a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/bin/test_PMJSON and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.pbxproj deleted file mode 100644 index df7c6e7f9..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.pbxproj +++ /dev/null @@ -1,296 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 035C82521DC13EED00CDC48D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82511DC13EED00CDC48D /* main.swift */; }; - 035C82611DC13F1B00CDC48D /* Accessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82581DC13F1B00CDC48D /* Accessors.swift */; }; - 035C82621DC13F1B00CDC48D /* DecimalNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82591DC13F1B00CDC48D /* DecimalNumber.swift */; }; - 035C82631DC13F1B00CDC48D /* Decoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825A1DC13F1B00CDC48D /* Decoder.swift */; }; - 035C82641DC13F1B00CDC48D /* Encoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825B1DC13F1B00CDC48D /* Encoder.swift */; }; - 035C82651DC13F1B00CDC48D /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825C1DC13F1B00CDC48D /* JSON.swift */; }; - 035C82661DC13F1B00CDC48D /* JSONError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825D1DC13F1B00CDC48D /* JSONError.swift */; }; - 035C82671DC13F1B00CDC48D /* JSONObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825E1DC13F1B00CDC48D /* JSONObject.swift */; }; - 035C82681DC13F1B00CDC48D /* ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C825F1DC13F1B00CDC48D /* ObjectiveC.swift */; }; - 035C82691DC13F1B00CDC48D /* Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C82601DC13F1B00CDC48D /* Parser.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 035C824C1DC13EED00CDC48D /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 035C824E1DC13EED00CDC48D /* test_PMJSON */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_PMJSON; sourceTree = BUILT_PRODUCTS_DIR; }; - 035C82511DC13EED00CDC48D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 035C82581DC13F1B00CDC48D /* Accessors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Accessors.swift; sourceTree = ""; }; - 035C82591DC13F1B00CDC48D /* DecimalNumber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecimalNumber.swift; sourceTree = ""; }; - 035C825A1DC13F1B00CDC48D /* Decoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Decoder.swift; sourceTree = ""; }; - 035C825B1DC13F1B00CDC48D /* Encoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Encoder.swift; sourceTree = ""; }; - 035C825C1DC13F1B00CDC48D /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSON.swift; sourceTree = ""; }; - 035C825D1DC13F1B00CDC48D /* JSONError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONError.swift; sourceTree = ""; }; - 035C825E1DC13F1B00CDC48D /* JSONObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONObject.swift; sourceTree = ""; }; - 035C825F1DC13F1B00CDC48D /* ObjectiveC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectiveC.swift; sourceTree = ""; }; - 035C82601DC13F1B00CDC48D /* Parser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Parser.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 035C824B1DC13EED00CDC48D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 035C82451DC13EED00CDC48D = { - isa = PBXGroup; - children = ( - 035C82581DC13F1B00CDC48D /* Accessors.swift */, - 035C82591DC13F1B00CDC48D /* DecimalNumber.swift */, - 035C825A1DC13F1B00CDC48D /* Decoder.swift */, - 035C825B1DC13F1B00CDC48D /* Encoder.swift */, - 035C825C1DC13F1B00CDC48D /* JSON.swift */, - 035C825D1DC13F1B00CDC48D /* JSONError.swift */, - 035C825E1DC13F1B00CDC48D /* JSONObject.swift */, - 035C825F1DC13F1B00CDC48D /* ObjectiveC.swift */, - 035C82601DC13F1B00CDC48D /* Parser.swift */, - 035C82501DC13EED00CDC48D /* test_PMJSON */, - 035C824F1DC13EED00CDC48D /* Products */, - ); - sourceTree = ""; - }; - 035C824F1DC13EED00CDC48D /* Products */ = { - isa = PBXGroup; - children = ( - 035C824E1DC13EED00CDC48D /* test_PMJSON */, - ); - name = Products; - sourceTree = ""; - }; - 035C82501DC13EED00CDC48D /* test_PMJSON */ = { - isa = PBXGroup; - children = ( - 035C82511DC13EED00CDC48D /* main.swift */, - ); - path = test_PMJSON; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 035C824D1DC13EED00CDC48D /* test_PMJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = 035C82551DC13EED00CDC48D /* Build configuration list for PBXNativeTarget "test_PMJSON" */; - buildPhases = ( - 035C824A1DC13EED00CDC48D /* Sources */, - 035C824B1DC13EED00CDC48D /* Frameworks */, - 035C824C1DC13EED00CDC48D /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_PMJSON; - productName = test_PMJSON; - productReference = 035C824E1DC13EED00CDC48D /* test_PMJSON */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 035C82461DC13EED00CDC48D /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 035C824D1DC13EED00CDC48D = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 035C82491DC13EED00CDC48D /* Build configuration list for PBXProject "test_PMJSON" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 035C82451DC13EED00CDC48D; - productRefGroup = 035C824F1DC13EED00CDC48D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 035C824D1DC13EED00CDC48D /* test_PMJSON */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 035C824A1DC13EED00CDC48D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 035C82611DC13F1B00CDC48D /* Accessors.swift in Sources */, - 035C82661DC13F1B00CDC48D /* JSONError.swift in Sources */, - 035C82691DC13F1B00CDC48D /* Parser.swift in Sources */, - 035C82521DC13EED00CDC48D /* main.swift in Sources */, - 035C82641DC13F1B00CDC48D /* Encoder.swift in Sources */, - 035C82671DC13F1B00CDC48D /* JSONObject.swift in Sources */, - 035C82651DC13F1B00CDC48D /* JSON.swift in Sources */, - 035C82631DC13F1B00CDC48D /* Decoder.swift in Sources */, - 035C82621DC13F1B00CDC48D /* DecimalNumber.swift in Sources */, - 035C82681DC13F1B00CDC48D /* ObjectiveC.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 035C82531DC13EED00CDC48D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 035C82541DC13EED00CDC48D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 035C82561DC13EED00CDC48D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 035C82571DC13EED00CDC48D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 035C82491DC13EED00CDC48D /* Build configuration list for PBXProject "test_PMJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035C82531DC13EED00CDC48D /* Debug */, - 035C82541DC13EED00CDC48D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 035C82551DC13EED00CDC48D /* Build configuration list for PBXNativeTarget "test_PMJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035C82561DC13EED00CDC48D /* Debug */, - 035C82571DC13EED00CDC48D /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 035C82461DC13EED00CDC48D /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index a539b94c6..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index dfaf589fc..000000000 Binary files a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_PMJSON.xcscheme b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_PMJSON.xcscheme deleted file mode 100644 index f7dc9e855..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_PMJSON.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 650243533..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_PMJSON.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 035C824D1DC13EED00CDC48D - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON/main.swift b/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON/main.swift deleted file mode 100644 index a57f13ea1..000000000 --- a/tests/JSONTestSuite/parsers/test_PMJSON_1_2_0/test_PMJSON/main.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// main.swift -// test_PMJSON -// -// Created by nst on 26.10.16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard ProcessInfo.processInfo.arguments.count == 2 else { - let url = URL(fileURLWithPath: ProcessInfo.processInfo.arguments[0]) - let programName = url.lastPathComponent - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = ProcessInfo.processInfo.arguments[1] - let url = NSURL.fileURL(withPath:path) - - do { - let data = try Data(contentsOf:url) - - - do { - let json = try JSON.decode(data) - - guard json != nil else { - exit(1) - } - - exit(0) - } catch let e { - print(e) - exit(1) - } - } catch let e { - print("*** CANNOT READ DATA AT \(url)") - print(e) - exit(1) - } -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4.h deleted file mode 100755 index f996ed489..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2009-2011 Stig Brautaset. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "SBJson4Writer.h" -#import "SBJson4StreamParser.h" -#import "SBJson4Parser.h" -#import "SBJson4StreamWriter.h" -#import "SBJson4StreamTokeniser.h" - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Parser.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Parser.h deleted file mode 100755 index 837b2b4af..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Parser.h +++ /dev/null @@ -1,248 +0,0 @@ -/* - Copyright (c) 2010-2013, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import -#import "SBJson4StreamParser.h" - -/** - Block called when the parser has parsed an item. This could be once - for each root document parsed, or once for each unwrapped root array element. - - @param item contains the parsed item. - @param stop set to YES if you want the parser to stop - */ -typedef void (^SBJson4ValueBlock)(id item, BOOL* stop); - -/** - Block called if an error occurs. - @param error the error. - */ -typedef void (^SBJson4ErrorBlock)(NSError* error); - -/** - Block used to process parsed tokens as they are encountered. You can use this - to transform strings containing dates into NSDate, for example. - @param item the parsed token - @param path the JSON Path of the token - */ -typedef id (^SBJson4ProcessBlock)(id item, NSString* path); - - -/** - Parse one or more chunks of JSON data. - - Using this class directly you can reduce the apparent latency for each - download/parse cycle of documents over a slow connection. You can start - parsing *and return chunks of the parsed document* before the entire - document is downloaded. - - Using this class is also useful to parse huge documents on disk - bit by bit so you don't have to keep them all in memory. - - JSON is mapped to Objective-C types in the following way: - - - null -> NSNull - - string -> NSString - - array -> NSMutableArray - - object -> NSMutableDictionary - - true -> NSNumber's -numberWithBool:YES - - false -> NSNumber's -numberWithBool:NO - - number -> NSNumber - - Since Objective-C doesn't have a dedicated class for boolean values, - these turns into NSNumber instances. However, since these are - initialised with the -initWithBool: method they round-trip back to JSON - properly. In other words, they won't silently suddenly become 0 or 1; - they'll be represented as 'true' and 'false' again. - - Integers are parsed into either a `long long` or `unsigned long long` - type if they fit, else a `double` is used. All real & exponential numbers - are represented using a `double`. Previous versions of this library used - an NSDecimalNumber in some cases, but this is no longer the case. - - The default behaviour is that your passed-in block is only called once the - entire input is parsed. If you set supportManyDocuments to YES and your input - contains multiple (whitespace limited) JSON documents your block will be called - for each document: - - SBJson4ValueBlock block = ^(id v, BOOL *stop) { - BOOL isArray = [v isKindOfClass:[NSArray class]]; - NSLog(@"Found: %@", isArray ? @"Array" : @"Object"); - }; - - SBJson4ErrorBlock eh = ^(NSError* err) { - NSLog(@"OOPS: %@", err); - }; - - id parser = [SBJson4Parser multiRootParserWithBlock:block - errorHandler:eh]; - - // Note that this input contains multiple top-level JSON documents - id data = [@"[]{}" dataWithEncoding:NSUTF8StringEncoding]; - [parser parse:data]; - [parser parse:data]; - - The above example will print: - - - Found: Array - - Found: Object - - Found: Array - - Found: Object - - Often you won't have control over the input you're parsing, so can't make use - of this feature. But, all is not lost: if you are parsing a long array you can - get the same effect by setting rootArrayItems to YES: - - id parser = [SBJson4Parser unwrapRootArrayParserWithBlock:block - errorHandler:eh]; - - // Note that this input contains A SINGLE top-level document - id data = [@"[[],{},[],{}]" dataWithEncoding:NSUTF8StringEncoding]; - [parser parse:data]; - - @note Stream based parsing does mean that you lose some of the correctness - verification you would have with a parser that considered the entire input - before returning an answer. It is technically possible to have some parts - of a document returned *as if they were correct* but then encounter an error - in a later part of the document. You should keep this in mind when - considering whether it would suit your application. - - -*/ -@interface SBJson4Parser : NSObject - -/** - Create a JSON Parser. - - This can be used to create a parser that accepts only one document, or one that parses - many documents any - - @param block Called for each element. Set *stop to `YES` if you have seen - enough and would like to skip the rest of the elements. - - @param allowMultiRoot Indicate that you are expecting multiple whitespace-separated - JSON documents, similar to what Twitter uses. - - @param unwrapRootArray If set the parser will pretend an root array does not exist - and the enumerator block will be called once for each item in it. This option - does nothing if the the JSON has an object at its root. - - @param eh Called if the parser encounters an error. - - @see -unwrapRootArrayParserWithBlock:errorHandler: - @see -multiRootParserWithBlock:errorHandler: - @see -initWithBlock:processBlock:multiRoot:unwrapRootArray:maxDepth:errorHandler: - - */ -+ (id)parserWithBlock:(SBJson4ValueBlock)block - allowMultiRoot:(BOOL)allowMultiRoot - unwrapRootArray:(BOOL)unwrapRootArray - errorHandler:(SBJson4ErrorBlock)eh; - - -/** - Create a JSON Parser that parses multiple whitespace separated documents. - This is useful for something like Twitter's feed, which gives you one JSON - document per line. - - @param block Called for each element. Set *stop to `YES` if you have seen - enough and would like to skip the rest of the elements. - - @param eh Called if the parser encounters an error. - - @see +unwrapRootArrayParserWithBlock:errorHandler: - @see +parserWithBlock:allowMultiRoot:unwrapRootArray:errorHandler: - @see -initWithBlock:processBlock:multiRoot:unwrapRootArray:maxDepth:errorHandler: - */ -+ (id)multiRootParserWithBlock:(SBJson4ValueBlock)block - errorHandler:(SBJson4ErrorBlock)eh; - -/** - Create a JSON Parser that parses a huge array and calls for the value block for - each element in the outermost array. - - @param block Called for each element. Set *stop to `YES` if you have seen - enough and would like to skip the rest of the elements. - - @param eh Called if the parser encounters an error. - - @see +multiRootParserWithBlock:errorHandler: - @see +parserWithBlock:allowMultiRoot:unwrapRootArray:errorHandler: - @see -initWithBlock:processBlock:multiRoot:unwrapRootArray:maxDepth:errorHandler: - */ -+ (id)unwrapRootArrayParserWithBlock:(SBJson4ValueBlock)block - errorHandler:(SBJson4ErrorBlock)eh; - -/** - Create a JSON Parser. - - @param block Called for each element. Set *stop to `YES` if you have seen - enough and would like to skip the rest of the elements. - - @param processBlock A block that allows you to process individual values before being - returned. - - @param multiRoot Indicate that you are expecting multiple whitespace-separated - JSON documents, similar to what Twitter uses. - - @param unwrapRootArray If set the parser will pretend an root array does not exist - and the enumerator block will be called once for each item in it. This option - does nothing if the the JSON has an object at its root. - - @param maxDepth The max recursion depth of the parser. Defaults to 32. - - @param eh Called if the parser encounters an error. - - */ -- (id)initWithBlock:(SBJson4ValueBlock)block - processBlock:(SBJson4ProcessBlock)processBlock - multiRoot:(BOOL)multiRoot - unwrapRootArray:(BOOL)unwrapRootArray - maxDepth:(NSUInteger)maxDepth - errorHandler:(SBJson4ErrorBlock)eh; - -/** - Parse some JSON - - The JSON is assumed to be UTF8 encoded. This can be a full JSON document, or a part of one. - - @param data An NSData object containing the next chunk of JSON - - @return - - SBJson4ParserComplete if a full document was found - - SBJson4ParserWaitingForData if a partial document was found and more data is required to complete it - - SBJson4ParserError if an error occurred. - - */ -- (SBJson4ParserStatus)parse:(NSData*)data; - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Parser.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Parser.m deleted file mode 100755 index 32fb81d72..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Parser.m +++ /dev/null @@ -1,287 +0,0 @@ -/* - Copyright (c) 2010-2013, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "SBJson4Parser.h" - -@interface SBJson4Parser () - -- (void)pop; - -@end - -typedef enum { - SBJson4ChunkNone, - SBJson4ChunkArray, - SBJson4ChunkObject, -} SBJson4ChunkType; - -@implementation SBJson4Parser { - SBJson4StreamParser *_parser; - NSUInteger depth; - NSMutableArray *array; - NSMutableDictionary *dict; - NSMutableArray *keyStack; - NSMutableArray *stack; - NSMutableArray *path; - SBJson4ProcessBlock processBlock; - SBJson4ErrorBlock errorHandler; - SBJson4ValueBlock valueBlock; - SBJson4ChunkType currentType; - BOOL supportManyDocuments; - BOOL supportPartialDocuments; - NSUInteger _maxDepth; -} - -#pragma mark Housekeeping - -- (id)init { - @throw @"Not Implemented"; -} - -+ (id)multiRootParserWithBlock:(SBJson4ValueBlock)block errorHandler:(SBJson4ErrorBlock)eh { - return [self parserWithBlock:block - allowMultiRoot:YES - unwrapRootArray:NO - errorHandler:eh]; -} - -+ (id)unwrapRootArrayParserWithBlock:(SBJson4ValueBlock)block errorHandler:(SBJson4ErrorBlock)eh { - return [self parserWithBlock:block - allowMultiRoot:NO - unwrapRootArray:YES - errorHandler:eh]; -} - -+ (id)parserWithBlock:(SBJson4ValueBlock)block - allowMultiRoot:(BOOL)allowMultiRoot - unwrapRootArray:(BOOL)unwrapRootArray - errorHandler:(SBJson4ErrorBlock)eh { - - return [[self alloc] initWithBlock:block - processBlock:nil - multiRoot:allowMultiRoot - unwrapRootArray:unwrapRootArray - maxDepth:32 - errorHandler:eh]; -} - -- (id)initWithBlock:(SBJson4ValueBlock)block - processBlock:(SBJson4ProcessBlock)initialProcessBlock - multiRoot:(BOOL)multiRoot - unwrapRootArray:(BOOL)unwrapRootArray - maxDepth:(NSUInteger)maxDepth - errorHandler:(SBJson4ErrorBlock)eh { - - self = [super init]; - if (self) { - _parser = [[SBJson4StreamParser alloc] init]; - _parser.delegate = self; - - supportManyDocuments = multiRoot; - supportPartialDocuments = unwrapRootArray; - - valueBlock = block; - keyStack = [[NSMutableArray alloc] initWithCapacity:32]; - stack = [[NSMutableArray alloc] initWithCapacity:32]; - if (initialProcessBlock) - path = [[NSMutableArray alloc] initWithCapacity:32]; - processBlock = initialProcessBlock; - errorHandler = eh ? eh : ^(NSError*err) { NSLog(@"%@", err); }; - currentType = SBJson4ChunkNone; - _maxDepth = maxDepth; - } - return self; -} - - -#pragma mark Private methods - -- (void)pop { - [stack removeLastObject]; - array = nil; - dict = nil; - currentType = SBJson4ChunkNone; - - id value = [stack lastObject]; - - if ([value isKindOfClass:[NSArray class]]) { - array = value; - currentType = SBJson4ChunkArray; - } else if ([value isKindOfClass:[NSDictionary class]]) { - dict = value; - currentType = SBJson4ChunkObject; - } -} - -- (void)parserFound:(id)obj isValue:(BOOL)isValue { - NSParameterAssert(obj); - - if(processBlock&&path) { - if(isValue) { - obj = processBlock(obj,[NSString stringWithFormat:@"%@.%@",[self pathString],[keyStack lastObject]]); - } - else { - [path removeLastObject]; - } - } - - switch (currentType) { - case SBJson4ChunkArray: - [array addObject:obj]; - break; - - case SBJson4ChunkObject: - NSParameterAssert(keyStack.count); - [dict setObject:obj forKey:[keyStack lastObject]]; - [keyStack removeLastObject]; - break; - - case SBJson4ChunkNone: { - __block BOOL stop = NO; - valueBlock(obj, &stop); - if (stop) [_parser stop]; - } - break; - - default: - break; - } -} - - -#pragma mark Delegate methods - -- (void)parserFoundObjectStart { - ++depth; - if (depth > _maxDepth) - [self maxDepthError]; - - if (path) - [self addToPath]; - dict = [NSMutableDictionary new]; - [stack addObject:dict]; - currentType = SBJson4ChunkObject; -} - -- (void)parserFoundObjectKey:(NSString *)key_ { - [keyStack addObject:key_]; -} - -- (void)parserFoundObjectEnd { - depth--; - id value = dict; - [self pop]; - [self parserFound:value isValue:NO ]; -} - -- (void)parserFoundArrayStart { - depth++; - if (depth > _maxDepth) - [self maxDepthError]; - - if (depth > 1 || !supportPartialDocuments) { - if(path) - [self addToPath]; - array = [NSMutableArray new]; - [stack addObject:array]; - currentType = SBJson4ChunkArray; - } -} - -- (void)parserFoundArrayEnd { - depth--; - if (depth > 1 || !supportPartialDocuments) { - id value = array; - [self pop]; - [self parserFound:value isValue:NO ]; - } -} - -- (void)maxDepthError { - id ui = @{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Input depth exceeds max depth of %lu", (unsigned long)_maxDepth]}; - errorHandler([NSError errorWithDomain:@"org.sbjson.parser" code:3 userInfo:ui]); - [_parser stop]; -} - -- (void)parserFoundBoolean:(BOOL)x { - [self parserFound:[NSNumber numberWithBool:x] isValue:YES ]; -} - -- (void)parserFoundNull { - [self parserFound:[NSNull null] isValue:YES ]; -} - -- (void)parserFoundNumber:(NSNumber *)num { - [self parserFound:num isValue:YES ]; -} - -- (void)parserFoundString:(NSString *)string { - [self parserFound:string isValue:YES ]; -} - -- (void)parserFoundError:(NSError *)err { - errorHandler(err); -} - -- (void)addToPath { - if([path count]==0) - [path addObject:@"$"]; - else if([[stack lastObject] isKindOfClass:[NSArray class]]) - [path addObject:@([[stack lastObject] count])]; - else - [path addObject:[keyStack lastObject]]; -} - -- (NSString *)pathString { - NSMutableString *pathString = [NSMutableString stringWithString:@"$"]; - for(NSUInteger i=1;i<[path count];i++) { - if([[path objectAtIndex:i] isKindOfClass:[NSNumber class]]) - [pathString appendString:[NSString stringWithFormat:@"[%@]",[path objectAtIndex:i]]]; - else - [pathString appendString:[NSString stringWithFormat:@".%@",[path objectAtIndex:i]]]; - } - return pathString; -} - -- (BOOL)parserShouldSupportManyDocuments { - return supportManyDocuments; -} - -- (SBJson4ParserStatus)parse:(NSData *)data { - return [_parser parse:data]; -} - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParser.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParser.h deleted file mode 100755 index ff810993f..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParser.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (c) 2010-2013, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class SBJson4StreamParser; -@class SBJson4StreamParserState; - -typedef enum { - SBJson4ParserComplete, - SBJson4ParserStopped, - SBJson4ParserWaitingForData, - SBJson4ParserError, -} SBJson4ParserStatus; - - -/** - Delegate for interacting directly with the low-level parser - - You will most likely find it much more convenient to use the SBJson4Parser instead. - */ -@protocol SBJson4StreamParserDelegate < NSObject > - -/// Called when object start is found -- (void)parserFoundObjectStart; - -/// Called when object key is found -- (void)parserFoundObjectKey:(NSString *)key; - -/// Called when object end is found -- (void)parserFoundObjectEnd; - -/// Called when array start is found -- (void)parserFoundArrayStart; - -/// Called when array end is found -- (void)parserFoundArrayEnd; - -/// Called when a boolean value is found -- (void)parserFoundBoolean:(BOOL)x; - -/// Called when a null value is found -- (void)parserFoundNull; - -/// Called when a number is found -- (void)parserFoundNumber:(NSNumber *)num; - -/// Called when a string is found -- (void)parserFoundString:(NSString *)string; - -/// Called when an error occurs -- (void)parserFoundError:(NSError *)err; - -@optional - -/// Called to determine whether to allow multiple whitespace-separated documents -- (BOOL)parserShouldSupportManyDocuments; - -@end - -/** - Low-level Stream parser - - You most likely want to use the SBJson4Parser instead, but if you - really need low-level access to tokens one-by-one you can use this class. - */ -@interface SBJson4StreamParser : NSObject - -@property (nonatomic, weak) SBJson4StreamParserState *state; // Private - -/** - Delegate to receive messages - - The object set here receives a series of messages as the parser breaks down the JSON stream - into valid tokens. - - Usually this should be an instance of SBJson4Parser, but you can - substitute your own implementation of the SBJson4StreamParserDelegate protocol if you need to. - */ -@property (nonatomic, weak) id delegate; - -/** - Parse some JSON - - The JSON is assumed to be UTF8 encoded. This can be a full JSON document, or a part of one. - - @param data An NSData object containing the next chunk of JSON - - @return - - SBJson4ParserComplete if a full document was found - - SBJson4ParserWaitingForData if a partial document was found and more data is required to complete it - - SBJson4ParserError if an error occurred. - - */ -- (SBJson4ParserStatus)parse:(NSData*)data; - -/** - Call this to cause parsing to stop. - */ -- (void)stop; - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParser.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParser.m deleted file mode 100755 index 9571914aa..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParser.m +++ /dev/null @@ -1,317 +0,0 @@ -/* - Copyright (c) 2010, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "SBJson4StreamParser.h" -#import "SBJson4StreamTokeniser.h" -#import "SBJson4StreamParserState.h" - -#define SBStringIsSurrogateHighCharacter(character) ((character >= 0xD800UL) && (character <= 0xDBFFUL)) - -@implementation SBJson4StreamParser { -@private - SBJson4StreamTokeniser *tokeniser; - BOOL stopped; - NSMutableArray *_stateStack; -} - -#pragma mark Housekeeping - -- (id)init { - self = [super init]; - if (self) { - _stateStack = [[NSMutableArray alloc] initWithCapacity:32]; - _state = [SBJson4StreamParserStateStart sharedInstance]; - tokeniser = [[SBJson4StreamTokeniser alloc] init]; - } - return self; -} - - -#pragma mark Methods - -- (NSString*)tokenName:(sbjson4_token_t)token { - switch (token) { - case sbjson4_token_array_open: - return @"start of array"; - - case sbjson4_token_array_close: - return @"end of array"; - - case sbjson4_token_integer: - case sbjson4_token_real: - return @"number"; - - case sbjson4_token_string: - case sbjson4_token_encoded: - return @"string"; - - case sbjson4_token_bool: - return @"boolean"; - - case sbjson4_token_null: - return @"null"; - - case sbjson4_token_entry_sep: - return @"key-value separator"; - - case sbjson4_token_value_sep: - return @"value separator"; - - case sbjson4_token_object_open: - return @"start of object"; - - case sbjson4_token_object_close: - return @"end of object"; - - case sbjson4_token_eof: - case sbjson4_token_error: - break; - } - NSAssert(NO, @"Should not get here"); - return @""; -} - -- (void)handleObjectStart { - [_delegate parserFoundObjectStart]; - [_stateStack addObject:_state]; - _state = [SBJson4StreamParserStateObjectStart sharedInstance]; -} - -- (void)handleObjectEnd: (sbjson4_token_t) tok { - _state = [_stateStack lastObject]; - [_stateStack removeLastObject]; - [_state parser:self shouldTransitionTo:tok]; - [_delegate parserFoundObjectEnd]; -} - -- (void)handleArrayStart { - [_delegate parserFoundArrayStart]; - [_stateStack addObject:_state]; - _state = [SBJson4StreamParserStateArrayStart sharedInstance]; -} - -- (void)handleArrayEnd: (sbjson4_token_t) tok { - _state = [_stateStack lastObject]; - [_stateStack removeLastObject]; - [_state parser:self shouldTransitionTo:tok]; - [_delegate parserFoundArrayEnd]; -} - -- (void) handleTokenNotExpectedHere: (sbjson4_token_t) tok { - NSString *tokenName = [self tokenName:tok]; - NSString *stateName = [_state name]; - - _state = [SBJson4StreamParserStateError sharedInstance]; - id ui = @{ NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Token '%@' not expected %@", tokenName, stateName]}; - [_delegate parserFoundError:[NSError errorWithDomain:@"org.sbjson.parser" code:2 userInfo:ui]]; -} - -- (SBJson4ParserStatus)parse:(NSData *)data_ { - @autoreleasepool { - [tokeniser appendData:data_]; - - for (;;) { - - if (stopped) - return SBJson4ParserStopped; - - if ([_state isError]) - return SBJson4ParserError; - - char *token; - NSUInteger token_len; - sbjson4_token_t tok = [tokeniser getToken:&token length:&token_len]; - - switch (tok) { - case sbjson4_token_eof: - return [_state parserShouldReturn:self]; - - case sbjson4_token_error: - _state = [SBJson4StreamParserStateError sharedInstance]; - [_delegate parserFoundError:[NSError errorWithDomain:@"org.sbjson.parser" code:3 - userInfo:@{NSLocalizedDescriptionKey : tokeniser.error}]]; - return SBJson4ParserError; - - default: - - if (![_state parser:self shouldAcceptToken:tok]) { - [self handleTokenNotExpectedHere: tok]; - return SBJson4ParserError; - } - - switch (tok) { - case sbjson4_token_object_open: - [self handleObjectStart]; - break; - - case sbjson4_token_object_close: - [self handleObjectEnd: tok]; - break; - - case sbjson4_token_array_open: - [self handleArrayStart]; - break; - - case sbjson4_token_array_close: - [self handleArrayEnd: tok]; - break; - - case sbjson4_token_value_sep: - case sbjson4_token_entry_sep: - [_state parser:self shouldTransitionTo:tok]; - break; - - case sbjson4_token_bool: - [_delegate parserFoundBoolean:token[0] == 't']; - [_state parser:self shouldTransitionTo:tok]; - break; - - - case sbjson4_token_null: - [_delegate parserFoundNull]; - [_state parser:self shouldTransitionTo:tok]; - break; - - case sbjson4_token_integer: { - const int UNSIGNED_LONG_LONG_MAX_DIGITS = 20; - if (token_len <= UNSIGNED_LONG_LONG_MAX_DIGITS) { - if (*token == '-') - [_delegate parserFoundNumber:@(strtoll(token, NULL, 10))]; - else - [_delegate parserFoundNumber:@(strtoull(token, NULL, 10))]; - - [_state parser:self shouldTransitionTo:tok]; - break; - } - } - // FALL THROUGH - - case sbjson4_token_real: { - [_delegate parserFoundNumber:@(strtod(token, NULL))]; - [_state parser:self shouldTransitionTo:tok]; - break; - } - - case sbjson4_token_string: { - NSString *string = [[NSString alloc] initWithBytes:token length:token_len encoding:NSUTF8StringEncoding]; - if ([_state needKey]) - [_delegate parserFoundObjectKey:string]; - else - [_delegate parserFoundString:string]; - [_state parser:self shouldTransitionTo:tok]; - break; - } - - case sbjson4_token_encoded: { - NSString *string = [self decodeStringToken:token length:token_len]; - if ([_state needKey]) - [_delegate parserFoundObjectKey:string]; - else - [_delegate parserFoundString:string]; - [_state parser:self shouldTransitionTo:tok]; - break; - } - - default: - break; - } - break; - } - } - return SBJson4ParserComplete; - } -} - -- (unichar)decodeHexQuad:(char *)quad { - unichar ch = 0; - for (NSUInteger i = 0; i < 4; i++) { - int c = quad[i]; - ch *= 16; - switch (c) { - case '0' ... '9': ch += c - '0'; break; - case 'a' ... 'f': ch += 10 + c - 'a'; break; - case 'A' ... 'F': ch += 10 + c - 'A'; break; - default: @throw @"FUT FUT FUT"; - } - } - return ch; -} - -- (NSString*)decodeStringToken:(char*)bytes length:(NSUInteger)len { - NSMutableData *buf = [NSMutableData dataWithCapacity:len]; - for (NSUInteger i = 0; i < len;) { - switch ((unsigned char)bytes[i]) { - case '\\': { - switch ((unsigned char)bytes[++i]) { - case '"': [buf appendBytes:"\"" length:1]; i++; break; - case '/': [buf appendBytes:"/" length:1]; i++; break; - case '\\': [buf appendBytes:"\\" length:1]; i++; break; - case 'b': [buf appendBytes:"\b" length:1]; i++; break; - case 'f': [buf appendBytes:"\f" length:1]; i++; break; - case 'n': [buf appendBytes:"\n" length:1]; i++; break; - case 'r': [buf appendBytes:"\r" length:1]; i++; break; - case 't': [buf appendBytes:"\t" length:1]; i++; break; - case 'u': { - unichar hi = [self decodeHexQuad:bytes + i + 1]; - i += 5; - if (SBStringIsSurrogateHighCharacter(hi)) { - // Skip past \u that we know is there.. - unichar lo = [self decodeHexQuad:bytes + i + 2]; - i += 6; - [buf appendData:[[NSString stringWithFormat:@"%C%C", hi, lo] dataUsingEncoding:NSUTF8StringEncoding]]; - } else { - [buf appendData:[[NSString stringWithFormat:@"%C", hi] dataUsingEncoding:NSUTF8StringEncoding]]; - } - break; - } - default: @throw @"FUT FUT FUT"; - } - break; - } - default: - [buf appendBytes:bytes + i length:1]; - i++; - break; - } - } - return [[NSString alloc] initWithData:buf encoding:NSUTF8StringEncoding]; -} - -- (void)stop { - stopped = YES; -} - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParserState.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParserState.h deleted file mode 100755 index d602fcd1c..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParserState.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2010, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "SBJson4StreamTokeniser.h" -#import "SBJson4StreamParser.h" - -@interface SBJson4StreamParserState : NSObject -+ (id)sharedInstance; - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token; -- (SBJson4ParserStatus)parserShouldReturn:(SBJson4StreamParser *)parser; -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok; -- (BOOL)needKey; -- (BOOL)isError; - -- (NSString*)name; - -@end - -@interface SBJson4StreamParserStateStart : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateComplete : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateError : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateObjectStart : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateObjectGotKey : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateObjectSeparator : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateObjectGotValue : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateObjectNeedKey : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateArrayStart : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateArrayGotValue : SBJson4StreamParserState -@end - -@interface SBJson4StreamParserStateArrayNeedValue : SBJson4StreamParserState -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParserState.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParserState.m deleted file mode 100755 index 9435bf1fe..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamParserState.m +++ /dev/null @@ -1,355 +0,0 @@ -/* - Copyright (c) 2010-2013, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "SBJson4StreamParserState.h" - -#define SINGLETON \ -+ (id)sharedInstance { \ - static id state = nil; \ - if (!state) { \ - @synchronized(self) { \ - if (!state) state = [[self alloc] init]; \ - } \ - } \ - return state; \ -} - -@implementation SBJson4StreamParserState - -+ (id)sharedInstance { return nil; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - return NO; -} - -- (SBJson4ParserStatus)parserShouldReturn:(SBJson4StreamParser *)parser { - return SBJson4ParserWaitingForData; -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok {} - -- (BOOL)needKey { - return NO; -} - -- (NSString*)name { - return @""; -} - -- (BOOL)isError { - return NO; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateStart - -SINGLETON - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - return token == sbjson4_token_array_open || token == sbjson4_token_object_open; -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - - SBJson4StreamParserState *state = nil; - switch (tok) { - case sbjson4_token_array_open: - state = [SBJson4StreamParserStateArrayStart sharedInstance]; - break; - - case sbjson4_token_object_open: - state = [SBJson4StreamParserStateObjectStart sharedInstance]; - break; - - case sbjson4_token_array_close: - case sbjson4_token_object_close: - if ([parser.delegate respondsToSelector:@selector(parserShouldSupportManyDocuments)] && [parser.delegate parserShouldSupportManyDocuments]) - state = parser.state; - else - state = [SBJson4StreamParserStateComplete sharedInstance]; - break; - - case sbjson4_token_eof: - return; - - default: - state = [SBJson4StreamParserStateError sharedInstance]; - break; - } - - - parser.state = state; -} - -- (NSString*)name { return @"before outer-most array or object"; } - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateComplete - -SINGLETON - -- (NSString*)name { return @"after outer-most array or object"; } - -- (SBJson4ParserStatus)parserShouldReturn:(SBJson4StreamParser *)parser { - return SBJson4ParserComplete; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateError - -SINGLETON - -- (NSString*)name { return @"in error"; } - -- (SBJson4ParserStatus)parserShouldReturn:(SBJson4StreamParser *)parser { - return SBJson4ParserError; -} - -- (BOOL)isError { - return YES; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateObjectStart - -SINGLETON - -- (NSString*)name { return @"at beginning of object"; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - switch (token) { - case sbjson4_token_object_close: - case sbjson4_token_string: - case sbjson4_token_encoded: - return YES; - default: - return NO; - } -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateObjectGotKey sharedInstance]; -} - -- (BOOL)needKey { - return YES; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateObjectGotKey - -SINGLETON - -- (NSString*)name { return @"after object key"; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - return token == sbjson4_token_entry_sep; -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateObjectSeparator sharedInstance]; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateObjectSeparator - -SINGLETON - -- (NSString*)name { return @"as object value"; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - switch (token) { - case sbjson4_token_object_open: - case sbjson4_token_array_open: - case sbjson4_token_bool: - case sbjson4_token_null: - case sbjson4_token_integer: - case sbjson4_token_real: - case sbjson4_token_string: - case sbjson4_token_encoded: - return YES; - - default: - return NO; - } -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateObjectGotValue sharedInstance]; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateObjectGotValue - -SINGLETON - -- (NSString*)name { return @"after object value"; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - switch (token) { - case sbjson4_token_object_close: - case sbjson4_token_value_sep: - return YES; - - default: - return NO; - } -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateObjectNeedKey sharedInstance]; -} - - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateObjectNeedKey - -SINGLETON - -- (NSString*)name { return @"in place of object key"; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - return sbjson4_token_string == token || sbjson4_token_encoded == token; -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateObjectGotKey sharedInstance]; -} - -- (BOOL)needKey { - return YES; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateArrayStart - -SINGLETON - -- (NSString*)name { return @"at array start"; } - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - switch (token) { - case sbjson4_token_object_close: - case sbjson4_token_entry_sep: - case sbjson4_token_value_sep: - return NO; - - default: - return YES; - } -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateArrayGotValue sharedInstance]; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateArrayGotValue - -SINGLETON - -- (NSString*)name { return @"after array value"; } - - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - return token == sbjson4_token_array_close || token == sbjson4_token_value_sep; -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - if (tok == sbjson4_token_value_sep) - parser.state = [SBJson4StreamParserStateArrayNeedValue sharedInstance]; -} - -@end - -#pragma mark - - -@implementation SBJson4StreamParserStateArrayNeedValue - -SINGLETON - -- (NSString*)name { return @"as array value"; } - - -- (BOOL)parser:(SBJson4StreamParser *)parser shouldAcceptToken:(sbjson4_token_t)token { - switch (token) { - case sbjson4_token_array_close: - case sbjson4_token_entry_sep: - case sbjson4_token_object_close: - case sbjson4_token_value_sep: - return NO; - - default: - return YES; - } -} - -- (void)parser:(SBJson4StreamParser *)parser shouldTransitionTo:(sbjson4_token_t)tok { - parser.state = [SBJson4StreamParserStateArrayGotValue sharedInstance]; -} - -@end - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamTokeniser.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamTokeniser.h deleted file mode 100755 index 518b0f242..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamTokeniser.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// Created by SuperPappi on 09/01/2013. -// -// To change the template use AppCode | Preferences | File Templates. -// - -#import - -typedef enum { - sbjson4_token_error = -1, - sbjson4_token_eof, - - sbjson4_token_array_open, - sbjson4_token_array_close, - sbjson4_token_value_sep, - - sbjson4_token_object_open, - sbjson4_token_object_close, - sbjson4_token_entry_sep, - - sbjson4_token_bool, - sbjson4_token_null, - - sbjson4_token_integer, - sbjson4_token_real, - - sbjson4_token_string, - sbjson4_token_encoded, -} sbjson4_token_t; - - -@interface SBJson4StreamTokeniser : NSObject - -@property (nonatomic, readonly, copy) NSString *error; - -- (void)appendData:(NSData*)data_; -- (sbjson4_token_t)getToken:(char**)tok length:(NSUInteger*)len; - -@end - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamTokeniser.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamTokeniser.m deleted file mode 100755 index 756bdd9ff..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamTokeniser.m +++ /dev/null @@ -1,395 +0,0 @@ -// -// Created by SuperPappi on 09/01/2013. -// -// To change the template use AppCode | Preferences | File Templates. -// - - -#import "SBJson4StreamTokeniser.h" - -#define SBStringIsIllegalSurrogateHighCharacter(character) (((character) >= 0xD800UL) && ((character) <= 0xDFFFUL)) -#define SBStringIsSurrogateLowCharacter(character) ((character >= 0xDC00UL) && (character <= 0xDFFFUL)) -#define SBStringIsSurrogateHighCharacter(character) ((character >= 0xD800UL) && (character <= 0xDBFFUL)) - -@implementation SBJson4StreamTokeniser { - NSMutableData *data; - const char *bytes; - NSUInteger index; - NSUInteger offset; -} - -- (void)setError:(NSString *)error { - _error = [NSString stringWithFormat:@"%@ at index %lu", error, (unsigned long)(offset + index)]; -} - -- (void)appendData:(NSData *)data_ { - if (!data) { - data = [data_ mutableCopy]; - - } else if (index) { - // Discard data we've already parsed - [data replaceBytesInRange:NSMakeRange(0, index) withBytes:"" length:0]; - [data appendData:data_]; - - // Add to the offset for reporting - offset += index; - - // Reset index to point to current position - index = 0u; - - } - else { - [data appendData:data_]; - } - - bytes = [data bytes]; -} - -- (void)skipWhitespace { - while (index < data.length) { - switch (bytes[index]) { - case ' ': - case '\t': - case '\r': - case '\n': - index++; - break; - default: - return; - } - } -} - -- (BOOL)getUnichar:(unichar *)ch { - if ([self haveRemainingCharacters:1]) { - *ch = (unichar) bytes[index]; - return YES; - } - return NO; -} - -- (BOOL)haveOneMoreCharacter { - return [self haveRemainingCharacters:1]; -} - -- (BOOL)haveRemainingCharacters:(NSUInteger)length { - return data.length - index >= length; -} - -- (sbjson4_token_t)match:(char *)str retval:(sbjson4_token_t)tok token:(char **)token length:(NSUInteger *)length { - NSUInteger len = strlen(str); - if ([self haveRemainingCharacters:len]) { - if (!memcmp(bytes + index, str, len)) { - *token = str; - *length = len; - index += len; - return tok; - } - [self setError: [NSString stringWithFormat:@"Expected '%s' after initial '%.1s'", str, str]]; - return sbjson4_token_error; - } - - return sbjson4_token_eof; -} - -- (BOOL)decodeHexQuad:(unichar*)quad { - unichar tmp = 0; - - for (int i = 0; i < 4; i++, index++) { - unichar c = (unichar)bytes[index]; - tmp *= 16; - switch (c) { - case '0' ... '9': - tmp += c - '0'; - break; - - case 'a' ... 'f': - tmp += 10 + c - 'a'; - break; - - case 'A' ... 'F': - tmp += 10 + c - 'A'; - break; - - default: - return NO; - } - } - *quad = tmp; - return YES; -} - -- (sbjson4_token_t)getStringToken:(char **)token length:(NSUInteger *)length { - - // Skip initial " - index++; - - NSUInteger string_start = index; - sbjson4_token_t tok = sbjson4_token_string; - - for (;;) { - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - - switch (bytes[index]) { - case 0 ... 0x1F: - [self setError:[NSString stringWithFormat:@"Unescaped control character [0x%0.2X] in string", bytes[index]]]; - return sbjson4_token_error; - - case '"': - *token = (char *)(bytes + string_start); - *length = index - string_start; - index++; - return tok; - - case '\\': - tok = sbjson4_token_encoded; - index++; - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - - if (bytes[index] == 'u') { - index++; - if (![self haveRemainingCharacters:4]) - return sbjson4_token_eof; - - unichar hi; - if (![self decodeHexQuad:&hi]) { - [self setError:@"Invalid hex quad"]; - return sbjson4_token_error; - } - - if (SBStringIsSurrogateHighCharacter(hi)) { - if (![self haveRemainingCharacters:6]) - return sbjson4_token_eof; - - unichar lo; - if (bytes[index++] != '\\' || bytes[index++] != 'u' || ![self decodeHexQuad:&lo]) { - [self setError:@"Missing low character in surrogate pair"]; - return sbjson4_token_error; - } - - if (!SBStringIsSurrogateLowCharacter(lo)) { - [self setError:@"Invalid low character in surrogate pair"]; - return sbjson4_token_error; - } - - } else if (SBStringIsIllegalSurrogateHighCharacter(hi)) { - [self setError:@"Invalid high character in surrogate pair"]; - return sbjson4_token_error; - - } - - - } else { - switch (bytes[index]) { - case '\\': - case '/': - case '"': - case 'b': - case 'n': - case 'r': - case 't': - case 'f': - index++; - break; - - default: - [self setError:[NSString stringWithFormat:@"Illegal escape character [%x]", bytes[index]]]; - return sbjson4_token_error; - } - } - - break; - - default: - index++; - break; - } - } -} - -- (sbjson4_token_t)getNumberToken:(char **)token length:(NSUInteger *)length { - NSUInteger num_start = index; - if (bytes[index] == '-') { - index++; - - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - } - - sbjson4_token_t tok = sbjson4_token_integer; - if (bytes[index] == '0') { - index++; - - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - - if (isdigit(bytes[index])) { - [self setError:@"Leading zero is illegal in number"]; - return sbjson4_token_error; - } - } - - while (isdigit(bytes[index])) { - index++; - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - } - - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - - - if (bytes[index] == '.') { - index++; - tok = sbjson4_token_real; - - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - - NSUInteger fraction_start = index; - while (isdigit(bytes[index])) { - index++; - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - } - - if (fraction_start == index) { - [self setError:@"No digits after decimal point"]; - return sbjson4_token_error; - } - } - - if (bytes[index] == 'e' || bytes[index] == 'E') { - index++; - tok = sbjson4_token_real; - - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - - if (bytes[index] == '-' || bytes[index] == '+') { - index++; - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - } - - NSUInteger exp_start = index; - while (isdigit(bytes[index])) { - index++; - if (![self haveOneMoreCharacter]) - return sbjson4_token_eof; - } - - if (exp_start == index) { - [self setError:@"No digits in exponent"]; - return sbjson4_token_error; - } - - } - - if (num_start + 1 == index && bytes[num_start] == '-') { - [self setError:@"No digits after initial minus"]; - return sbjson4_token_error; - } - - *token = (char *)(bytes + num_start); - *length = index - num_start; - return tok; -} - - -- (sbjson4_token_t)getToken:(char **)token length:(NSUInteger *)length { - [self skipWhitespace]; - NSUInteger copyOfIndex = index; - - unichar ch; - if (![self getUnichar:&ch]) - return sbjson4_token_eof; - - sbjson4_token_t tok; - switch (ch) { - case '{': { - index++; - tok = sbjson4_token_object_open; - break; - } - case '}': { - index++; - tok = sbjson4_token_object_close; - break; - - } - case '[': { - index++; - tok = sbjson4_token_array_open; - break; - - } - case ']': { - index++; - tok = sbjson4_token_array_close; - break; - - } - case 't': { - tok = [self match:"true" retval:sbjson4_token_bool token:token length:length]; - break; - - } - case 'f': { - tok = [self match:"false" retval:sbjson4_token_bool token:token length:length]; - break; - - } - case 'n': { - tok = [self match:"null" retval:sbjson4_token_null token:token length:length]; - break; - - } - case ',': { - index++; - tok = sbjson4_token_value_sep; - break; - - } - case ':': { - index++; - tok = sbjson4_token_entry_sep; - break; - - } - case '"': { - tok = [self getStringToken:token length:length]; - break; - - } - case '-': - case '0' ... '9': { - tok = [self getNumberToken:token length:length]; - break; - - } - case '+': { - self.error = @"Leading + is illegal in number"; - tok = sbjson4_token_error; - break; - - } - default: { - self.error = [NSString stringWithFormat:@"Illegal start of token [%c]", ch]; - tok = sbjson4_token_error; - break; - } - } - - if (tok == sbjson4_token_eof) { - // We ran out of bytes before we could finish parsing the current token. - // Back up to the start & wait for more data. - index = copyOfIndex; - } - - return tok; -} - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriter.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriter.h deleted file mode 100755 index 8b8b75500..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriter.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - Copyright (c) 2010, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -/// Enable JSON writing for non-native objects -@interface NSObject (SBProxyForJson) - -/** - Allows generation of JSON for otherwise unsupported classes. - - If you have a custom class that you want to create a JSON representation - for you can implement this method in your class. It should return a - representation of your object defined in terms of objects that can be - translated into JSON. For example, a Person object might implement it like this: - - - (id)proxyForJson { - return [NSDictionary dictionaryWithObjectsAndKeys: - name, @"name", - phone, @"phone", - email, @"email", - nil]; - } - - */ -- (id)proxyForJson; - -@end - -@class SBJson4StreamWriter; - -@protocol SBJson4StreamWriterDelegate - -- (void)writer:(SBJson4StreamWriter *)writer appendBytes:(const void *)bytes length:(NSUInteger)length; - -@end - -@class SBJson4StreamWriterState; - -/** - The Stream Writer class. - - Accepts a stream of messages and writes JSON of these to its delegate object. - - This class provides a range of high-, mid- and low-level methods. You can mix - and match calls to these. For example, you may want to call -writeArrayOpen - to start an array and then repeatedly call -writeObject: with various objects - before finishing off with a -writeArrayClose call. - - Objective-C types are mapped to JSON types in the following way: - - - NSNull -> null - - NSString -> string - - NSArray -> array - - NSDictionary -> object - - NSNumber's -initWithBool:YES -> true - - NSNumber's -initWithBool:NO -> false - - NSNumber -> number - - NSNumber instances created with the -numberWithBool: method are - converted into the JSON boolean "true" and "false" values, and vice - versa. Any other NSNumber instances are converted to a JSON number the - way you would expect. - - @warning: In JSON the keys of an object must be strings. NSDictionary - keys need not be, but attempting to convert an NSDictionary with - non-string keys into JSON will throw an exception.* - - */ - -@interface SBJson4StreamWriter : NSObject { - NSMutableDictionary *cache; -} - -@property (nonatomic, weak) SBJson4StreamWriterState *state; // Internal -@property (nonatomic, readonly, strong) NSMutableArray *stateStack; // Internal - -/** - delegate to receive JSON output - Delegate that will receive messages with output. - */ -@property (nonatomic, weak) id delegate; - -/** - The maximum depth. - - Defaults to 512. If the input is nested deeper than this the input will be deemed to be - malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can - turn off this security feature by setting the maxDepth value to 0. - */ -@property(nonatomic) NSUInteger maxDepth; - -/** - Whether we are generating human-readable (multi line) JSON. - - Set whether or not to generate human-readable JSON. The default is NO, which produces - JSON without any whitespace between tokens. If set to YES, generates human-readable - JSON with line breaks after each array value and dictionary key/value pair, indented two - spaces per nesting level. - */ -@property(nonatomic) BOOL humanReadable; - -/** - Whether or not to sort the dictionary keys in the output. - - If this is set to YES, the dictionary keys in the JSON output will be in sorted order. - (This is useful if you need to compare two structures, for example.) The default is NO. - */ -@property(nonatomic) BOOL sortKeys; - -/** - An optional comparator to be used if sortKeys is YES. - - If this is nil, sorting will be done via @selector(compare:). - */ -@property (nonatomic, copy) NSComparator sortKeysComparator; - -/// Contains the error description after an error has occurred. -@property (nonatomic, copy) NSString *error; - -/** - Write an NSDictionary to the JSON stream. - @return YES if successful, or NO on failure - */ -- (BOOL)writeObject:(NSDictionary*)dict; - -/** - Write an NSArray to the JSON stream. - @return YES if successful, or NO on failure - */ -- (BOOL)writeArray:(NSArray *)array; - -/** - Start writing an Object to the stream - @return YES if successful, or NO on failure -*/ -- (BOOL)writeObjectOpen; - -/** - Close the current object being written - @return YES if successful, or NO on failure -*/ -- (BOOL)writeObjectClose; - -/** Start writing an Array to the stream - @return YES if successful, or NO on failure -*/ -- (BOOL)writeArrayOpen; - -/** Close the current Array being written - @return YES if successful, or NO on failure -*/ -- (BOOL)writeArrayClose; - -/** Write a null to the stream - @return YES if successful, or NO on failure -*/ -- (BOOL)writeNull; - -/** Write a boolean to the stream - @return YES if successful, or NO on failure -*/ -- (BOOL)writeBool:(BOOL)x; - -/** Write a Number to the stream - @return YES if successful, or NO on failure -*/ -- (BOOL)writeNumber:(NSNumber*)n; - -/** Write a String to the stream - @return YES if successful, or NO on failure -*/ -- (BOOL)writeString:(NSString*)s; - -@end - -@interface SBJson4StreamWriter (Private) -- (BOOL)writeValue:(id)v; -- (void)appendBytes:(const void *)bytes length:(NSUInteger)length; -@end - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriter.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriter.m deleted file mode 100755 index 843a27954..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriter.m +++ /dev/null @@ -1,358 +0,0 @@ -/* - Copyright (c) 2010, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "SBJson4StreamWriter.h" -#import "SBJson4StreamWriterState.h" - -static NSNumber *kTrue; -static NSNumber *kFalse; -static NSNumber *kPositiveInfinity; -static NSNumber *kNegativeInfinity; - - -@implementation SBJson4StreamWriter - -+ (void)initialize { - kPositiveInfinity = [NSNumber numberWithDouble:+HUGE_VAL]; - kNegativeInfinity = [NSNumber numberWithDouble:-HUGE_VAL]; - kTrue = [NSNumber numberWithBool:YES]; - kFalse = [NSNumber numberWithBool:NO]; -} - -#pragma mark Housekeeping - -- (id)init { - self = [super init]; - if (self) { - _maxDepth = 32u; - _stateStack = [[NSMutableArray alloc] initWithCapacity:_maxDepth]; - _state = [SBJson4StreamWriterStateStart sharedInstance]; - cache = [[NSMutableDictionary alloc] initWithCapacity:32]; - } - return self; -} - -#pragma mark Methods - -- (void)appendBytes:(const void *)bytes length:(NSUInteger)length { - [_delegate writer:self appendBytes:bytes length:length]; -} - -- (BOOL)writeObject:(NSDictionary *)dict { - if (![self writeObjectOpen]) - return NO; - - NSArray *keys = [dict allKeys]; - - if (_sortKeys) { - if (_sortKeysComparator) { - keys = [keys sortedArrayWithOptions:NSSortStable usingComparator:_sortKeysComparator]; - } - else{ - keys = [keys sortedArrayUsingSelector:@selector(compare:)]; - } - } - - for (id k in keys) { - if (![k isKindOfClass:[NSString class]]) { - self.error = [NSString stringWithFormat:@"JSON object key must be string: %@", k]; - return NO; - } - - if (![self writeString:k]) - return NO; - if (![self writeValue:[dict objectForKey:k]]) - return NO; - } - - return [self writeObjectClose]; -} - -- (BOOL)writeArray:(NSArray*)array { - if (![self writeArrayOpen]) - return NO; - for (id v in array) - if (![self writeValue:v]) - return NO; - return [self writeArrayClose]; -} - - -- (BOOL)writeObjectOpen { - if ([_state isInvalidState:self]) return NO; - if ([_state expectingKey:self]) return NO; - [_state appendSeparator:self]; - if (_humanReadable && _stateStack.count) [_state appendWhitespace:self]; - - [_stateStack addObject:_state]; - self.state = [SBJson4StreamWriterStateObjectStart sharedInstance]; - - if (_maxDepth && _stateStack.count > _maxDepth) { - self.error = @"Nested too deep"; - return NO; - } - - [_delegate writer:self appendBytes:"{" length:1]; - return YES; -} - -- (BOOL)writeObjectClose { - if ([_state isInvalidState:self]) return NO; - - SBJson4StreamWriterState *prev = _state; - - self.state = [_stateStack lastObject]; - [_stateStack removeLastObject]; - - if (_humanReadable) [prev appendWhitespace:self]; - [_delegate writer:self appendBytes:"}" length:1]; - - [_state transitionState:self]; - return YES; -} - -- (BOOL)writeArrayOpen { - if ([_state isInvalidState:self]) return NO; - if ([_state expectingKey:self]) return NO; - [_state appendSeparator:self]; - if (_humanReadable && _stateStack.count) [_state appendWhitespace:self]; - - [_stateStack addObject:_state]; - self.state = [SBJson4StreamWriterStateArrayStart sharedInstance]; - - if (_maxDepth && _stateStack.count > _maxDepth) { - self.error = @"Nested too deep"; - return NO; - } - - [_delegate writer:self appendBytes:"[" length:1]; - return YES; -} - -- (BOOL)writeArrayClose { - if ([_state isInvalidState:self]) return NO; - if ([_state expectingKey:self]) return NO; - - SBJson4StreamWriterState *prev = _state; - - self.state = [_stateStack lastObject]; - [_stateStack removeLastObject]; - - if (_humanReadable) [prev appendWhitespace:self]; - [_delegate writer:self appendBytes:"]" length:1]; - - [_state transitionState:self]; - return YES; -} - -- (BOOL)writeNull { - if ([_state isInvalidState:self]) return NO; - if ([_state expectingKey:self]) return NO; - [_state appendSeparator:self]; - if (_humanReadable) [_state appendWhitespace:self]; - - [_delegate writer:self appendBytes:"null" length:4]; - [_state transitionState:self]; - return YES; -} - -- (BOOL)writeBool:(BOOL)x { - if ([_state isInvalidState:self]) return NO; - if ([_state expectingKey:self]) return NO; - [_state appendSeparator:self]; - if (_humanReadable) [_state appendWhitespace:self]; - - if (x) - [_delegate writer:self appendBytes:"true" length:4]; - else - [_delegate writer:self appendBytes:"false" length:5]; - [_state transitionState:self]; - return YES; -} - - -- (BOOL)writeValue:(id)o { - if ([o isKindOfClass:[NSDictionary class]]) { - return [self writeObject:o]; - - } else if ([o isKindOfClass:[NSArray class]]) { - return [self writeArray:o]; - - } else if ([o isKindOfClass:[NSString class]]) { - [self writeString:o]; - return YES; - - } else if ([o isKindOfClass:[NSNumber class]]) { - return [self writeNumber:o]; - - } else if ([o isKindOfClass:[NSNull class]]) { - return [self writeNull]; - - } else if ([o respondsToSelector:@selector(proxyForJson)]) { - return [self writeValue:[o proxyForJson]]; - - } - - self.error = [NSString stringWithFormat:@"JSON serialisation not supported for %@", [o class]]; - return NO; -} - -static const char *strForChar(int c) { - switch (c) { - case 0: return "\\u0000"; - case 1: return "\\u0001"; - case 2: return "\\u0002"; - case 3: return "\\u0003"; - case 4: return "\\u0004"; - case 5: return "\\u0005"; - case 6: return "\\u0006"; - case 7: return "\\u0007"; - case 8: return "\\b"; - case 9: return "\\t"; - case 10: return "\\n"; - case 11: return "\\u000b"; - case 12: return "\\f"; - case 13: return "\\r"; - case 14: return "\\u000e"; - case 15: return "\\u000f"; - case 16: return "\\u0010"; - case 17: return "\\u0011"; - case 18: return "\\u0012"; - case 19: return "\\u0013"; - case 20: return "\\u0014"; - case 21: return "\\u0015"; - case 22: return "\\u0016"; - case 23: return "\\u0017"; - case 24: return "\\u0018"; - case 25: return "\\u0019"; - case 26: return "\\u001a"; - case 27: return "\\u001b"; - case 28: return "\\u001c"; - case 29: return "\\u001d"; - case 30: return "\\u001e"; - case 31: return "\\u001f"; - case 34: return "\\\""; - case 92: return "\\\\"; - default: - [NSException raise:@"Illegal escape char" format:@"-->%c<-- is not a legal escape character", c]; - return NULL; - } -} - -- (BOOL)writeString:(NSString*)string { - if ([_state isInvalidState:self]) return NO; - [_state appendSeparator:self]; - if (_humanReadable) [_state appendWhitespace:self]; - - NSMutableData *buf = [cache objectForKey:string]; - if (!buf) { - - NSUInteger len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - const char *utf8 = [string UTF8String]; - NSUInteger written = 0, i = 0; - - buf = [NSMutableData dataWithCapacity:(NSUInteger)(len * 1.1f)]; - [buf appendBytes:"\"" length:1]; - - for (i = 0; i < len; i++) { - int c = utf8[i]; - BOOL isControlChar = c >= 0 && c < 32; - if (isControlChar || c == '"' || c == '\\') { - if (i - written) - [buf appendBytes:utf8 + written length:i - written]; - written = i + 1; - - const char *t = strForChar(c); - [buf appendBytes:t length:strlen(t)]; - } - } - - if (i - written) - [buf appendBytes:utf8 + written length:i - written]; - - [buf appendBytes:"\"" length:1]; - [cache setObject:buf forKey:string]; - } - - [_delegate writer:self appendBytes:[buf bytes] length:[buf length]]; - [_state transitionState:self]; - return YES; -} - -- (BOOL)writeNumber:(NSNumber*)number { - if (number == kTrue || number == kFalse) - return [self writeBool:[number boolValue]]; - - if ([_state isInvalidState:self]) return NO; - if ([_state expectingKey:self]) return NO; - [_state appendSeparator:self]; - if (_humanReadable) [_state appendWhitespace:self]; - - if ([kPositiveInfinity isEqualToNumber:number]) { - self.error = @"+Infinity is not a valid number in JSON"; - return NO; - - } else if ([kNegativeInfinity isEqualToNumber:number]) { - self.error = @"-Infinity is not a valid number in JSON"; - return NO; - - } else if (isnan([number doubleValue])) { - self.error = @"NaN is not a valid number in JSON"; - return NO; - } - - const char *objcType = [number objCType]; - char num[128]; - size_t len; - - switch (objcType[0]) { - case 'c': case 'i': case 's': case 'l': case 'q': - len = snprintf(num, sizeof num, "%lld", [number longLongValue]); - break; - case 'C': case 'I': case 'S': case 'L': case 'Q': - len = snprintf(num, sizeof num, "%llu", [number unsignedLongLongValue]); - break; - case 'f': case 'd': default: { - len = snprintf(num, sizeof num, "%.17g", [number doubleValue]); - break; - } - } - [_delegate writer:self appendBytes:num length: len]; - [_state transitionState:self]; - return YES; -} - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriterState.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriterState.h deleted file mode 100755 index 020f71543..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriterState.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2010, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class SBJson4StreamWriter; - -@interface SBJson4StreamWriterState : NSObject -+ (id)sharedInstance; -- (BOOL)isInvalidState:(SBJson4StreamWriter *)writer; -- (void)appendSeparator:(SBJson4StreamWriter *)writer; -- (BOOL)expectingKey:(SBJson4StreamWriter *)writer; -- (void)transitionState:(SBJson4StreamWriter *)writer; -- (void)appendWhitespace:(SBJson4StreamWriter *)writer; -@end - -@interface SBJson4StreamWriterStateObjectStart : SBJson4StreamWriterState -@end - -@interface SBJson4StreamWriterStateObjectKey : SBJson4StreamWriterStateObjectStart -@end - -@interface SBJson4StreamWriterStateObjectValue : SBJson4StreamWriterState -@end - -@interface SBJson4StreamWriterStateArrayStart : SBJson4StreamWriterState -@end - -@interface SBJson4StreamWriterStateArrayValue : SBJson4StreamWriterState -@end - -@interface SBJson4StreamWriterStateStart : SBJson4StreamWriterState -@end - -@interface SBJson4StreamWriterStateComplete : SBJson4StreamWriterState -@end - -@interface SBJson4StreamWriterStateError : SBJson4StreamWriterState -@end - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriterState.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriterState.m deleted file mode 100755 index ed7890aca..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4StreamWriterState.m +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (c) 2010, Stig Brautaset. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the the author nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "SBJson4StreamWriterState.h" -#import "SBJson4StreamWriter.h" - -#define SINGLETON \ -+ (id)sharedInstance { \ - static id state = nil; \ - if (!state) { \ - @synchronized(self) { \ - if (!state) state = [[self alloc] init]; \ - } \ - } \ - return state; \ -} - - -@implementation SBJson4StreamWriterState -+ (id)sharedInstance { return nil; } -- (BOOL)isInvalidState:(SBJson4StreamWriter *)writer { return NO; } -- (void)appendSeparator:(SBJson4StreamWriter *)writer {} -- (BOOL)expectingKey:(SBJson4StreamWriter *)writer { return NO; } -- (void)transitionState:(SBJson4StreamWriter *)writer {} -- (void)appendWhitespace:(SBJson4StreamWriter *)writer { - [writer appendBytes:"\n" length:1]; - for (NSUInteger i = 0; i < writer.stateStack.count; i++) - [writer appendBytes:" " length:2]; -} -@end - -@implementation SBJson4StreamWriterStateObjectStart - -SINGLETON - -- (void)transitionState:(SBJson4StreamWriter *)writer { - writer.state = [SBJson4StreamWriterStateObjectValue sharedInstance]; -} -- (BOOL)expectingKey:(SBJson4StreamWriter *)writer { - writer.error = @"JSON object key must be string"; - return YES; -} -@end - -@implementation SBJson4StreamWriterStateObjectKey - -SINGLETON - -- (void)appendSeparator:(SBJson4StreamWriter *)writer { - [writer appendBytes:"," length:1]; -} -@end - -@implementation SBJson4StreamWriterStateObjectValue - -SINGLETON - -- (void)appendSeparator:(SBJson4StreamWriter *)writer { - [writer appendBytes:":" length:1]; -} -- (void)transitionState:(SBJson4StreamWriter *)writer { - writer.state = [SBJson4StreamWriterStateObjectKey sharedInstance]; -} -- (void)appendWhitespace:(SBJson4StreamWriter *)writer { - [writer appendBytes:" " length:1]; -} -@end - -@implementation SBJson4StreamWriterStateArrayStart - -SINGLETON - -- (void)transitionState:(SBJson4StreamWriter *)writer { - writer.state = [SBJson4StreamWriterStateArrayValue sharedInstance]; -} -@end - -@implementation SBJson4StreamWriterStateArrayValue - -SINGLETON - -- (void)appendSeparator:(SBJson4StreamWriter *)writer { - [writer appendBytes:"," length:1]; -} -@end - -@implementation SBJson4StreamWriterStateStart - -SINGLETON - - -- (void)transitionState:(SBJson4StreamWriter *)writer { - writer.state = [SBJson4StreamWriterStateComplete sharedInstance]; -} -- (void)appendSeparator:(SBJson4StreamWriter *)writer { -} -@end - -@implementation SBJson4StreamWriterStateComplete - -SINGLETON - -- (BOOL)isInvalidState:(SBJson4StreamWriter *)writer { - writer.error = @"Stream is closed"; - return YES; -} -@end - -@implementation SBJson4StreamWriterStateError - -SINGLETON - -@end - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Writer.h b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Writer.h deleted file mode 100755 index bc292902a..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Writer.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2009 Stig Brautaset. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -/** - The JSON writer class. - - This uses SBJson4StreamWriter internally. - - */ - -@interface SBJson4Writer : NSObject - -/** - The maximum depth. - - Defaults to 32. If the input is nested deeper than this the input will be deemed to be - malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can - turn off this security feature by setting the maxDepth value to 0. - */ -@property(nonatomic) NSUInteger maxDepth; - -/** - Return an error trace, or nil if there was no errors. - - Note that this method returns the trace of the last method that failed. - You need to check the return value of the call you're making to figure out - if the call actually failed, before you know call this method. - */ -@property (nonatomic, readonly, copy) NSString *error; - -/** - Whether we are generating human-readable (multi line) JSON. - - Set whether or not to generate human-readable JSON. The default is NO, which produces - JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable - JSON with line breaks after each array value and dictionary key/value pair, indented two - spaces per nesting level. - */ -@property(nonatomic) BOOL humanReadable; - -/** - Whether or not to sort the dictionary keys in the output. - - If this is set to YES, the dictionary keys in the JSON output will be in sorted order. - (This is useful if you need to compare two structures, for example.) The default is NO. - */ -@property(nonatomic) BOOL sortKeys; - -/** - An optional comparator to be used if sortKeys is YES. - - If this is nil, sorting will be done via @selector(compare:). - */ -@property (nonatomic, copy) NSComparator sortKeysComparator; - -/** - Generates string with JSON representation for the given object. - - Returns a string containing JSON representation of the passed in value, or nil on error. - If nil is returned and error is not NULL, *error can be interrogated to find the cause of the error. - - @param value any instance that can be represented as JSON text. - */ -- (NSString*)stringWithObject:(id)value; - -/** - Generates JSON representation for the given object. - - Returns an NSData object containing JSON represented as UTF8 text, or nil on error. - - @param value any instance that can be represented as JSON text. - */ -- (NSData*)dataWithObject:(id)value; - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Writer.m b/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Writer.m deleted file mode 100755 index 9eec55588..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/SBJson4Writer.m +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2009 Stig Brautaset. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "SBJson4Writer.h" -#import "SBJson4StreamWriter.h" - - -@interface SBJson4Writer () < SBJson4StreamWriterDelegate > -@property (nonatomic, copy) NSString *error; -@property (nonatomic, strong) NSMutableData *acc; -@end - -@implementation SBJson4Writer - -- (id)init { - self = [super init]; - if (self) { - self.maxDepth = 32u; - } - return self; -} - - -- (NSString*)stringWithObject:(id)value { - NSData *data = [self dataWithObject:value]; - if (data) - return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - return nil; -} - -- (NSData*)dataWithObject:(id)object { - self.error = nil; - - self.acc = [[NSMutableData alloc] initWithCapacity:8096u]; - - SBJson4StreamWriter *streamWriter = [[SBJson4StreamWriter alloc] init]; - streamWriter.sortKeys = self.sortKeys; - streamWriter.maxDepth = self.maxDepth; - streamWriter.sortKeysComparator = self.sortKeysComparator; - streamWriter.humanReadable = self.humanReadable; - streamWriter.delegate = self; - - BOOL ok = NO; - if ([object isKindOfClass:[NSDictionary class]]) - ok = [streamWriter writeObject:object]; - - else if ([object isKindOfClass:[NSArray class]]) - ok = [streamWriter writeArray:object]; - - else if ([object respondsToSelector:@selector(proxyForJson)]) - return [self dataWithObject:[object proxyForJson]]; - else { - self.error = @"Not valid type for JSON"; - return nil; - } - - if (ok) - return self.acc; - - self.error = streamWriter.error; - return nil; -} - -#pragma mark SBJson4StreamWriterDelegate - -- (void)writer:(SBJson4StreamWriter *)writer appendBytes:(const void *)bytes length:(NSUInteger)length { - [self.acc appendBytes:bytes length:length]; -} - - - -@end diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/bin/test_SBJSON b/tests/JSONTestSuite/parsers/test_SBJSON/bin/test_SBJSON deleted file mode 100755 index 351c4fbfc..000000000 Binary files a/tests/JSONTestSuite/parsers/test_SBJSON/bin/test_SBJSON and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.pbxproj deleted file mode 100644 index 50ebecf9d..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.pbxproj +++ /dev/null @@ -1,290 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 034CB5251D7C6B80006D4E84 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5241D7C6B80006D4E84 /* main.m */; }; - 034CB53A1D7C6B8F006D4E84 /* SBJson4StreamWriterState.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB52C1D7C6B8F006D4E84 /* SBJson4StreamWriterState.m */; }; - 034CB53B1D7C6B8F006D4E84 /* SBJson4StreamWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5301D7C6B8F006D4E84 /* SBJson4StreamWriter.m */; }; - 034CB53C1D7C6B8F006D4E84 /* SBJson4StreamParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5331D7C6B8F006D4E84 /* SBJson4StreamParser.m */; }; - 034CB53D1D7C6B8F006D4E84 /* SBJson4Parser.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5341D7C6B8F006D4E84 /* SBJson4Parser.m */; }; - 034CB53E1D7C6B8F006D4E84 /* SBJson4Writer.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5351D7C6B8F006D4E84 /* SBJson4Writer.m */; }; - 034CB53F1D7C6B8F006D4E84 /* SBJson4StreamParserState.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5371D7C6B8F006D4E84 /* SBJson4StreamParserState.m */; }; - 034CB5401D7C6B8F006D4E84 /* SBJson4StreamTokeniser.m in Sources */ = {isa = PBXBuildFile; fileRef = 034CB5381D7C6B8F006D4E84 /* SBJson4StreamTokeniser.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 034CB51F1D7C6B80006D4E84 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 034CB5211D7C6B80006D4E84 /* test_SBJSON */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_SBJSON; sourceTree = BUILT_PRODUCTS_DIR; }; - 034CB5241D7C6B80006D4E84 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 034CB52B1D7C6B8F006D4E84 /* SBJson4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4.h; sourceTree = ""; }; - 034CB52C1D7C6B8F006D4E84 /* SBJson4StreamWriterState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4StreamWriterState.m; sourceTree = ""; }; - 034CB52D1D7C6B8F006D4E84 /* SBJson4StreamWriterState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4StreamWriterState.h; sourceTree = ""; }; - 034CB52E1D7C6B8F006D4E84 /* SBJson4StreamParserState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4StreamParserState.h; sourceTree = ""; }; - 034CB52F1D7C6B8F006D4E84 /* SBJson4StreamWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4StreamWriter.h; sourceTree = ""; }; - 034CB5301D7C6B8F006D4E84 /* SBJson4StreamWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4StreamWriter.m; sourceTree = ""; }; - 034CB5311D7C6B8F006D4E84 /* SBJson4StreamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4StreamParser.h; sourceTree = ""; }; - 034CB5321D7C6B8F006D4E84 /* SBJson4Parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4Parser.h; sourceTree = ""; }; - 034CB5331D7C6B8F006D4E84 /* SBJson4StreamParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4StreamParser.m; sourceTree = ""; }; - 034CB5341D7C6B8F006D4E84 /* SBJson4Parser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4Parser.m; sourceTree = ""; }; - 034CB5351D7C6B8F006D4E84 /* SBJson4Writer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4Writer.m; sourceTree = ""; }; - 034CB5361D7C6B8F006D4E84 /* SBJson4Writer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4Writer.h; sourceTree = ""; }; - 034CB5371D7C6B8F006D4E84 /* SBJson4StreamParserState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4StreamParserState.m; sourceTree = ""; }; - 034CB5381D7C6B8F006D4E84 /* SBJson4StreamTokeniser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJson4StreamTokeniser.m; sourceTree = ""; }; - 034CB5391D7C6B8F006D4E84 /* SBJson4StreamTokeniser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson4StreamTokeniser.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 034CB51E1D7C6B80006D4E84 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034CB5181D7C6B80006D4E84 = { - isa = PBXGroup; - children = ( - 034CB52B1D7C6B8F006D4E84 /* SBJson4.h */, - 034CB52C1D7C6B8F006D4E84 /* SBJson4StreamWriterState.m */, - 034CB52D1D7C6B8F006D4E84 /* SBJson4StreamWriterState.h */, - 034CB52E1D7C6B8F006D4E84 /* SBJson4StreamParserState.h */, - 034CB52F1D7C6B8F006D4E84 /* SBJson4StreamWriter.h */, - 034CB5301D7C6B8F006D4E84 /* SBJson4StreamWriter.m */, - 034CB5311D7C6B8F006D4E84 /* SBJson4StreamParser.h */, - 034CB5321D7C6B8F006D4E84 /* SBJson4Parser.h */, - 034CB5331D7C6B8F006D4E84 /* SBJson4StreamParser.m */, - 034CB5341D7C6B8F006D4E84 /* SBJson4Parser.m */, - 034CB5351D7C6B8F006D4E84 /* SBJson4Writer.m */, - 034CB5361D7C6B8F006D4E84 /* SBJson4Writer.h */, - 034CB5371D7C6B8F006D4E84 /* SBJson4StreamParserState.m */, - 034CB5381D7C6B8F006D4E84 /* SBJson4StreamTokeniser.m */, - 034CB5391D7C6B8F006D4E84 /* SBJson4StreamTokeniser.h */, - 034CB5231D7C6B80006D4E84 /* test_SBJSON */, - 034CB5221D7C6B80006D4E84 /* Products */, - ); - sourceTree = ""; - }; - 034CB5221D7C6B80006D4E84 /* Products */ = { - isa = PBXGroup; - children = ( - 034CB5211D7C6B80006D4E84 /* test_SBJSON */, - ); - name = Products; - sourceTree = ""; - }; - 034CB5231D7C6B80006D4E84 /* test_SBJSON */ = { - isa = PBXGroup; - children = ( - 034CB5241D7C6B80006D4E84 /* main.m */, - ); - path = test_SBJSON; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 034CB5201D7C6B80006D4E84 /* test_SBJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = 034CB5281D7C6B80006D4E84 /* Build configuration list for PBXNativeTarget "test_SBJSON" */; - buildPhases = ( - 034CB51D1D7C6B80006D4E84 /* Sources */, - 034CB51E1D7C6B80006D4E84 /* Frameworks */, - 034CB51F1D7C6B80006D4E84 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_SBJSON; - productName = test_SBJSON; - productReference = 034CB5211D7C6B80006D4E84 /* test_SBJSON */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 034CB5191D7C6B80006D4E84 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 034CB5201D7C6B80006D4E84 = { - CreatedOnToolsVersion = 7.3; - }; - }; - }; - buildConfigurationList = 034CB51C1D7C6B80006D4E84 /* Build configuration list for PBXProject "test_SBJSON" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 034CB5181D7C6B80006D4E84; - productRefGroup = 034CB5221D7C6B80006D4E84 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 034CB5201D7C6B80006D4E84 /* test_SBJSON */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 034CB51D1D7C6B80006D4E84 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 034CB53F1D7C6B8F006D4E84 /* SBJson4StreamParserState.m in Sources */, - 034CB53C1D7C6B8F006D4E84 /* SBJson4StreamParser.m in Sources */, - 034CB53A1D7C6B8F006D4E84 /* SBJson4StreamWriterState.m in Sources */, - 034CB5251D7C6B80006D4E84 /* main.m in Sources */, - 034CB53D1D7C6B8F006D4E84 /* SBJson4Parser.m in Sources */, - 034CB53E1D7C6B8F006D4E84 /* SBJson4Writer.m in Sources */, - 034CB5401D7C6B8F006D4E84 /* SBJson4StreamTokeniser.m in Sources */, - 034CB53B1D7C6B8F006D4E84 /* SBJson4StreamWriter.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 034CB5261D7C6B80006D4E84 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 034CB5271D7C6B80006D4E84 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 034CB5291D7C6B80006D4E84 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 034CB52A1D7C6B80006D4E84 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 034CB51C1D7C6B80006D4E84 /* Build configuration list for PBXProject "test_SBJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 034CB5261D7C6B80006D4E84 /* Debug */, - 034CB5271D7C6B80006D4E84 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 034CB5281D7C6B80006D4E84 /* Build configuration list for PBXNativeTarget "test_SBJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 034CB5291D7C6B80006D4E84 /* Debug */, - 034CB52A1D7C6B80006D4E84 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 034CB5191D7C6B80006D4E84 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 2fd2e6eba..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index d73847b5b..000000000 Binary files a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b45415..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_SBJSON.xcscheme b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_SBJSON.xcscheme deleted file mode 100644 index e350ad3d6..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_SBJSON.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 8a85eaf78..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_SBJSON.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 034CB5201D7C6B80006D4E84 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON/main.m b/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON/main.m deleted file mode 100644 index 5ff423a0e..000000000 --- a/tests/JSONTestSuite/parsers/test_SBJSON/test_SBJSON/main.m +++ /dev/null @@ -1,38 +0,0 @@ -// -// main.m -// test_SBJSON -// -// Created by nst on 04/09/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#import -#import "SBJson4.h" - -int main(int argc, const char * argv[]) { - @autoreleasepool { - - SBJson4Parser *parser = [SBJson4Parser parserWithBlock:^(id item, BOOL *stop) { - //NSLog(@"-- %@", item); - exit(0); - } - allowMultiRoot:NO - unwrapRootArray:NO - errorHandler:^(NSError *error) { - //NSLog(@"%@", error); - exit(1); - }]; - - NSString *path = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding]; - NSData *data = [NSData dataWithContentsOfFile:path]; - SBJson4ParserStatus status = [parser parse:data]; - - if (status == SBJson4ParserComplete) exit(0); - if (status == SBJson4ParserStopped) exit(1); - if (status == SBJson4ParserWaitingForData) exit(1); - if (status == SBJson4ParserError) exit(1); - - [[NSRunLoop currentRunLoop] run]; - } - return 0; -} diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.pbxproj deleted file mode 100644 index 335cf9f61..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.pbxproj +++ /dev/null @@ -1,361 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 035DA2FC1DB503D100C8895E /* STJSONParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035DA2FB1DB503D100C8895E /* STJSONParser.swift */; }; - 035DA3041DB503EC00C8895E /* STJSONTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035DA3031DB503EC00C8895E /* STJSONTests.swift */; }; - 035DA3091DB5044600C8895E /* STJSONParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035DA2FB1DB503D100C8895E /* STJSONParser.swift */; }; - 03B473A41DB7D0F600345B26 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035DA2F41DB503C400C8895E /* main.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 035DA2EF1DB503C400C8895E /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 035DA2F11DB503C400C8895E /* STJSON */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = STJSON; sourceTree = BUILT_PRODUCTS_DIR; }; - 035DA2F41DB503C400C8895E /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 035DA2FB1DB503D100C8895E /* STJSONParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = STJSONParser.swift; sourceTree = ""; }; - 035DA3011DB503EC00C8895E /* STJSONTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = STJSONTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 035DA3031DB503EC00C8895E /* STJSONTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STJSONTests.swift; sourceTree = ""; }; - 035DA3051DB503EC00C8895E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 035DA2EE1DB503C400C8895E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 035DA2FE1DB503EC00C8895E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 035DA2E81DB503C400C8895E = { - isa = PBXGroup; - children = ( - 035DA2F31DB503C400C8895E /* STJSON */, - 035DA3021DB503EC00C8895E /* STJSONTests */, - 035DA2F21DB503C400C8895E /* Products */, - ); - sourceTree = ""; - }; - 035DA2F21DB503C400C8895E /* Products */ = { - isa = PBXGroup; - children = ( - 035DA2F11DB503C400C8895E /* STJSON */, - 035DA3011DB503EC00C8895E /* STJSONTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 035DA2F31DB503C400C8895E /* STJSON */ = { - isa = PBXGroup; - children = ( - 035DA2FB1DB503D100C8895E /* STJSONParser.swift */, - 035DA2F41DB503C400C8895E /* main.swift */, - ); - path = STJSON; - sourceTree = ""; - }; - 035DA3021DB503EC00C8895E /* STJSONTests */ = { - isa = PBXGroup; - children = ( - 035DA3031DB503EC00C8895E /* STJSONTests.swift */, - 035DA3051DB503EC00C8895E /* Info.plist */, - ); - path = STJSONTests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 035DA2F01DB503C400C8895E /* STJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = 035DA2F81DB503C400C8895E /* Build configuration list for PBXNativeTarget "STJSON" */; - buildPhases = ( - 035DA2ED1DB503C400C8895E /* Sources */, - 035DA2EE1DB503C400C8895E /* Frameworks */, - 035DA2EF1DB503C400C8895E /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = STJSON; - productName = STJSON; - productReference = 035DA2F11DB503C400C8895E /* STJSON */; - productType = "com.apple.product-type.tool"; - }; - 035DA3001DB503EC00C8895E /* STJSONTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 035DA3061DB503EC00C8895E /* Build configuration list for PBXNativeTarget "STJSONTests" */; - buildPhases = ( - 035DA2FD1DB503EC00C8895E /* Sources */, - 035DA2FE1DB503EC00C8895E /* Frameworks */, - 035DA2FF1DB503EC00C8895E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = STJSONTests; - productName = STJSONTests; - productReference = 035DA3011DB503EC00C8895E /* STJSONTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 035DA2E91DB503C400C8895E /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0810; - LastUpgradeCheck = 0810; - ORGANIZATIONNAME = ch.seriot; - TargetAttributes = { - 035DA2F01DB503C400C8895E = { - CreatedOnToolsVersion = 8.1; - ProvisioningStyle = Automatic; - }; - 035DA3001DB503EC00C8895E = { - CreatedOnToolsVersion = 8.1; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 035DA2EC1DB503C400C8895E /* Build configuration list for PBXProject "STJSON" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 035DA2E81DB503C400C8895E; - productRefGroup = 035DA2F21DB503C400C8895E /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 035DA2F01DB503C400C8895E /* STJSON */, - 035DA3001DB503EC00C8895E /* STJSONTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 035DA2FF1DB503EC00C8895E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 035DA2ED1DB503C400C8895E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03B473A41DB7D0F600345B26 /* main.swift in Sources */, - 035DA2FC1DB503D100C8895E /* STJSONParser.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 035DA2FD1DB503EC00C8895E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 035DA3041DB503EC00C8895E /* STJSONTests.swift in Sources */, - 035DA3091DB5044600C8895E /* STJSONParser.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 035DA2F61DB503C400C8895E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 035DA2F71DB503C400C8895E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 035DA2F91DB503C400C8895E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 035DA2FA1DB503C400C8895E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; - 035DA3071DB503EC00C8895E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = STJSONTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = ch.seriot.STJSONTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 035DA3081DB503EC00C8895E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = STJSONTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = ch.seriot.STJSONTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 035DA2EC1DB503C400C8895E /* Build configuration list for PBXProject "STJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035DA2F61DB503C400C8895E /* Debug */, - 035DA2F71DB503C400C8895E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 035DA2F81DB503C400C8895E /* Build configuration list for PBXNativeTarget "STJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035DA2F91DB503C400C8895E /* Debug */, - 035DA2FA1DB503C400C8895E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 035DA3061DB503EC00C8895E /* Build configuration list for PBXNativeTarget "STJSONTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 035DA3071DB503EC00C8895E /* Debug */, - 035DA3081DB503EC00C8895E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 035DA2E91DB503C400C8895E /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b6df6c4e1..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/xcshareddata/STJSON.xcscmblueprint b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/xcshareddata/STJSON.xcscmblueprint deleted file mode 100644 index 6f124e396..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/xcshareddata/STJSON.xcscmblueprint +++ /dev/null @@ -1,30 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : 9223372036854775807, - "4AEDBEBDB8C4256C790C244CE3F134EA5FC433C3" : 9223372036854775807 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "48F90820-450B-4A88-B246-7C94B65E7D49", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" : "dropbox\/", - "4AEDBEBDB8C4256C790C244CE3F134EA5FC433C3" : "STJSON\/" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "STJSON", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "JSON\/parsers\/test_STJSON\/STJSON.xcodeproj", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/nst\/STJSON.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "4AEDBEBDB8C4256C790C244CE3F134EA5FC433C3" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "\/Users\/nst\/Dropbox\/dropbox.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "ED13D74FC1ED9BC322EA1859E5AD7D001676FA6A" - } - ] -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index f39a9f640..000000000 Binary files a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/STJSON.xcscheme b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/STJSON.xcscheme deleted file mode 100644 index 52adaae50..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/STJSON.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/STJSONTests.xcscheme b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/STJSONTests.xcscheme deleted file mode 100644 index 512d2d297..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/STJSONTests.xcscheme +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index b580741e7..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - SchemeUserState - - STJSON.xcscheme - - orderHint - 0 - - STJSONTests.xcscheme - - orderHint - 1 - - - SuppressBuildableAutocreation - - 035DA2F01DB503C400C8895E - - primary - - - 035DA3001DB503EC00C8895E - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON/STJSONParser.swift b/tests/JSONTestSuite/parsers/test_STJSON/STJSON/STJSONParser.swift deleted file mode 100644 index eeb06867f..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON/STJSONParser.swift +++ /dev/null @@ -1,663 +0,0 @@ -// -// JSONParser.swift -// JSON -// -// Created by Nicolas Seriot on 12/07/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -import Foundation - -public struct STJSONParser { - - public struct Options: OptionSet { - // https://oleb.net/blog/2016/09/swift-option-sets/ - - public let rawValue: Int - - public init(rawValue:Int) { - self.rawValue = rawValue - } - - static let useUnicodeReplacementCharacter = Options(rawValue: 1) - } - - enum ASCIIByte : UInt8 { - case objectOpen = 0x7B // { - case tab = 0x09 // \t - case newline = 0x0A // \n - case space = 0x20 // " " - case carriageReturn = 0x0D // \r - case doubleQuote = 0x22 // " - case semiColon = 0x3A // : - case objectClose = 0x7D // } - case comma = 0x2C // , - case arrayOpen = 0x5B // [ - case arrayClose = 0x5D // ] - case slash = 0x2F // / - case backSlash = 0x5C // \ - case plus = 0x2B // + - case minus = 0x2D // - - case dot = 0x2E // . - case zero = 0x30 // 0 - case one = 0x31 // 1 - case nine = 0x39 // 9 - case utf8BOMByte1 = 0xEF - case utf8BOMByte2 = 0xBB - case utf8BOMByte3 = 0xBF - case A = 0x41 - case E = 0x45 - case F = 0x46 - case Z = 0x5A - case a = 0x61 - case z = 0x7A - case e = 0x65 - case f = 0x66 - case l = 0x6C - case n = 0x6e - case r = 0x72 - case s = 0x73 - case t = 0x74 - case u = 0x75 - } - - let data : Data - var i = 0 - let dataLength : Int - var parserDepth = 0 - var maxParserDepth : Int - let REPLACEMENT_STRING = "\u{FFFD}" - var options : Options - - init(data:Data, maxParserDepth : Int = 512, options:Options = []) { - self.maxParserDepth = maxParserDepth - self.data = data - self.dataLength = data.count - self.options = options - } - - func printRemainingString() { - let range = Range(uncheckedBounds: (i, data.count)) - let remainingData = data.subdata(in:range) - guard let remainingString = String(data:remainingData, encoding: .utf8) else { - print("-- can't print remaining string") - return - } - print("-- REMAINING STRING FROM \(i): \(remainingString)") - } - - func read() -> UInt8? { - guard i < dataLength else { /* print("can't read at index \(i)"); */ return nil } - return data[i] - } - - mutating func readAndMoveByteEither(_ a:[ASCIIByte]) -> UnicodeScalar? { - - guard let byte = read() else { return nil } - - for b in a { - if byte == b.rawValue { - i = i+1 - return UnicodeScalar(byte) - } - } - - return nil - } - - mutating func readAndMove(_ b:ASCIIByte) -> Bool { - - guard let byte = read() - , byte == b.rawValue else { return false } - - i = i+1 - - return true - } - - mutating func readAndMoveInByteRange(_ from:ASCIIByte, _ to:ASCIIByte) -> UnicodeScalar? { - - guard let byte = read() - , byte >= from.rawValue && byte <= to.rawValue else { return nil } - - i = i+1 - - return UnicodeScalar(byte) - } - - mutating func readAndMoveHexadecimalDigit() -> UInt8? { - - guard let byte = read() - , readAndMoveInByteRange(.zero, .nine) != nil - || readAndMoveInByteRange(.A, .F) != nil - || readAndMoveInByteRange(.a, .f) != nil else { - return nil - } - - return byte - } - - mutating func readAndMoveWhitespace() -> Bool { - return readAndMove(.tab) - || readAndMove(.newline) - || readAndMove(.carriageReturn) - || readAndMove(.space) - } - - mutating func readAndMoveAcceptableByte() -> Bool { - - guard let byte = read() - ,byte != ASCIIByte.doubleQuote.rawValue && byte != ASCIIByte.backSlash.rawValue && byte > 0x1F else { - return false - } - - i = i + 1 - - return true - } - - mutating func readArray() throws -> [Any] { - - while readAndMoveWhitespace() {} - - guard readAndMove(.arrayOpen) else { - throw JSONError.expectedArrayOpen(i:i) - } - parserDepth += 1 - guard parserDepth <= maxParserDepth else { throw JSONError.maxParserDepthReached(depth:maxParserDepth) } - - var a : [Any] = [] - - while readAndMoveWhitespace() {} - - if readAndMove(.arrayClose) { - parserDepth -= 1 - return a - } - - if let v = try readValue() { - a.append(v) - - while readAndMoveWhitespace() {} - - while readAndMove(.comma) { - guard let v = try readValue() else { - throw JSONError.expectedValue(i:i) - } - a.append(v) - - while readAndMoveWhitespace() {} - } - } - - guard readAndMove(.arrayClose) else { - throw JSONError.expectedArrayClose(i:i) - } - parserDepth -= 1 - - return a - } - - func unescape(_ byte:UInt8) throws -> UInt8 { - if byte == ASCIIByte.backSlash.rawValue - || byte == ASCIIByte.doubleQuote.rawValue - || byte == ASCIIByte.slash.rawValue { - return byte - } - - if byte == UInt8(ascii: "b") { return 0x08 } // \b backspace - if byte == UInt8(ascii: "f") { return 0x0C } // \f form feed - if byte == UInt8(ascii: "n") { return 0x0A } // \n line feed - if byte == UInt8(ascii: "r") { return 0x0D } // \r carriage return - if byte == UInt8(ascii: "t") { return 0x09 } // \t tabulation - - throw JSONError.expectedCharacterToBeUnescaped(i:i) - } - - /* - func isValidCodepoint(codepoint cp:Int) -> Bool { - // http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf - // Table 3-7. Well-Formed UTF-8 Byte Sequences - return (cp >= 0 && cp <= 0xD7FF) || (cp >= 0xE000 && cp <= 0x10FFFF) - } - */ - - func isHighSurrogate(codepoint cp:Int) -> Bool { - return cp >= 0xD800 && cp <= 0xDBFF - } - - func isLowSurrogate(codepoint cp:Int) -> Bool { - return cp >= 0xDC00 && cp <= 0xDFFF - } - - mutating func readAndMoveUEscapedCodepoint() -> (String, Int)? { - guard readAndMove(.u) else { return nil } - - guard let b1 = readAndMoveHexadecimalDigit() else { /*print("** expected hexadecimal digit");*/ return nil } - guard let b2 = readAndMoveHexadecimalDigit() else { /*print("** expected hexadecimal digit");*/ return nil } - guard let b3 = readAndMoveHexadecimalDigit() else { /*print("** expected hexadecimal digit");*/ return nil } - guard let b4 = readAndMoveHexadecimalDigit() else { /*print("** expected hexadecimal digit");*/ return nil } - - guard let s = String(bytes: [b1, b2, b3, b4], encoding: .utf8) else { - fatalError("** cannot convert \([b1, b2, b3, b4]) into string") - } - - return (s, strtol(s, nil, 16)) - } - - mutating func readAndMoveEscapedCodepointOrSurrogates() throws -> String? { - - let useReplacementString = self.options.contains(.useUnicodeReplacementCharacter) - - /* - http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf - -> 6.1.4 The String Type - // A code unit in the range 0 to 0xD7FF or in the range 0xE000 to 0xFFFF is interpreted as a code point with the same value. - * A sequence of two code units, where the first code unit c1 is in the range 0xD800 to 0xDBFF and the second code unit c2 - is in the range 0xDC00 to 0xDFFF, is a surrogate pair and is interpreted as a code point with the value (c1 ‑ 0xD800) × - 0x400 + (c2 ‑ 0xDC00) + 0x10000. (See 10.1.2) - * A code unit that is in the range 0xD800 to 0xDFFF, but is not part of a surrogate pair, is interpreted as a code point with - the same value. - */ - - guard let (s1, c1) = readAndMoveUEscapedCodepoint() else { - return nil - } - - // valid codepoint -> return - if let u = UnicodeScalar(c1) { - return "\(u)" - } - - // invalid codepoint must be high surrogate, or error - guard isHighSurrogate(codepoint: c1) else { - return useReplacementString ? REPLACEMENT_STRING : "\\u\(s1)" - } - - // look for second surrogate escape character, or error - guard readAndMove(.backSlash) else { - return useReplacementString ? REPLACEMENT_STRING : "\\u\(s1)" - } - - // read second codepoint - guard let (s2, c2) = readAndMoveUEscapedCodepoint() else { - // or escaped sequence - let x = try readAndMoveEscapedSequence() - return useReplacementString ? REPLACEMENT_STRING + "\(x)" : "\\u\(s1)\(x)" - } - - // second codepoint must be low surrogate, or error - guard isLowSurrogate(codepoint: c2) else { - return useReplacementString ? REPLACEMENT_STRING + REPLACEMENT_STRING : "\\u\(s1)\\u\(s2)" - } - - let finalCodepoint = 0x400 + 0x2400 + (c1 - 0xD800) + (c2 - 0xDC00) + 0x10000 - guard let u = UnicodeScalar(finalCodepoint) else { - return useReplacementString ? REPLACEMENT_STRING + REPLACEMENT_STRING : "\\u\(s1)\\u\(s2)" - } - - return "\(u)" - } - - mutating func readAndMoveEscapedSequence() throws -> String { - - if let s = try readAndMoveEscapedCodepointOrSurrogates() { - return s - } - - guard let b = read() else { - throw JSONError.expectedCharacter(i:i) - } - - i = i + 1 - - let unescaped = try unescape(b) - - let data = Data(bytes: [unescaped]) - - guard let s = String(data:data, encoding:.utf8) else { - fatalError() - } - - return s - } - - mutating func readString() throws -> String { - - if readAndMove(.doubleQuote) == false { - throw JSONError.expectedDoubleQuote(i:i) - } - - var s : String = "" - - while readAndMove(.doubleQuote) == false { - - guard read() != nil else { - throw JSONError.expectedCharacter(i:i) - } - - if readAndMove(.backSlash) { - - let x = try readAndMoveEscapedSequence() - s.append(x) - - } else if readAndMoveAcceptableByte() { - - let start = i-1 - - while readAndMoveAcceptableByte() { - () - } - - let range = Range(uncheckedBounds: (start, i)) - - let subdata = data.subdata(in: range) - - guard let substring = String(data:subdata, encoding:.utf8) else { - throw JSONError.cannotBuildStringFromData(i:i) - } - - s.append(substring) - } else { - throw JSONError.expectedAcceptableCodepointOrEscapedSequence(i:i) - } - } - - return s - } - - mutating func readObject() throws -> [String:Any] { - - guard readAndMove(.objectOpen) else { - throw JSONError.expectedObjectOpen(i:i) - } - parserDepth += 1 - guard parserDepth <= maxParserDepth else { throw JSONError.maxParserDepthReached(depth:maxParserDepth) } - - var d : [String:Any] = [:] - - while readAndMoveWhitespace() {} - - if readAndMove(.objectClose) { - parserDepth -= 1 - return d - } - - repeat { - - while readAndMoveWhitespace() {} - - let s = try readString() - - while readAndMoveWhitespace() {} - - guard readAndMove(.semiColon) else { - throw JSONError.expectedSemicolon(i:i) - } - - guard let v = try readValue() else { - throw JSONError.expectedValue(i:i) - } - - d[s] = v - - while readAndMoveWhitespace() {} - - } while readAndMove(.comma) - - guard readAndMove(.objectClose) else { - throw JSONError.expectedObjectClose(i:i) - } - parserDepth -= 1 - - return d - } - - func throwIfStartsWithUTF16BOM() throws { - let BOM_LENGTH = 2 - - guard dataLength >= BOM_LENGTH else { return } - - let UTF_16_BE = Data(bytes: [0xFE, 0xFF]) - let UTF_16_LE = Data(bytes: [0xFF, 0xFE]) - - try data.withUnsafeBytes { (p:UnsafePointer) -> Void in - let BOM = Data(buffer: UnsafeBufferPointer(start: p, count: BOM_LENGTH)) - - if BOM == UTF_16_BE { throw JSONError.foundBOMForUnsupportdEncodingUTF16BE } - if BOM == UTF_16_LE { throw JSONError.foundBOMForUnsupportdEncodingUTF16LE } - } - } - - func throwIfStartsWithUTF32BOM() throws { - let BOM_LENGTH = 4 - - guard dataLength >= BOM_LENGTH else { return } - - let UTF_32_BE = Data(bytes: [0x00, 0x00, 0xFE, 0xFF]) - let UTF_32_LE = Data(bytes: [0xFF, 0xFE, 0x00, 0x00]) - - try data.withUnsafeBytes { (p:UnsafePointer) -> Void in - let BOM = Data(buffer: UnsafeBufferPointer(start: p, count: BOM_LENGTH)) - - if BOM == UTF_32_BE { throw JSONError.foundBOMForUnsupportdEncodingUTF32BE } - if BOM == UTF_32_LE { throw JSONError.foundBOMForUnsupportdEncodingUTF32LE } - } - } - - mutating func parse() throws -> Any? { - - // throw if a UTF-16 or UTF-32 BOM is found - // this is the only place where STJSON does not follow RFC 7159 - // which supports UTF-16 anf UTF-32, optionnaly preceeded by a BOM - // STJSON only supports UTF-8 - try throwIfStartsWithUTF16BOM() - try throwIfStartsWithUTF32BOM() - - // skip UTF-8 BOM if present (EF BB BF) - if readAndMove(.utf8BOMByte1) { - guard readAndMove(.utf8BOMByte2) else { return nil} - guard readAndMove(.utf8BOMByte3) else { return nil} - } - - let o = try readValue() - - while readAndMoveWhitespace() {} - guard read() == nil else { - throw JSONError.extraData(i:i) - } - return o - } - - func myDouble(_ s:String) -> Double? { - - return s.withCString() { startPointer -> Double in - - var doubleEndPointer : UnsafeMutablePointer? = nil - - return strtod(startPointer, &doubleEndPointer) - } - } - -// func myInt(_ s:String) -> Int? { -// -// return s.withCString() { startPointer -> Int in -// -// var intEndPointer : UnsafeMutablePointer? = nil -// -// return strtol(startPointer, &intEndPointer, 10) -// } -// } - - mutating func readValue() throws -> Any? { - - while readAndMoveWhitespace() {} - - guard let byte = read() else { - throw JSONError.cannotReadByte(i:i) - } - - switch(byte) { - case ASCIIByte.arrayOpen.rawValue: - return try readArray() - case ASCIIByte.doubleQuote.rawValue: - return try readString() - case ASCIIByte.objectOpen.rawValue: - return try readObject() - case ASCIIByte.t.rawValue: - let start_pos = i - if readAndMove(.t) - && readAndMove(.r) - && readAndMove(.u) - && readAndMove(.e) { - return true - } - throw JSONError.foundGarbage(i: start_pos) - case ASCIIByte.f.rawValue: - let start_pos = i - if readAndMove(.f) - && readAndMove(.a) - && readAndMove(.l) - && readAndMove(.s) - && readAndMove(.e) { - return false - } - throw JSONError.foundGarbage(i: start_pos) - case ASCIIByte.n.rawValue: - let start_pos = i - if readAndMove(.n) - && readAndMove(.u) - && readAndMove(.l) - && readAndMove(.l) { - return NSNull() - } - throw JSONError.foundGarbage(i: start_pos) - default: - guard let (isADouble, n) = try readNumber() else { - throw JSONError.expectedNumber(i: i) - } - - guard let d = myDouble(n) else { - print("n is not a double") - return nil - } - - if d.isInfinite { - print("d is infinite") - return nil - } - - if d.isNaN { - print("d in NaN") - return nil - } - - if isADouble { - return d - } - - if d > Double(Int.max) { - return n // Int cannot represent n, so we return the string - } - - if d < Double(Int.min) { - return n // Int cannot represent n, so we return the string - } - - return Int(d) - } - } - - enum JSONError: Error { - case cannotReadByte(i:Int) - case expectedDigit(i:Int) - case expectedCharacterToBeUnescaped(i:Int) - case expectedValue(i:Int) - case expectedString(i:Int) - case expectedNumber(i:Int) - case expectedSemicolon(i:Int) - case expectedObjectOpen(i:Int) - case expectedObjectContent(i:Int) - case expectedObjectClose(i:Int) - case expectedArrayOpen(i:Int) - case expectedArrayClose(i:Int) - case expectedDoubleQuote(i:Int) - case expectedCharacter(i:Int) - case cannotBuildStringFromData(i:Int) - case expectedAcceptableCodepointOrEscapedSequence(i:Int) - case cannotReadInt(i:Int) - case extraData(i:Int) - case maxParserDepthReached(depth:Int) - case foundGarbage(i:Int) - case expectedHighSurrogate(i:Int) - case expectedLowSurrogate(i:Int) - case foundSurrogatesWithInvalidCodepoint(i:Int) - case foundBOMForUnsupportdEncodingUTF16BE - case foundBOMForUnsupportdEncodingUTF16LE - case foundBOMForUnsupportdEncodingUTF32BE - case foundBOMForUnsupportdEncodingUTF32LE - } - - mutating func readNumber() throws -> (Bool, String)? { - - var isADouble = false - - var s = "" - - if readAndMove(.minus) { - s.append("-") - } - - guard let b = read() - , b >= ASCIIByte.zero.rawValue && b <= ASCIIByte.nine.rawValue else { return nil } - - if readAndMove(.zero) { - s.append("0") - } else if let d = readAndMoveInByteRange(.one, .nine) { - s.append(String(d)) - while let d = readAndMoveInByteRange(.zero, .nine) { - s.append(String(d)) - } - } - - if readAndMove(.dot) { - isADouble = true - - s.append(".") - - var digitFound = false - - while let d = readAndMoveInByteRange(.zero, .nine) { - digitFound = true - s.append(String(d)) - } - - guard digitFound else { - throw JSONError.expectedDigit(i: i) - } - } - - if let x = readAndMoveByteEither([.e, .E]) { - isADouble = true - - s.append(String(x)) - - if let x = readAndMoveByteEither([.plus, .minus]) { - s.append(String(x)) - } - - var digitFound = false - - while let d = readAndMoveInByteRange(.zero, .nine) { - digitFound = true - s.append(String(d)) - } - - guard digitFound else { - throw JSONError.expectedDigit(i: i) - } - } - - return (isADouble, s) - } -} diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSON/main.swift b/tests/JSONTestSuite/parsers/test_STJSON/STJSON/main.swift deleted file mode 100644 index b79f40924..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSON/main.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// main.swift -// STJSON -// -// Created by Nicolas Seriot on 17.10.16. -// Copyright © 2016 ch.seriot. All rights reserved. -// - -import Foundation - -func main() { - - guard ProcessInfo.processInfo.arguments.count == 2 else { - let url = URL(fileURLWithPath: ProcessInfo.processInfo.arguments[0]) - let programName = url.lastPathComponent - print("Usage: ./\(programName) file.json") - exit(1) - } - - let path = ProcessInfo.processInfo.arguments[1] - let url = NSURL.fileURL(withPath:path) - - do { - let data = try Data(contentsOf:url) - - //var p = JSONParser(data: data, maxParserDepth:10, options:[.useUnicodeReplacementCharacter]) - var p = STJSONParser(data: data) - do { - let o = try p.parse() - - guard o != nil else { - exit(1) - } - - exit(0) - } catch let e { - print(e) - exit(1) - } - } catch let e { - print("*** CANNOT READ DATA AT \(url)") - print(e) - exit(1) - } -} - -main() diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSONTests/Info.plist b/tests/JSONTestSuite/parsers/test_STJSON/STJSONTests/Info.plist deleted file mode 100644 index 6c6c23c43..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSONTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/tests/JSONTestSuite/parsers/test_STJSON/STJSONTests/STJSONTests.swift b/tests/JSONTestSuite/parsers/test_STJSON/STJSONTests/STJSONTests.swift deleted file mode 100644 index 1114cb486..000000000 --- a/tests/JSONTestSuite/parsers/test_STJSON/STJSONTests/STJSONTests.swift +++ /dev/null @@ -1,92 +0,0 @@ -// -// STJSONTests.swift -// STJSONTests -// -// Created by Nicolas Seriot on 17.10.16. -// Copyright © 2016 ch.seriot. All rights reserved. -// - -import XCTest - -class STJSONTests: XCTestCase { - - func parseData(data:Data) -> Any? { - - var p = STJSONParser(data: data) - do { - //try data.write(to: URL(fileURLWithPath: "/Users/nst/Desktop/data.json")) - return try p.parse() - } catch let e { - print(e) - return nil - } - } - - func parseString(_ s:String) -> Any? { - guard let data = s.data(using: String.Encoding.utf8) else { XCTFail(); return nil } - - return parseData(data:data) - } - - func testCases() { - let dir = "/Users/nst/Projects/dropbox/JSON/test_cases/" - - guard let enumerator = FileManager.default.enumerator(atPath: dir) else { - // please checkout tests from https://github.com/nst/JSONTestSuite - // and setup the path in this method - XCTFail() - return - } - - for filename in enumerator where (filename as! NSString).pathExtension == "json" { - - guard let s = filename as? String else { continue } - - let url = URL(fileURLWithPath: dir+s) - - print("*** testing \(s)") - - do { - let data = try Data(contentsOf: url) - - let o = parseData(data:data) - - if s.hasPrefix("n_") { - if o != nil { - print("STJSON\tSHOULD_HAVE_FAILED\t\(filename)") - } - XCTAssertNil(o) - } else if s.hasPrefix("y_") { - if o == nil { - print("STJSON\tSHOULD_HAVE_PASSED\t\(filename)") - } - XCTAssertNotNil(o) - } else if o == nil { - print("STJSON\tIMPLEMENTATION_FAIL\t\(filename)") - } else { - print("STJSON\tIMPLEMENTATION_PASS\t\(filename)") - } - } catch let e { - print(e) - XCTFail() - } - } - } - - func testReadDouble() { - XCTAssertEqual(2.0, STJSONParser(data:Data()).myDouble("2.0")) - } - - func testReadDoubleWithExponent() { - XCTAssertEqual(100.0, STJSONParser(data:Data()).myDouble("10.0e1")) - } - - func testReadExponent() { - - let i = Int(Double("20e2")!) - print("***", i) - - let o = parseString("[20e2]") as! [Double] - XCTAssertEqual([2000], o) - } -} diff --git a/tests/JSONTestSuite/parsers/test_STJSON/bin/STJSON b/tests/JSONTestSuite/parsers/test_STJSON/bin/STJSON deleted file mode 100755 index a6019318c..000000000 Binary files a/tests/JSONTestSuite/parsers/test_STJSON/bin/STJSON and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Info.plist b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Info.plist deleted file mode 100644 index a87a3ce20..000000000 --- a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Info.plist +++ /dev/null @@ -1,563 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - NSSupportsAutomaticGraphicsSwitching - - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - image - - CFBundleTypeIconFile - SqueakImage.icns - CFBundleTypeName - Squeak Image File - CFBundleTypeOSTypes - - STim - - CFBundleTypeRole - Editor - - - CFBundleTypeExtensions - - sources - - CFBundleTypeIconFile - SqueakSources.icns - CFBundleTypeName - Squeak Sources File - CFBundleTypeOSTypes - - STso - - CFBundleTypeRole - Editor - - - CFBundleTypeExtensions - - changes - - CFBundleTypeIconFile - SqueakChanges.icns - CFBundleTypeName - Squeak Changes File - CFBundleTypeOSTypes - - STch - - CFBundleTypeRole - Editor - - - CFBundleTypeExtensions - - sobj - - CFBundleTypeIconFile - SqueakScript.icns - CFBundleTypeName - Squeak Script File - CFBundleTypeOSTypes - - SOBJ - - CFBundleTypeRole - Editor - - - CFBundleTypeExtensions - - pr - - CFBundleTypeIconFile - SqueakProject.icns - CFBundleTypeName - Squeak Project File - CFBundleTypeOSTypes - - STpr - - CFBundleTypeRole - Editor - - - CFBundleTypeName - JPEG - CFBundleTypeOSTypes - - JPEG - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - TEXT - CFBundleTypeOSTypes - - TEXT - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - ttro - CFBundleTypeOSTypes - - ttro - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - HTML - CFBundleTypeOSTypes - - HTML - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - RTF - CFBundleTypeOSTypes - - RTF - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - TIFF - CFBundleTypeOSTypes - - TIFF - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - PICT - CFBundleTypeOSTypes - - PICT - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - URL - CFBundleTypeOSTypes - - URL - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - ZIP - CFBundleTypeOSTypes - - ZIP - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - zip - CFBundleTypeOSTypes - - zip - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - BINA - CFBundleTypeOSTypes - - BINA - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - GIFf - CFBundleTypeOSTypes - - GIFf - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - PNGf - CFBundleTypeOSTypes - - PNGf - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MP3 - CFBundleTypeOSTypes - - MP3 - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MP3! - CFBundleTypeOSTypes - - MP3! - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MP3U - CFBundleTypeOSTypes - - MP3U - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MPEG - CFBundleTypeOSTypes - - MPEG - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - mp3! - CFBundleTypeOSTypes - - mp3! - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MPG2 - CFBundleTypeOSTypes - - MPG2 - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MPG3 - CFBundleTypeOSTypes - - MPG3 - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - MPG - CFBundleTypeOSTypes - - MPG - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - Mp3 - CFBundleTypeOSTypes - - mp3 - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - M3U - CFBundleTypeOSTypes - - M3U - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - SRCS - CFBundleTypeOSTypes - - SRCS - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - Chng - CFBundleTypeOSTypes - - Chng - - CFBundleTypeRole - Viewer - - - CFBundleTypeName - HPS5 - CFBundleTypeOSTypes - - HPS5 - - CFBundleTypeRole - Viewer - - - CFBundleExecutable - Squeak - CFBundleGetInfoString - Squeak ., - CFBundleShortVersionString - - CFBundleIconFile - Squeak.icns - CFBundleIdentifier - org.squeak.Squeak$(VM_MONIKER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Squeak 5.0 - CFBundlePackageType - APPL - CFBundleSignature - FAST - CFBundleVersion - - LSBackgroundOnly - - LSMinimumSystemVersion - 10.9.0 - NSMainNibFile - MainMenu - NSPrincipalClass - SqueakOSXApplication - UTExportedTypeDeclarations - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Squeak Image File - UTTypeIdentifier - org.squeak.image - UTTypeTagSpecification - - com.apple.ostype - STim - public.filename-extension - - image - - public.mime-type - application/squeak-image - - - - UTTypeConformsTo - - public.utf8-plain-text - - UTTypeDescription - Squeak Sources File - UTTypeIdentifier - org.squeak.sources - UTTypeTagSpecification - - com.apple.ostype - STso - public.filename-extension - - sources - - public.mime-type - application/squeak-sources - - - - UTTypeConformsTo - - public.utf8-plain-text - - UTTypeDescription - Squeak Changes File - UTTypeIdentifier - org.squeak.changes - UTTypeTagSpecification - - com.apple.ostype - STch - public.filename-extension - - changes - - public.mime-type - application/squeak-changes - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Squeak Script File - UTTypeIdentifier - org.squeak.script - UTTypeTagSpecification - - com.apple.ostype - SOBJ - public.filename-extension - - sobj - - public.mime-type - application/squeak-script - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Squeak Project File - UTTypeIdentifier - org.squeak.project - UTTypeTagSpecification - - com.apple.ostype - STpr - public.filename-extension - - pr - - public.mime-type - application/x-squeak-project - - - - SqueakBrowserMouseCmdButton1 - 3 - SqueakBrowserMouseCmdButton2 - 3 - SqueakBrowserMouseCmdButton3 - 2 - SqueakBrowserMouseControlButton1 - 1 - SqueakBrowserMouseControlButton2 - 3 - SqueakBrowserMouseControlButton3 - 2 - SqueakBrowserMouseNoneButton1 - 1 - SqueakBrowserMouseNoneButton2 - 3 - SqueakBrowserMouseNoneButton3 - 2 - SqueakBrowserMouseOptionButton1 - 2 - SqueakBrowserMouseOptionButton2 - 3 - SqueakBrowserMouseOptionButton3 - 2 - SqueakDebug - 0 - SqueakEncodingType - UTF-8 - SqueakExplicitWindowOpenNeeded - - SqueakImageName - Squeak5.0-15113.image - - SqueakMouseCmdButton1 - 3 - SqueakMouseCmdButton2 - 3 - SqueakMouseCmdButton3 - 2 - SqueakMouseControlButton1 - 1 - SqueakMouseControlButton2 - 3 - SqueakMouseControlButton3 - 2 - SqueakMouseNoneButton1 - 1 - SqueakMouseNoneButton2 - 3 - SqueakMouseNoneButton3 - 2 - SqueakMouseOptionButton1 - 2 - SqueakMouseOptionButton2 - 3 - SqueakMouseOptionButton3 - 2 - SqueakPluginsBuiltInOrLocalOnly - - SqueakQuitOnQuitAppleEvent - - SqueakTrustedDirectory - /foobar/tooBar/forSqueak/bogus/ - SqueakUnTrustedDirectory - ~/Library/Preferences/Squeak/Internet/My Squeak/ - SqueakWindowAttribute - ggAAHw== - SqueakWindowHasTitle - - SqueakWindowType - 6 - - diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/MacOS/Squeak b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/MacOS/Squeak deleted file mode 100755 index cd8b340fe..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/MacOS/Squeak and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/English.lproj/Localizable.strings b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/English.lproj/Localizable.strings deleted file mode 100644 index c8bf25e2d..000000000 --- a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/English.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* Localized versions of Info.plist keys - Localizable.strings - SqueakPureObjc - - Created by John M McIntosh on 09-11-24. - Copyright 2009 Corporate Smalltalk Consulting Ltd. All rights reserved. - */ - -"SelectImagePanePrompt" = "Select a Squeak image file to open"; diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/English.lproj/MainMenu.nib b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/English.lproj/MainMenu.nib deleted file mode 100644 index c0679d3c8..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/English.lproj/MainMenu.nib and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/Squeak.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/Squeak.icns deleted file mode 100644 index a1c801c0b..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/Squeak.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakChanges.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakChanges.icns deleted file mode 100755 index 6f5dc61cf..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakChanges.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakGeneric.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakGeneric.icns deleted file mode 100755 index a1b25e137..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakGeneric.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakImage.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakImage.icns deleted file mode 100755 index b3eb84ae5..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakImage.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakPlugin.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakPlugin.icns deleted file mode 100755 index 5f5e33f70..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakPlugin.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakProject.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakProject.icns deleted file mode 100755 index b5eae0f34..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakProject.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakScript.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakScript.icns deleted file mode 100755 index b5eae0f34..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakScript.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakSources.icns b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakSources.icns deleted file mode 100755 index b6974c6c7..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakSources.icns and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak5.1-16549-32bit.image b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak5.1-16549-32bit.image deleted file mode 100644 index 2eefefda0..000000000 Binary files a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/Squeak5.1-16549-32bit.image and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/test_JSON.st b/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/test_JSON.st deleted file mode 100644 index 0f25e8a7a..000000000 --- a/tests/JSONTestSuite/parsers/test_Squeak_JSON_tonyg/test_JSON.st +++ /dev/null @@ -1,9 +0,0 @@ -| exitCode | -exitCode := 2. -[[[ - FileStream - readOnlyFileNamed: Smalltalk commandLine arguments first - do: [:strm | Json readFrom: strm. exitCode := 0]. -] on: JsonSyntaxError do: [exitCode := 1] -] on: Error do: [exitCode := 3] -] ensure: [Smalltalk snapshot: false andQuitWithExitCode: exitCode]. diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/bin/test_TouchJSON b/tests/JSONTestSuite/parsers/test_TouchJSON/bin/test_TouchJSON deleted file mode 100755 index e2060b40a..000000000 Binary files a/tests/JSONTestSuite/parsers/test_TouchJSON/bin/test_TouchJSON and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.pbxproj deleted file mode 100644 index 2462733d5..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.pbxproj +++ /dev/null @@ -1,262 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03DBC2FC1DAEE58E00BA6472 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DBC2FB1DAEE58E00BA6472 /* main.m */; }; - 03DBC3041DAEE5C800BA6472 /* CJSONDeserializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DBC3031DAEE5C800BA6472 /* CJSONDeserializer.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03DBC2F61DAEE58E00BA6472 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03DBC2F81DAEE58E00BA6472 /* test_TouchJSON */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_TouchJSON; sourceTree = BUILT_PRODUCTS_DIR; }; - 03DBC2FB1DAEE58E00BA6472 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 03DBC3021DAEE5A300BA6472 /* CJSONDeserializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CJSONDeserializer.h; sourceTree = ""; }; - 03DBC3031DAEE5C800BA6472 /* CJSONDeserializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CJSONDeserializer.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03DBC2F51DAEE58E00BA6472 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03DBC2EF1DAEE58E00BA6472 = { - isa = PBXGroup; - children = ( - 03DBC2FA1DAEE58E00BA6472 /* test_TouchJSON */, - 03DBC2F91DAEE58E00BA6472 /* Products */, - ); - sourceTree = ""; - }; - 03DBC2F91DAEE58E00BA6472 /* Products */ = { - isa = PBXGroup; - children = ( - 03DBC2F81DAEE58E00BA6472 /* test_TouchJSON */, - ); - name = Products; - sourceTree = ""; - }; - 03DBC2FA1DAEE58E00BA6472 /* test_TouchJSON */ = { - isa = PBXGroup; - children = ( - 03DBC3021DAEE5A300BA6472 /* CJSONDeserializer.h */, - 03DBC3031DAEE5C800BA6472 /* CJSONDeserializer.m */, - 03DBC2FB1DAEE58E00BA6472 /* main.m */, - ); - path = test_TouchJSON; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03DBC2F71DAEE58E00BA6472 /* test_TouchJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03DBC2FF1DAEE58E00BA6472 /* Build configuration list for PBXNativeTarget "test_TouchJSON" */; - buildPhases = ( - 03DBC2F41DAEE58E00BA6472 /* Sources */, - 03DBC2F51DAEE58E00BA6472 /* Frameworks */, - 03DBC2F61DAEE58E00BA6472 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_TouchJSON; - productName = test_TouchJSON; - productReference = 03DBC2F81DAEE58E00BA6472 /* test_TouchJSON */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03DBC2F01DAEE58E00BA6472 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03DBC2F71DAEE58E00BA6472 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03DBC2F31DAEE58E00BA6472 /* Build configuration list for PBXProject "test_TouchJSON" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03DBC2EF1DAEE58E00BA6472; - productRefGroup = 03DBC2F91DAEE58E00BA6472 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03DBC2F71DAEE58E00BA6472 /* test_TouchJSON */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03DBC2F41DAEE58E00BA6472 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03DBC3041DAEE5C800BA6472 /* CJSONDeserializer.m in Sources */, - 03DBC2FC1DAEE58E00BA6472 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03DBC2FD1DAEE58E00BA6472 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03DBC2FE1DAEE58E00BA6472 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03DBC3001DAEE58E00BA6472 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03DBC3011DAEE58E00BA6472 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03DBC2F31DAEE58E00BA6472 /* Build configuration list for PBXProject "test_TouchJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03DBC2FD1DAEE58E00BA6472 /* Debug */, - 03DBC2FE1DAEE58E00BA6472 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03DBC2FF1DAEE58E00BA6472 /* Build configuration list for PBXNativeTarget "test_TouchJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03DBC3001DAEE58E00BA6472 /* Debug */, - 03DBC3011DAEE58E00BA6472 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03DBC2F01DAEE58E00BA6472 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 5d76357ef..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 2af1bd358..000000000 Binary files a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_TouchJSON.xcscheme b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_TouchJSON.xcscheme deleted file mode 100644 index 8477d91c3..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_TouchJSON.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 55d26a229..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_TouchJSON.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03DBC2F71DAEE58E00BA6472 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/CJSONDeserializer.h b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/CJSONDeserializer.h deleted file mode 100644 index e61fea191..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/CJSONDeserializer.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// CJSONDeserializer.h -// TouchCode -// -// Created by Jonathan Wight on 12/15/2005. -// Copyright 2005 toxicsoftware.com. All rights reserved. -// -// 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. -// - -#import - -extern NSString *const kJSONDeserializerErrorDomain /* = @"CJSONDeserializerErrorDomain" */; - -typedef enum { - - // Fundamental scanning errors - kJSONDeserializerErrorCode_NothingToScan = -11, - kJSONDeserializerErrorCode_CouldNotDecodeData = -12, - kJSONDeserializerErrorCode_CouldNotScanObject = -15, - kJSONDeserializerErrorCode_ScanningFragmentsNotAllowed = -16, - kJSONDeserializerErrorCode_DidNotConsumeAllData = -17, - kJSONDeserializerErrorCode_FailedToCreateObject = -18, - - // Dictionary scanning - kJSONDeserializerErrorCode_DictionaryStartCharacterMissing = -101, - kJSONDeserializerErrorCode_DictionaryKeyScanFailed = -102, - kJSONDeserializerErrorCode_DictionaryKeyNotTerminated = -103, - kJSONDeserializerErrorCode_DictionaryValueScanFailed = -104, - kJSONDeserializerErrorCode_DictionaryNotTerminated = -106, - - // Array scanning - kJSONDeserializerErrorCode_ArrayStartCharacterMissing = -201, - kJSONDeserializerErrorCode_ArrayValueScanFailed = -202, - kJSONDeserializerErrorCode_ArrayValueIsNull = -203, - kJSONDeserializerErrorCode_ArrayNotTerminated = -204, - - // String scanning - kJSONDeserializerErrorCode_StringNotStartedWithBackslash = -301, - kJSONDeserializerErrorCode_StringUnicodeNotDecoded = -302, - kJSONDeserializerErrorCode_StringUnknownEscapeCode = -303, - kJSONDeserializerErrorCode_StringNotTerminated = -304, - kJSONDeserializerErrorCode_StringBadEscaping = -305, - kJSONDeserializerErrorCode_StringCouldNotBeCreated = -306, - - // Number scanning - kJSONDeserializerErrorCode_NumberNotScannable = -401 - -} EJSONDeserializerErrorCode; - -enum { - // The first three flags map to the corresponding NSJSONSerialization flags. - kJSONDeserializationOptions_MutableContainers = (1UL << 0), - kJSONDeserializationOptions_MutableLeaves = (1UL << 1), - kJSONDeserializationOptions_AllowFragments = (1UL << 2), - kJSONDeserializationOptions_LaxEscapeCodes = (1UL << 3), - kJSONDeserializationOptions_Default = kJSONDeserializationOptions_MutableContainers, -}; -typedef NSUInteger EJSONDeserializationOptions; - -@interface CJSONDeserializer : NSObject - -/// Object to return instead when a null encountered in the JSON. Defaults to NSNull. Setting to null causes the deserializer to skip null values. -@property (readwrite, nonatomic, strong) id nullObject; - -/// JSON must be encoded in Unicode (UTF-8, UTF-16 or UTF-32). Use this if you expect to get the JSON in another encoding. - -@property (readwrite, nonatomic, assign) EJSONDeserializationOptions options; - -+ (CJSONDeserializer *)deserializer; - -- (id)deserialize:(NSData *)inData error:(NSError **)outError; - -- (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError; -- (id)deserializeAsArray:(NSData *)inData error:(NSError **)outError; - -@end diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/CJSONDeserializer.m b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/CJSONDeserializer.m deleted file mode 100644 index 4bb9382ae..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/CJSONDeserializer.m +++ /dev/null @@ -1,1240 +0,0 @@ -// -// CJSONDeserializer.m -// TouchCode -// -// Created by Jonathan Wight on 12/15/2005. -// Copyright 2005 toxicsoftware.com. All rights reserved. -// -// 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. -// - -#import "CJSONDeserializer.h" - -NSString *const kJSONDeserializerErrorDomain = @"CJSONDeserializerErrorDomain"; - -typedef struct - { - void *location; - NSUInteger length; - } PtrRange; - -@interface CJSONDeserializer () { - NSData *_data; - NSUInteger _scanLocation; - char *_end; - char *_current; - char *_start; - NSMutableData *_scratchData; - CFMutableDictionaryRef _stringsByHash; - } -@end - -@implementation CJSONDeserializer - -#pragma mark - - -+ (CJSONDeserializer *)deserializer - { - return ([[self alloc] init]); - } - -- (id)init - { - if ((self = [super init]) != NULL) - { - _nullObject = [NSNull null]; - _options = kJSONDeserializationOptions_Default; - - CFDictionaryKeyCallBacks theCallbacks = {}; - _stringsByHash = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &theCallbacks, &kCFTypeDictionaryValueCallBacks); - } - return (self); - } - -- (void)dealloc - { - CFRelease(_stringsByHash); - } - -#pragma mark - - -- (id)deserialize:(NSData *)inData error:(NSError **)outError - { - if ([self _setData:inData error:outError] == NO) - { - return (NULL); - } - id theObject = NULL; - if ([self _scanJSONObject:&theObject sharedKeySet:NULL error:outError] == YES) - { - if (!(_options & kJSONDeserializationOptions_AllowFragments)) - { - if ([theObject isKindOfClass:[NSArray class]] == NO && [theObject isKindOfClass:[NSDictionary class]] == NO) - { - if (outError != NULL) - { - *outError = [self _error:kJSONDeserializerErrorCode_ScanningFragmentsNotAllowed description:@"Scanning fragments not allowed."]; - return(NULL); - } - } - } - else - { - if (theObject == [NSNull null]) - { - theObject = _nullObject; - } - } - } - - // If we haven't consumed all the data... - if (_current != _end) - { - // Skip any remaining whitespace... - _current = _SkipWhiteSpace(_current, _end); - // And then error if we still haven't consumed all data... - if (_current != _end) - { - if (outError != NULL) - { - *outError = [self _error:kJSONDeserializerErrorCode_DidNotConsumeAllData description:@"Did not consume all data."]; - } - return(NULL); - } - } - - return (theObject); - } - -- (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError - { - if ([self _setData:inData error:outError] == NO) - { - return (NULL); - } - NSDictionary *theDictionary = NULL; - [self _scanJSONDictionary:&theDictionary sharedKeySet:NULL error:outError]; - return(theDictionary); - } - -- (id)deserializeAsArray:(NSData *)inData error:(NSError **)outError - { - if ([self _setData:inData error:outError] == NO) - { - return (NULL); - } - NSArray *theArray = NULL; - [self _scanJSONArray:&theArray error:outError]; - return(theArray); - } - -#pragma mark - - -- (NSUInteger)scanLocation - { - return (_current - _start); - } - -- (BOOL)_setData:(NSData *)inData error:(NSError **)outError; - { - if (_data == inData) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_NothingToScan underlyingError:NULL description:@"Have no data to scan."]; - } - return(NO); - } - - NSData *theData = inData; - if (theData.length >= 4) - { - // This code is lame, but it works. Because the first character of any JSON string will always be a (ascii) control character we can work out the Unicode encoding by the bit pattern. See section 3 of http://www.ietf.org/rfc/rfc4627.txt - const UInt8 *theChars = theData.bytes; - NSStringEncoding theEncoding = NSUTF8StringEncoding; - if (theChars[0] != 0 && theChars[1] == 0) - { - if (theChars[2] != 0 && theChars[3] == 0) - { - theEncoding = NSUTF16LittleEndianStringEncoding; - } - else if (theChars[2] == 0 && theChars[3] == 0) - { - theEncoding = NSUTF32LittleEndianStringEncoding; - } - } - else if (theChars[0] == 0 && theChars[2] == 0 && theChars[3] != 0) - { - if (theChars[1] == 0) - { - theEncoding = NSUTF32BigEndianStringEncoding; - } - else if (theChars[1] != 0) - { - theEncoding = NSUTF16BigEndianStringEncoding; - } - } - else - { - const UInt32 *C32 = (UInt32 *)theChars; - if (*C32 == CFSwapInt32HostToBig(0x0000FEFF) || *C32 == CFSwapInt32HostToBig(0xFFFE0000)) - { - theEncoding = NSUTF32StringEncoding; - } - else - { - const uint16_t *C16 = (UInt16 *)theChars; - if (*C16 == CFSwapInt16HostToBig(0xFEFF) || *C16 == CFSwapInt16HostToBig(0xFFFE)) - { - theEncoding = NSUTF16StringEncoding; - } - } - } - - if (theEncoding != NSUTF8StringEncoding) - { - NSString *theString = [[NSString alloc] initWithData:theData encoding:theEncoding]; - if (theString == NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_CouldNotDecodeData description:NULL]; - } - return(NO); - } - theData = [theString dataUsingEncoding:NSUTF8StringEncoding]; - } - } - - _data = theData; - - _start = (char *) _data.bytes; - _end = _start + _data.length; - _current = _start; - _scratchData = NULL; - - return (YES); - } - -#pragma mark - - -- (BOOL)_scanJSONObject:(id *)outObject sharedKeySet:(id *)ioSharedKeySet error:(NSError **)outError - { - BOOL theResult; - - _current = _SkipWhiteSpace(_current, _end); - - if (_current >= _end) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_CouldNotScanObject description:@"Could not read JSON object, input exhausted."]; - } - return(NO); - } - - id theObject = NULL; - - const char C = *_current; - switch (C) - { - case 't': - { - theResult = _ScanUTF8String(self, "true", 4); - if (theResult != NO) - { - theObject = (__bridge id) kCFBooleanTrue; - } - else - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_CouldNotScanObject description:@"Could not scan object. Character not a valid JSON character."]; - } - } - break; - } - case 'f': - { - theResult = _ScanUTF8String(self, "false", 5); - if (theResult != NO) - { - theObject = (__bridge id) kCFBooleanFalse; - } - else - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_CouldNotScanObject description:@"Could not scan object. Character not a valid JSON character."]; - } - } - } - break; - case 'n': - { - theResult = _ScanUTF8String(self, "null", 4); - if (theResult != NO) - { - theObject = _nullObject ?: [NSNull null]; - } - else - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_CouldNotScanObject description:@"Could not scan object. Character not a valid JSON character."]; - } - } - } - break; - case '\"': - case '\'': - { - theResult = [self _scanJSONStringConstant:&theObject key:NO error:outError]; - } - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '-': - { - theResult = [self _scanJSONNumberConstant:&theObject error:outError]; - } - break; - case '{': - { - theResult = [self _scanJSONDictionary:&theObject sharedKeySet:ioSharedKeySet error:outError]; - } - break; - case '[': - { - theResult = [self _scanJSONArray:&theObject error:outError]; - } - break; - default: - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_CouldNotScanObject description:@"Could not scan object. Character not a valid JSON character."]; - } - return(NO); - } - break; - } - - if (outObject != NULL) - { - *outObject = theObject; - } - - return(theResult); - } - -- (BOOL)_scanJSONDictionary:(NSDictionary **)outDictionary sharedKeySet:(id *)ioSharedKeySet error:(NSError **)outError - { - NSUInteger theScanLocation = _current - _start; - - _current = _SkipWhiteSpace(_current, _end); - - if (_ScanCharacter(self, '{') == NO) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryStartCharacterMissing description:@"Could not scan dictionary. Dictionary that does not start with '{' character."]; - } - return (NO); - } - - NSMutableDictionary *theDictionary = NULL; - if (ioSharedKeySet != NULL && *ioSharedKeySet != NULL) - { - theDictionary = [NSMutableDictionary dictionaryWithSharedKeySet:*ioSharedKeySet]; - } - else - { - theDictionary = [NSMutableDictionary dictionary]; - } - - if (theDictionary == NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_FailedToCreateObject description:@"Could not scan dictionary. Could not allow object."]; - } - return(NO); - } - - NSString *theKey = NULL; - id theValue = NULL; - - while (*_current != '}') - { - _current = _SkipWhiteSpace(_current, _end); - - if (*_current == '}') - { - break; - } - - if ([self _scanJSONStringConstant:&theKey key:YES error:outError] == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryKeyScanFailed description:@"Could not scan dictionary. Failed to scan a key."]; - } - return (NO); - } - - _current = _SkipWhiteSpace(_current, _end); - - if (_ScanCharacter(self, ':') == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryKeyNotTerminated description:@"Could not scan dictionary. Key was not terminated with a ':' character."]; - } - return (NO); - } - - if ([self _scanJSONObject:&theValue sharedKeySet:NULL error:outError] == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryValueScanFailed description:@"Could not scan dictionary. Failed to scan a value."]; - } - return (NO); - } - - if (_nullObject == NULL && theValue == [NSNull null]) - { - continue; - } - - if (theKey == NULL) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryKeyScanFailed description:@"Could not scan dictionary. Failed to scan a key."]; - return(NO); - } - if (theValue == NULL) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryValueScanFailed description:@"Could not scan dictionary. Failed to scan a value."]; - return(NO); - } - CFDictionarySetValue((__bridge CFMutableDictionaryRef)theDictionary, (__bridge void *)theKey, (__bridge void *)theValue); - - _current = _SkipWhiteSpace(_current, _end); - - if (_ScanCharacter(self, ',') == NO) - { - if (*_current != '}') - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryNotTerminated description:@"kJSONDeserializerErrorCode_DictionaryKeyValuePairNoDelimiter"]; - } - return (NO); - } - break; - } - else - { - _current = _SkipWhiteSpace(_current, _end); - - if (*_current == '}') - { - break; - } - } - } - - if (_ScanCharacter(self, '}') == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_DictionaryNotTerminated description:@"Could not scan dictionary. Dictionary not terminated by a '}' character."]; - } - return (NO); - } - - if (outDictionary != NULL) - { - if (_options & kJSONDeserializationOptions_MutableContainers) - { - *outDictionary = theDictionary; - } - else - { - *outDictionary = [theDictionary copy]; - } - } - - if (ioSharedKeySet != NULL && *ioSharedKeySet == NULL) - { - *ioSharedKeySet = [NSMutableDictionary sharedKeySetForKeys:[theDictionary allKeys]]; - } - - return (YES); - } - -- (BOOL)_scanJSONArray:(NSArray **)outArray error:(NSError **)outError - { - NSUInteger theScanLocation = _current - _start; - - _current = _SkipWhiteSpace(_current, _end); - - if (_ScanCharacter(self, '[') == NO) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_ArrayStartCharacterMissing description:@"Could not scan array. Array not started by a '[' character."]; - } - return (NO); - } - - NSMutableArray *theArray = (__bridge_transfer NSMutableArray *) CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - - _current = _SkipWhiteSpace(_current, _end); - - id theSharedKeySet = NULL; - - NSString *theValue = NULL; - while (*_current != ']') - { - if ([self _scanJSONObject:&theValue sharedKeySet:&theSharedKeySet error:outError] == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_ArrayValueScanFailed underlyingError:NULL description:@"Could not scan array. Could not scan a value."]; - } - return (NO); - } - - if (theValue == NULL) - { - if (_nullObject != NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_ArrayValueIsNull description:@"Could not scan array. Value is NULL."]; - } - return (NO); - } - } - else - { - CFArrayAppendValue((__bridge CFMutableArrayRef) theArray, (__bridge void *) theValue); - } - - _current = _SkipWhiteSpace(_current, _end); - - if (_ScanCharacter(self, ',') == NO) - { - _current = _SkipWhiteSpace(_current, _end); - - if (*_current != ']') - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_ArrayNotTerminated description:@"Could not scan array. Array not terminated by a ']' character."]; - } - return (NO); - } - - break; - } - - _current = _SkipWhiteSpace(_current, _end); - } - - if (_ScanCharacter(self, ']') == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_ArrayNotTerminated description:@"Could not scan array. Array not terminated by a ']' character."]; - } - return (NO); - } - - if (outArray != NULL) - { - if (_options & kJSONDeserializationOptions_MutableContainers) - { - *outArray = theArray; - } - else - { - *outArray = [theArray copy]; - } - } - return (YES); - } - -- (BOOL)_scanJSONStringConstant:(NSString **)outStringConstant key:(BOOL)inKey error:(NSError **)outError - { - #pragma unused (inKey) - - NSUInteger theScanLocation = _current - _start; - - if (_ScanCharacter(self, '"') == NO) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringNotStartedWithBackslash description:@"Could not scan string constant. String not started by a '\"' character."]; - } - return (NO); - } - - if (_scratchData == NULL) - { - _scratchData = [NSMutableData dataWithCapacity:8 * 1024]; - } - else - { - [_scratchData setLength:0]; - } - - PtrRange thePtrRange; - while (_ScanCharacter(self, '"') == NO) - { - if ([self _scanNotQuoteCharactersIntoRange:&thePtrRange]) - { - [_scratchData appendBytes:thePtrRange.location length:thePtrRange.length]; - } - else if (_ScanCharacter(self, '\\') == YES) - { - char theCharacter = *_current++; - switch (theCharacter) - { - case '"': - case '\\': - case '/': - break; - case 'b': - theCharacter = '\b'; - break; - case 'f': - theCharacter = '\f'; - break; - case 'n': - theCharacter = '\n'; - break; - case 'r': - theCharacter = '\r'; - break; - case 't': - theCharacter = '\t'; - break; - case 'u': - { - UInt8 theBuffer[4]; - size_t theLength = ConvertEscapes(self, theBuffer); - if (theLength == 0) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringBadEscaping description:@"Could not decode string escape code."]; - } - return(NO); - } - [_scratchData appendBytes:&theBuffer length:theLength]; - theCharacter = 0; - } - break; - default: - { - if (!(_options & kJSONDeserializationOptions_LaxEscapeCodes)) - { - _current = _start + theScanLocation; - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringUnknownEscapeCode description:@"Could not scan string constant. Unknown escape code."]; - } - return (NO); - } - } - break; - } - if (theCharacter != 0) - { - [_scratchData appendBytes:&theCharacter length:1]; - } - } - else - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringNotTerminated description:@"Could not scan string constant. No terminating double quote character."]; - } - return (NO); - } - } - - NSString *theString = NULL; - if ([_scratchData length] < 80) - { - NSUInteger hash = [_scratchData hash]; - NSString *theFoundString = (__bridge NSString *)CFDictionaryGetValue(_stringsByHash, (const void *) hash); - BOOL theFoundFlag = NO; - if (theFoundString != NULL) - { - theString = (__bridge_transfer NSString *)CFStringCreateWithBytes(kCFAllocatorDefault, [_scratchData bytes], [_scratchData length], kCFStringEncodingUTF8, NO); - if (theString == NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringCouldNotBeCreated description:@"Could not create string."]; - } - return(NO); - } - if ([theFoundString isEqualToString:theString] == YES) - { - theFoundFlag = YES; - } - } - - if (theFoundFlag == NO) - { - if (theString == NULL) - { - theString = (__bridge_transfer NSString *)CFStringCreateWithBytes(kCFAllocatorDefault, [_scratchData bytes], [_scratchData length], kCFStringEncodingUTF8, NO); - if (theString == NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringCouldNotBeCreated description:@"Could not create string."]; - } - return(NO); - } - } - if (_options & kJSONDeserializationOptions_MutableLeaves) - { - theString = [theString mutableCopy]; - } - CFDictionarySetValue(_stringsByHash, (const void *) hash, (__bridge void *) theString); - } - } - else - { - theString = (__bridge_transfer NSString *)CFStringCreateWithBytes(kCFAllocatorDefault, [_scratchData bytes], [_scratchData length], kCFStringEncodingUTF8, NO); - if (theString == NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_StringCouldNotBeCreated description:@"Could not create string."]; - } - return(NO); - } - if (_options & kJSONDeserializationOptions_MutableLeaves) - { - theString = [theString mutableCopy]; - } - } - - if (outStringConstant != NULL) - { - *outStringConstant = theString; - } - - return (YES); - } - -- (BOOL)_scanJSONNumberConstant:(NSNumber **)outValue error:(NSError **)outError - { - _current = _SkipWhiteSpace(_current, _end); - - PtrRange theRange; - if ([self _scanDoubleCharactersIntoRange:&theRange] == NO) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_NumberNotScannable description:@"Could not scan number constant."]; - } - return (NO); - } - - NSNumber *theValue = ScanNumber(theRange.location, theRange.length, NULL); - if (theValue == NULL) - { - if (outError) - { - *outError = [self _error:kJSONDeserializerErrorCode_NumberNotScannable description:@"Could not scan number constant."]; - } - return (NO); - } - - if (outValue) - { - *outValue = theValue; - } - - return (YES); - } - -#pragma mark - - -- (BOOL)_scanNotQuoteCharactersIntoRange:(PtrRange *)outValue - { - char *P; - for (P = _current; P < _end && *P != '\"' && *P != '\\'; ++P) - { - // We're just iterating... - } - - if (P == _current) - { - return (NO); - } - - if (outValue) - { - *outValue = (PtrRange) {.location = _current, .length = P - _current}; - } - - _current = P; - - return (YES); - } - -#pragma mark - - -- (BOOL)_scanDoubleCharactersIntoRange:(PtrRange *)outRange - { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Winitializer-overrides" - static BOOL double_characters[256] = { - [0 ... 255] = NO, - ['0' ... '9'] = YES, - ['e'] = YES, - ['E'] = YES, - ['-'] = YES, - ['+'] = YES, - ['.'] = YES, - }; -#pragma clang diagnostic pop - - char *P; - for (P = _current; P < _end && double_characters[*P] == YES; ++P) - { - // Just iterate... - } - - if (P == _current) - { - return (NO); - } - - if (outRange) - { - *outRange = (PtrRange) {.location = _current, .length = P - _current}; - } - - _current = P; - - return (YES); - } - -#pragma mark - - -- (NSDictionary *)_userInfoForScanLocation - { - NSUInteger theLine = 0; - const char *theLineStart = _start; - for (const char *C = _start; C < _current; ++C) - { - if (*C == '\n' || *C == '\r') - { - theLineStart = C - 1; - ++theLine; - } - } - - NSUInteger theCharacter = _current - theLineStart; - - NSRange theStartRange = NSIntersectionRange((NSRange) {.location = MAX((NSInteger) self.scanLocation - 20, 0), .length = 20 + (NSInteger) self.scanLocation - 20}, (NSRange) {.location = 0, .length = _data.length}); - NSRange theEndRange = NSIntersectionRange((NSRange) {.location = self.scanLocation, .length = 20}, (NSRange) {.location = 0, .length = _data.length}); - - NSString *theSnippet = [NSString stringWithFormat:@"%@!HERE>!%@", - [[NSString alloc] initWithData:[_data subdataWithRange:theStartRange] encoding:NSUTF8StringEncoding], - [[NSString alloc] initWithData:[_data subdataWithRange:theEndRange] encoding:NSUTF8StringEncoding] - ]; - - NSDictionary *theUserInfo; - theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithUnsignedInteger:theLine], @"line", - [NSNumber numberWithUnsignedInteger:theCharacter], @"character", - [NSNumber numberWithUnsignedInteger:self.scanLocation], @"location", - theSnippet, @"snippet", - NULL]; - return (theUserInfo); - } - -- (NSError *)_error:(NSInteger)inCode underlyingError:(NSError *)inUnderlyingError description:(NSString *)inDescription - { - NSMutableDictionary *theUserInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: - inDescription, NSLocalizedDescriptionKey, - NULL]; - [theUserInfo addEntriesFromDictionary:self._userInfoForScanLocation]; - if (inUnderlyingError) - { - theUserInfo[NSUnderlyingErrorKey] = inUnderlyingError; - } - NSError *theError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:inCode userInfo:theUserInfo]; - return (theError); - } - -- (NSError *)_error:(NSInteger)inCode description:(NSString *)inDescription - { - return ([self _error:inCode underlyingError:NULL description:inDescription]); - } - -#pragma mark - - -inline static char *_SkipWhiteSpace(char *_current, char *_end) - { - char *P; - for (P = _current; P < _end && isspace(*P); ++P) - { - // Just iterate... - } - - return (P); - } - -static inline BOOL _ScanCharacter(CJSONDeserializer *deserializer, char inCharacter) - { - char theCharacter = *deserializer->_current; - if (theCharacter == inCharacter) - { - ++deserializer->_current; - return (YES); - } - else - { - return (NO); - } - } - -static inline BOOL _ScanUTF8String(CJSONDeserializer *deserializer, const char *inString, size_t inLength) - { - if ((size_t) (deserializer->_end - deserializer->_current) < inLength) - { - return (NO); - } - if (strncmp(deserializer->_current, inString, inLength) == 0) - { - deserializer->_current += inLength; - return (YES); - } - return (NO); - } - -static size_t ConvertEscapes(CJSONDeserializer *deserializer, UInt8 outBuffer[static 4]) - { - if (deserializer->_end - deserializer->_current < 4) - { - return(0); - } - UInt32 C = hexdec(deserializer->_current, 4); - deserializer->_current += 4; - - if (C >= 0xD800 && C <= 0xDBFF) - { - if (deserializer->_end - deserializer->_current < 6) - { - return(0); - } - if ((*deserializer->_current++) != '\\') - { - return(0); - } - if ((*deserializer->_current++) != 'u') - { - return(0); - } - - UInt32 C2 = hexdec(deserializer->_current, 4); - deserializer->_current += 4; - - if (C2 >= 0xDC00 && C2 <= 0xDFFF) - { - C = ((C - 0xD800) << 10) + (C2 - 0xDC00) + 0x0010000UL; - } - else - { - return(0); - } - } - else if (C >= 0xDC00 && C <= 0xDFFF) - { - return(0); - } - - int bytesToWrite; - if (C < 0x80) - { - bytesToWrite = 1; - } - else if (C < 0x800) - { - bytesToWrite = 2; - } - else if (C < 0x10000) - { - bytesToWrite = 3; - } - else if (C < 0x110000) - { - bytesToWrite = 4; - } - else - { - return(0); - } - - static const UInt8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - UInt8 *target = outBuffer + bytesToWrite; - const UInt32 byteMask = 0xBF; - const UInt32 byteMark = 0x80; - switch (bytesToWrite) - { - case 4: - *--target = ((C | byteMark) & byteMask); - C >>= 6; - case 3: - *--target = ((C | byteMark) & byteMask); - C >>= 6; - case 2: - *--target = ((C | byteMark) & byteMask); - C >>= 6; - case 1: - *--target = (C | firstByteMark[bytesToWrite]); - } - - return(bytesToWrite); - } - -// Adapted from http://stackoverflow.com/a/11068850 -/** - * @brief convert a hexidecimal string to a signed long - * will not produce or process negative numbers except - * to signal error. - * - * @param hex without decoration, case insensative. - * - * @return -1 on error, or result (max sizeof(long)-1 bits) - */ -static int hexdec(const char *hex, int len) - { - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Winitializer-overrides" - static const int hextable[] = { - [0 ... 255] = -1, // bit aligned access into this table is considerably - ['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // faster for most modern processors, - ['A'] = 10, 11, 12, 13, 14, 15, // for the space conscious, reduce to - ['a'] = 10, 11, 12, 13, 14, 15 // signed char. - }; - #pragma clang diagnostic pop - - int ret = 0; - if (len > 0) - { - while (*hex && ret >= 0 && (len--)) - { - ret = (ret << 4) | hextable[*hex++]; - } - } - else - { - while (*hex && ret >= 0) - { - ret = (ret << 4) | hextable[*hex++]; - } - } - return ret; - } - -static NSNumber *ScanNumber(const char *start, size_t length, NSError **outError) - { - if (length < 1) - { - goto error; - } - - const char *P = start; - const char *end = start + length; - - // Scan for a leading - character. - BOOL negative = NO; - if (*P == '-') - { - negative = YES; - ++P; - } - - // Scan for integer portion - UInt64 integer = 0; - int integer_digits = 0; - while (P != end && isdigit(*P)) - { - if (integer > (UINTMAX_MAX / 10ULL)) - { - goto fallback; - } - integer *= 10ULL; - integer += *P - '0'; - ++integer_digits; - ++P; - } - - // If we scan a '.' character scan for fraction portion. - UInt64 frac = 0; - int frac_digits = 0; - if (P != end && *P == '.') - { - ++P; - while (P != end && isdigit(*P)) - { - if (frac >= (UINTMAX_MAX / 10ULL)) - { - goto fallback; - } - frac *= 10ULL; - frac += *P - '0'; - ++frac_digits; - ++P; - } - } - - // If we scan no integer digits and no fraction digits this isn't good (generally strings like "." or ".e10") - if (integer_digits == 0 && frac_digits == 0) - { - goto error; - } - - // If we scan an 'e' character scan for '+' or '-' then scan exponent portion. - BOOL negativeExponent = NO; - UInt64 exponent = 0; - if (P != end && (*P == 'e' || *P == 'E')) - { - ++P; - if (P != end && *P == '-') - { - ++P; - negativeExponent = YES; - } - else if (P != end && *P == '+') - { - ++P; - } - - while (P != end && isdigit(*P)) - { - if (exponent > (UINTMAX_MAX / 10)) - { - goto fallback; - } - exponent *= 10; - exponent += *P - '0'; - ++P; - } - } - - // If we haven't scanned the entire length something has gone wrong - if (P != end) - { - goto error; - } - - // If we have no fraction and no exponent we're obviously an integer otherwise we're a number... - if (frac == 0 && exponent == 0) - { - if (negative == NO) - { - return([NSNumber numberWithUnsignedLongLong:integer]); - } - else - { - if (integer >= INT64_MAX) - { - goto fallback; - } - return([NSNumber numberWithLongLong:-(long long)integer]); - } - } - else - { - double D = (double)integer; - if (frac_digits > 0) - { - double double_fract = frac / pow(10, frac_digits); - D += double_fract; - } - if (negative) - { - D *= -1; - } - if (D != 0.0 && exponent != 0) - { - D *= pow(10, negativeExponent ? -(double)exponent : exponent); - } - - if (isinf(D) || isnan(D)) - { - goto fallback; - } - - return([NSNumber numberWithDouble:D]); - } - - -fallback: { - NSString *theString = [[NSString alloc] initWithBytes:start length:length encoding:NSASCIIStringEncoding]; - NSLocale *theLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; - NSDecimalNumber *theDecimalNumber = [NSDecimalNumber decimalNumberWithString:theString locale:theLocale ]; - return(theDecimalNumber); - } -error: { - if (outError != NULL) - { - *outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:kJSONDeserializerErrorCode_NumberNotScannable userInfo:@{ NSLocalizedDescriptionKey: @"Could not scan number constant." }]; - } - return(NULL); - } - } - - -@end diff --git a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/main.m b/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/main.m deleted file mode 100644 index 5cae0f2ad..000000000 --- a/tests/JSONTestSuite/parsers/test_TouchJSON/test_TouchJSON/main.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// main.m -// test_TouchJSON -// -// Created by nst on 12.10.16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#import -#import "CJSONDeserializer.h" - -int main(int argc, const char * argv[]) { - @autoreleasepool { - NSString *path = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding]; - NSData *data = [NSData dataWithContentsOfFile:path]; - CJSONDeserializer *theDeserializer = [CJSONDeserializer deserializer]; - theDeserializer.options |= kJSONDeserializationOptions_AllowFragments; - NSError *theError = NULL; - id theDeseralizedValue = [theDeserializer deserialize:data error:&theError]; - //NSLog(@"%@ %@", theDeseralizedValue, theError); - if(theDeseralizedValue != nil) exit(0); - exit(1); - } - return 0; -} diff --git a/tests/JSONTestSuite/parsers/test_cJSON/bin/test-cJSON b/tests/JSONTestSuite/parsers/test_cJSON/bin/test-cJSON deleted file mode 100755 index 1556ac39f..000000000 Binary files a/tests/JSONTestSuite/parsers/test_cJSON/bin/test-cJSON and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_cJSON/cJSON.c b/tests/JSONTestSuite/parsers/test_cJSON/cJSON.c deleted file mode 100755 index cbd3a89f7..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/cJSON.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - Copyright (c) 2009 Dave Gamble - - 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. -*/ - -/* cJSON */ -/* JSON parser in C. */ - -#include -#include -#include -#include -#include -#include -#include -#include "cJSON.h" - -static const char *global_ep; - -const char *cJSON_GetErrorPtr(void) {return global_ep;} - -static int cJSON_strcasecmp(const char *s1,const char *s2) -{ - if (!s1) return (s1==s2)?0:1;if (!s2) return 1; - for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0; - return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2); -} - -static void *(*cJSON_malloc)(size_t sz) = malloc; -static void (*cJSON_free)(void *ptr) = free; - -static char* cJSON_strdup(const char* str) -{ - size_t len; - char* copy; - - len = strlen(str) + 1; - if (!(copy = (char*)cJSON_malloc(len))) return 0; - memcpy(copy,str,len); - return copy; -} - -void cJSON_InitHooks(cJSON_Hooks* hooks) -{ - if (!hooks) { /* Reset hooks */ - cJSON_malloc = malloc; - cJSON_free = free; - return; - } - - cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc; - cJSON_free = (hooks->free_fn)?hooks->free_fn:free; -} - -/* Internal constructor. */ -static cJSON *cJSON_New_Item(void) -{ - cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON)); - if (node) memset(node,0,sizeof(cJSON)); - return node; -} - -/* Delete a cJSON structure. */ -void cJSON_Delete(cJSON *c) -{ - cJSON *next; - while (c) - { - next=c->next; - if (!(c->type&cJSON_IsReference) && c->child) cJSON_Delete(c->child); - if (!(c->type&cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring); - if (!(c->type&cJSON_StringIsConst) && c->string) cJSON_free(c->string); - cJSON_free(c); - c=next; - } -} - -/* Parse the input text to generate a number, and populate the result into item. */ -static const char *parse_number(cJSON *item,const char *num) -{ - double n=0,sign=1,scale=0;int subscale=0,signsubscale=1; - - if (*num=='-') sign=-1,num++; /* Has sign? */ - if (*num=='0') num++; /* is zero */ - if (*num>='1' && *num<='9') do n=(n*10.0)+(*num++ -'0'); while (*num>='0' && *num<='9'); /* Number? */ - if (*num=='.' && num[1]>='0' && num[1]<='9') {num++; do n=(n*10.0)+(*num++ -'0'),scale--; while (*num>='0' && *num<='9');} /* Fractional part? */ - if (*num=='e' || *num=='E') /* Exponent? */ - { num++;if (*num=='+') num++; else if (*num=='-') signsubscale=-1,num++; /* With sign? */ - while (*num>='0' && *num<='9') subscale=(subscale*10)+(*num++ - '0'); /* Number? */ - } - - n=sign*n*pow(10.0,(scale+subscale*signsubscale)); /* number = +/- number.fraction * 10^+/- exponent */ - - item->valuedouble=n; - item->valueint=(int)n; - item->type=cJSON_Number; - return num; -} - -static int pow2gt (int x) { --x; x|=x>>1; x|=x>>2; x|=x>>4; x|=x>>8; x|=x>>16; return x+1; } - -typedef struct {char *buffer; int length; int offset; } printbuffer; - -static char* ensure(printbuffer *p,int needed) -{ - char *newbuffer;int newsize; - if (!p || !p->buffer) return 0; - needed+=p->offset; - if (needed<=p->length) return p->buffer+p->offset; - - newsize=pow2gt(needed); - newbuffer=(char*)cJSON_malloc(newsize); - if (!newbuffer) {cJSON_free(p->buffer);p->length=0,p->buffer=0;return 0;} - if (newbuffer) memcpy(newbuffer,p->buffer,p->length); - cJSON_free(p->buffer); - p->length=newsize; - p->buffer=newbuffer; - return newbuffer+p->offset; -} - -static int update(printbuffer *p) -{ - char *str; - if (!p || !p->buffer) return 0; - str=p->buffer+p->offset; - return p->offset+strlen(str); -} - -/* Render the number nicely from the given item into a string. */ -static char *print_number(cJSON *item,printbuffer *p) -{ - char *str=0; - double d=item->valuedouble; - if (d==0) - { - if (p) str=ensure(p,2); - else str=(char*)cJSON_malloc(2); /* special case for 0. */ - if (str) strcpy(str,"0"); - } - else if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN) - { - if (p) str=ensure(p,21); - else str=(char*)cJSON_malloc(21); /* 2^64+1 can be represented in 21 chars. */ - if (str) sprintf(str,"%d",item->valueint); - } - else - { - if (p) str=ensure(p,64); - else str=(char*)cJSON_malloc(64); /* This is a nice tradeoff. */ - if (str) - { - if (d*0!=0) sprintf(str,"null"); /* This checks for NaN and Infinity */ - else if (fabs(floor(d)-d)<=DBL_EPSILON && fabs(d)<1.0e60) sprintf(str,"%.0f",d); - else if (fabs(d)<1.0e-6 || fabs(d)>1.0e9) sprintf(str,"%e",d); - else sprintf(str,"%f",d); - } - } - return str; -} - -static unsigned parse_hex4(const char *str) -{ - unsigned h=0; - if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0; - h=h<<4;str++; - if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0; - h=h<<4;str++; - if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0; - h=h<<4;str++; - if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0; - return h; -} - -/* Parse the input text into an unescaped cstring, and populate item. */ -static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; -static const char *parse_string(cJSON *item,const char *str,const char **ep) -{ - const char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2; - if (*str!='\"') {*ep=str;return 0;} /* not a string! */ - - while (*end_ptr!='\"' && *end_ptr && ++len) if (*end_ptr++ == '\\') end_ptr++; /* Skip escaped quotes. */ - - out=(char*)cJSON_malloc(len+1); /* This is how long we need for the string, roughly. */ - if (!out) return 0; - item->valuestring=out; /* assign here so out will be deleted during cJSON_Delete() later */ - item->type=cJSON_String; - - ptr=str+1;ptr2=out; - while (ptr < end_ptr) - { - if (*ptr!='\\') *ptr2++=*ptr++; - else - { - ptr++; - switch (*ptr) - { - case 'b': *ptr2++='\b'; break; - case 'f': *ptr2++='\f'; break; - case 'n': *ptr2++='\n'; break; - case 'r': *ptr2++='\r'; break; - case 't': *ptr2++='\t'; break; - case 'u': /* transcode utf16 to utf8. */ - uc=parse_hex4(ptr+1);ptr+=4; /* get the unicode char. */ - if (ptr >= end_ptr) {*ep=str;return 0;} /* invalid */ - - if ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) {*ep=str;return 0;} /* check for invalid. */ - - if (uc>=0xD800 && uc<=0xDBFF) /* UTF16 surrogate pairs. */ - { - if (ptr+6 > end_ptr) {*ep=str;return 0;} /* invalid */ - if (ptr[1]!='\\' || ptr[2]!='u') {*ep=str;return 0;} /* missing second-half of surrogate. */ - uc2=parse_hex4(ptr+3);ptr+=6; - if (uc2<0xDC00 || uc2>0xDFFF) {*ep=str;return 0;} /* invalid second-half of surrogate. */ - uc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF)); - } - - len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len; - - switch (len) { - case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; - case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; - case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; - case 1: *--ptr2 =(uc | firstByteMark[len]); - } - ptr2+=len; - break; - default: *ptr2++=*ptr; break; - } - ptr++; - } - } - *ptr2=0; - if (*ptr=='\"') ptr++; - return ptr; -} - -/* Render the cstring provided to an escaped version that can be printed. */ -static char *print_string_ptr(const char *str,printbuffer *p) -{ - const char *ptr;char *ptr2,*out;int len=0,flag=0;unsigned char token; - - if (!str) - { - if (p) out=ensure(p,3); - else out=(char*)cJSON_malloc(3); - if (!out) return 0; - strcpy(out,"\"\""); - return out; - } - - for (ptr=str;*ptr;ptr++) flag|=((*ptr>0 && *ptr<32)||(*ptr=='\"')||(*ptr=='\\'))?1:0; - if (!flag) - { - len=ptr-str; - if (p) out=ensure(p,len+3); - else out=(char*)cJSON_malloc(len+3); - if (!out) return 0; - ptr2=out;*ptr2++='\"'; - strcpy(ptr2,str); - ptr2[len]='\"'; - ptr2[len+1]=0; - return out; - } - - ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;} - - if (p) out=ensure(p,len+3); - else out=(char*)cJSON_malloc(len+3); - if (!out) return 0; - - ptr2=out;ptr=str; - *ptr2++='\"'; - while (*ptr) - { - if ((unsigned char)*ptr>31 && *ptr!='\"' && *ptr!='\\') *ptr2++=*ptr++; - else - { - *ptr2++='\\'; - switch (token=*ptr++) - { - case '\\': *ptr2++='\\'; break; - case '\"': *ptr2++='\"'; break; - case '\b': *ptr2++='b'; break; - case '\f': *ptr2++='f'; break; - case '\n': *ptr2++='n'; break; - case '\r': *ptr2++='r'; break; - case '\t': *ptr2++='t'; break; - default: sprintf(ptr2,"u%04x",token);ptr2+=5; break; /* escape and print */ - } - } - } - *ptr2++='\"';*ptr2++=0; - return out; -} -/* Invote print_string_ptr (which is useful) on an item. */ -static char *print_string(cJSON *item,printbuffer *p) {return print_string_ptr(item->valuestring,p);} - -/* Predeclare these prototypes. */ -static const char *parse_value(cJSON *item,const char *value,const char **ep); -static char *print_value(cJSON *item,int depth,int fmt,printbuffer *p); -static const char *parse_array(cJSON *item,const char *value,const char **ep); -static char *print_array(cJSON *item,int depth,int fmt,printbuffer *p); -static const char *parse_object(cJSON *item,const char *value,const char **ep); -static char *print_object(cJSON *item,int depth,int fmt,printbuffer *p); - -/* Utility to jump whitespace and cr/lf */ -static const char *skip(const char *in) {while (in && *in && (unsigned char)*in<=32) in++; return in;} - -/* Parse an object - create a new root, and populate. */ -cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated) -{ - const char *end=0,**ep=return_parse_end?return_parse_end:&global_ep; - cJSON *c=cJSON_New_Item(); - *ep=0; - if (!c) return 0; /* memory fail */ - - end=parse_value(c,skip(value),ep); - if (!end) {cJSON_Delete(c);return 0;} /* parse failure. ep is set. */ - - /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ - if (require_null_terminated) {end=skip(end);if (*end) {cJSON_Delete(c);*ep=end;return 0;}} - if (return_parse_end) *return_parse_end=end; - return c; -} -/* Default options for cJSON_Parse */ -cJSON *cJSON_Parse(const char *value) {return cJSON_ParseWithOpts(value,0,0);} - -/* Render a cJSON item/entity/structure to text. */ -char *cJSON_Print(cJSON *item) {return print_value(item,0,1,0);} -char *cJSON_PrintUnformatted(cJSON *item) {return print_value(item,0,0,0);} - -char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt) -{ - printbuffer p; - p.buffer=(char*)cJSON_malloc(prebuffer); - p.length=prebuffer; - p.offset=0; - return print_value(item,0,fmt,&p); -} - - -/* Parser core - when encountering text, process appropriately. */ -static const char *parse_value(cJSON *item,const char *value,const char **ep) -{ - if (!value) return 0; /* Fail on null. */ - if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; } - if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; } - if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; } - if (*value=='\"') { return parse_string(item,value,ep); } - if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } - if (*value=='[') { return parse_array(item,value,ep); } - if (*value=='{') { return parse_object(item,value,ep); } - - *ep=value;return 0; /* failure. */ -} - -/* Render a value to text. */ -static char *print_value(cJSON *item,int depth,int fmt,printbuffer *p) -{ - char *out=0; - if (!item) return 0; - if (p) - { - switch ((item->type)&255) - { - case cJSON_NULL: {out=ensure(p,5); if (out) strcpy(out,"null"); break;} - case cJSON_False: {out=ensure(p,6); if (out) strcpy(out,"false"); break;} - case cJSON_True: {out=ensure(p,5); if (out) strcpy(out,"true"); break;} - case cJSON_Number: out=print_number(item,p);break; - case cJSON_String: out=print_string(item,p);break; - case cJSON_Array: out=print_array(item,depth,fmt,p);break; - case cJSON_Object: out=print_object(item,depth,fmt,p);break; - } - } - else - { - switch ((item->type)&255) - { - case cJSON_NULL: out=cJSON_strdup("null"); break; - case cJSON_False: out=cJSON_strdup("false");break; - case cJSON_True: out=cJSON_strdup("true"); break; - case cJSON_Number: out=print_number(item,0);break; - case cJSON_String: out=print_string(item,0);break; - case cJSON_Array: out=print_array(item,depth,fmt,0);break; - case cJSON_Object: out=print_object(item,depth,fmt,0);break; - } - } - return out; -} - -/* Build an array from input text. */ -static const char *parse_array(cJSON *item,const char *value,const char **ep) -{ - cJSON *child; - if (*value!='[') {*ep=value;return 0;} /* not an array! */ - - item->type=cJSON_Array; - value=skip(value+1); - if (*value==']') return value+1; /* empty array. */ - - item->child=child=cJSON_New_Item(); - if (!item->child) return 0; /* memory fail */ - value=skip(parse_value(child,skip(value),ep)); /* skip any spacing, get the value. */ - if (!value) return 0; - - while (*value==',') - { - cJSON *new_item; - if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */ - child->next=new_item;new_item->prev=child;child=new_item; - value=skip(parse_value(child,skip(value+1),ep)); - if (!value) return 0; /* memory fail */ - } - - if (*value==']') return value+1; /* end of array */ - *ep=value;return 0; /* malformed. */ -} - -/* Render an array to text */ -static char *print_array(cJSON *item,int depth,int fmt,printbuffer *p) -{ - char **entries; - char *out=0,*ptr,*ret;int len=5; - cJSON *child=item->child; - int numentries=0,i=0,fail=0; - size_t tmplen=0; - - /* How many entries in the array? */ - while (child) numentries++,child=child->next; - /* Explicitly handle numentries==0 */ - if (!numentries) - { - if (p) out=ensure(p,3); - else out=(char*)cJSON_malloc(3); - if (out) strcpy(out,"[]"); - return out; - } - - if (p) - { - /* Compose the output array. */ - i=p->offset; - ptr=ensure(p,1);if (!ptr) return 0; *ptr='['; p->offset++; - child=item->child; - while (child && !fail) - { - print_value(child,depth+1,fmt,p); - p->offset=update(p); - if (child->next) {len=fmt?2:1;ptr=ensure(p,len+1);if (!ptr) return 0;*ptr++=',';if(fmt)*ptr++=' ';*ptr=0;p->offset+=len;} - child=child->next; - } - ptr=ensure(p,2);if (!ptr) return 0; *ptr++=']';*ptr=0; - out=(p->buffer)+i; - } - else - { - /* Allocate an array to hold the values for each */ - entries=(char**)cJSON_malloc(numentries*sizeof(char*)); - if (!entries) return 0; - memset(entries,0,numentries*sizeof(char*)); - /* Retrieve all the results: */ - child=item->child; - while (child && !fail) - { - ret=print_value(child,depth+1,fmt,0); - entries[i++]=ret; - if (ret) len+=strlen(ret)+2+(fmt?1:0); else fail=1; - child=child->next; - } - - /* If we didn't fail, try to malloc the output string */ - if (!fail) out=(char*)cJSON_malloc(len); - /* If that fails, we fail. */ - if (!out) fail=1; - - /* Handle failure. */ - if (fail) - { - for (i=0;itype=cJSON_Object; - value=skip(value+1); - if (*value=='}') return value+1; /* empty array. */ - - item->child=child=cJSON_New_Item(); - if (!item->child) return 0; - value=skip(parse_string(child,skip(value),ep)); - if (!value) return 0; - child->string=child->valuestring;child->valuestring=0; - if (*value!=':') {*ep=value;return 0;} /* fail! */ - value=skip(parse_value(child,skip(value+1),ep)); /* skip any spacing, get the value. */ - if (!value) return 0; - - while (*value==',') - { - cJSON *new_item; - if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */ - child->next=new_item;new_item->prev=child;child=new_item; - value=skip(parse_string(child,skip(value+1),ep)); - if (!value) return 0; - child->string=child->valuestring;child->valuestring=0; - if (*value!=':') {*ep=value;return 0;} /* fail! */ - value=skip(parse_value(child,skip(value+1),ep)); /* skip any spacing, get the value. */ - if (!value) return 0; - } - - if (*value=='}') return value+1; /* end of array */ - *ep=value;return 0; /* malformed. */ -} - -/* Render an object to text. */ -static char *print_object(cJSON *item,int depth,int fmt,printbuffer *p) -{ - char **entries=0,**names=0; - char *out=0,*ptr,*ret,*str;int len=7,i=0,j; - cJSON *child=item->child; - int numentries=0,fail=0; - size_t tmplen=0; - /* Count the number of entries. */ - while (child) numentries++,child=child->next; - /* Explicitly handle empty object case */ - if (!numentries) - { - if (p) out=ensure(p,fmt?depth+4:3); - else out=(char*)cJSON_malloc(fmt?depth+4:3); - if (!out) return 0; - ptr=out;*ptr++='{'; - if (fmt) {*ptr++='\n';for (i=0;ioffset; - len=fmt?2:1; ptr=ensure(p,len+1); if (!ptr) return 0; - *ptr++='{'; if (fmt) *ptr++='\n'; *ptr=0; p->offset+=len; - child=item->child;depth++; - while (child) - { - if (fmt) - { - ptr=ensure(p,depth); if (!ptr) return 0; - for (j=0;joffset+=depth; - } - print_string_ptr(child->string,p); - p->offset=update(p); - - len=fmt?2:1; - ptr=ensure(p,len); if (!ptr) return 0; - *ptr++=':';if (fmt) *ptr++='\t'; - p->offset+=len; - - print_value(child,depth,fmt,p); - p->offset=update(p); - - len=(fmt?1:0)+(child->next?1:0); - ptr=ensure(p,len+1); if (!ptr) return 0; - if (child->next) *ptr++=','; - if (fmt) *ptr++='\n';*ptr=0; - p->offset+=len; - child=child->next; - } - ptr=ensure(p,fmt?(depth+1):2); if (!ptr) return 0; - if (fmt) for (i=0;ibuffer)+i; - } - else - { - /* Allocate space for the names and the objects */ - entries=(char**)cJSON_malloc(numentries*sizeof(char*)); - if (!entries) return 0; - names=(char**)cJSON_malloc(numentries*sizeof(char*)); - if (!names) {cJSON_free(entries);return 0;} - memset(entries,0,sizeof(char*)*numentries); - memset(names,0,sizeof(char*)*numentries); - - /* Collect all the results into our arrays: */ - child=item->child;depth++;if (fmt) len+=depth; - while (child && !fail) - { - names[i]=str=print_string_ptr(child->string,0); - entries[i++]=ret=print_value(child,depth,fmt,0); - if (str && ret) len+=strlen(ret)+strlen(str)+2+(fmt?2+depth:0); else fail=1; - child=child->next; - } - - /* Try to allocate the output string */ - if (!fail) out=(char*)cJSON_malloc(len); - if (!out) fail=1; - - /* Handle failure */ - if (fail) - { - for (i=0;ichild;int i=0;while(c)i++,c=c->next;return i;} -cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array?array->child:0;while (c && item>0) item--,c=c->next; return c;} -cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object?object->child:0;while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;} -int cJSON_HasObjectItem(cJSON *object,const char *string) {return cJSON_GetObjectItem(object,string)?1:0;} - -/* Utility for array list handling. */ -static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;} -/* Utility for handling references. */ -static cJSON *create_reference(cJSON *item) {cJSON *ref=cJSON_New_Item();if (!ref) return 0;memcpy(ref,item,sizeof(cJSON));ref->string=0;ref->type|=cJSON_IsReference;ref->next=ref->prev=0;return ref;} - -/* Add item to array/object. */ -void cJSON_AddItemToArray(cJSON *array, cJSON *item) {cJSON *c=array->child;if (!item) return; if (!c) {array->child=item;} else {while (c && c->next) c=c->next; suffix_object(c,item);}} -void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item) {if (!item) return; if (item->string) cJSON_free(item->string);item->string=cJSON_strdup(string);cJSON_AddItemToArray(object,item);} -void cJSON_AddItemToObjectCS(cJSON *object,const char *string,cJSON *item) {if (!item) return; if (!(item->type&cJSON_StringIsConst) && item->string) cJSON_free(item->string);item->string=(char*)string;item->type|=cJSON_StringIsConst;cJSON_AddItemToArray(object,item);} -void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) {cJSON_AddItemToArray(array,create_reference(item));} -void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item) {cJSON_AddItemToObject(object,string,create_reference(item));} - -cJSON *cJSON_DetachItemFromArray(cJSON *array,int which) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return 0; - if (c->prev) c->prev->next=c->next;if (c->next) c->next->prev=c->prev;if (c==array->child) array->child=c->next;c->prev=c->next=0;return c;} -void cJSON_DeleteItemFromArray(cJSON *array,int which) {cJSON_Delete(cJSON_DetachItemFromArray(array,which));} -cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && cJSON_strcasecmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;} -void cJSON_DeleteItemFromObject(cJSON *object,const char *string) {cJSON_Delete(cJSON_DetachItemFromObject(object,string));} - -/* Replace array/object items with new ones. */ -void cJSON_InsertItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) {cJSON_AddItemToArray(array,newitem);return;} - newitem->next=c;newitem->prev=c->prev;c->prev=newitem;if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;} -void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return; - newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem; - if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);} -void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && cJSON_strcasecmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}} - -/* Create basic types: */ -cJSON *cJSON_CreateNull(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_NULL;return item;} -cJSON *cJSON_CreateTrue(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_True;return item;} -cJSON *cJSON_CreateFalse(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_False;return item;} -cJSON *cJSON_CreateBool(int b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_False;return item;} -cJSON *cJSON_CreateNumber(double num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=(int)num;}return item;} -cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);if(!item->valuestring){cJSON_Delete(item);return 0;}}return item;} -cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;} -cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;} - -/* Create Arrays: */ -cJSON *cJSON_CreateIntArray(const int *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && ichild=n;else suffix_object(p,n);p=n;}return a;} -cJSON *cJSON_CreateFloatArray(const float *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && ichild=n;else suffix_object(p,n);p=n;}return a;} -cJSON *cJSON_CreateDoubleArray(const double *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && ichild=n;else suffix_object(p,n);p=n;}return a;} -cJSON *cJSON_CreateStringArray(const char **strings,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && ichild=n;else suffix_object(p,n);p=n;}return a;} - -/* Duplication */ -cJSON *cJSON_Duplicate(cJSON *item,int recurse) -{ - cJSON *newitem,*cptr,*nptr=0,*newchild; - /* Bail on bad ptr */ - if (!item) return 0; - /* Create new item */ - newitem=cJSON_New_Item(); - if (!newitem) return 0; - /* Copy over all vars */ - newitem->type=item->type&(~cJSON_IsReference),newitem->valueint=item->valueint,newitem->valuedouble=item->valuedouble; - if (item->valuestring) {newitem->valuestring=cJSON_strdup(item->valuestring); if (!newitem->valuestring) {cJSON_Delete(newitem);return 0;}} - if (item->string) {newitem->string=cJSON_strdup(item->string); if (!newitem->string) {cJSON_Delete(newitem);return 0;}} - /* If non-recursive, then we're done! */ - if (!recurse) return newitem; - /* Walk the ->next chain for the child. */ - cptr=item->child; - while (cptr) - { - newchild=cJSON_Duplicate(cptr,1); /* Duplicate (with recurse) each item in the ->next chain */ - if (!newchild) {cJSON_Delete(newitem);return 0;} - if (nptr) {nptr->next=newchild,newchild->prev=nptr;nptr=newchild;} /* If newitem->child already set, then crosswire ->prev and ->next and move on */ - else {newitem->child=newchild;nptr=newchild;} /* Set newitem->child and move to it */ - cptr=cptr->next; - } - return newitem; -} - -void cJSON_Minify(char *json) -{ - char *into=json; - while (*json) - { - if (*json==' ') json++; - else if (*json=='\t') json++; /* Whitespace characters. */ - else if (*json=='\r') json++; - else if (*json=='\n') json++; - else if (*json=='/' && json[1]=='/') while (*json && *json!='\n') json++; /* double-slash comments, to end of line. */ - else if (*json=='/' && json[1]=='*') {while (*json && !(*json=='*' && json[1]=='/')) json++;json+=2;} /* multiline comments. */ - else if (*json=='\"'){*into++=*json++;while (*json && *json!='\"'){if (*json=='\\') *into++=*json++;*into++=*json++;}*into++=*json++;} /* string literals, which are \" sensitive. */ - else *into++=*json++; /* All other characters. */ - } - *into=0; /* and null-terminate. */ -} diff --git a/tests/JSONTestSuite/parsers/test_cJSON/cJSON.h b/tests/JSONTestSuite/parsers/test_cJSON/cJSON.h deleted file mode 100755 index 3a587cb08..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/cJSON.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - Copyright (c) 2009 Dave Gamble - - 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. -*/ - -#ifndef cJSON__h -#define cJSON__h - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* cJSON Types: */ -#define cJSON_False (1 << 0) -#define cJSON_True (1 << 1) -#define cJSON_NULL (1 << 2) -#define cJSON_Number (1 << 3) -#define cJSON_String (1 << 4) -#define cJSON_Array (1 << 5) -#define cJSON_Object (1 << 6) - -#define cJSON_IsReference 256 -#define cJSON_StringIsConst 512 - -/* The cJSON structure: */ -typedef struct cJSON { - struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ - struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ - - int type; /* The type of the item, as above. */ - - char *valuestring; /* The item's string, if type==cJSON_String */ - int valueint; /* The item's number, if type==cJSON_Number */ - double valuedouble; /* The item's number, if type==cJSON_Number */ - - char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ -} cJSON; - -typedef struct cJSON_Hooks { - void *(*malloc_fn)(size_t sz); - void (*free_fn)(void *ptr); -} cJSON_Hooks; - -/* Supply malloc, realloc and free functions to cJSON */ -extern void cJSON_InitHooks(cJSON_Hooks* hooks); - - -/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */ -extern cJSON *cJSON_Parse(const char *value); -/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */ -extern char *cJSON_Print(cJSON *item); -/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */ -extern char *cJSON_PrintUnformatted(cJSON *item); -/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ -extern char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt); -/* Delete a cJSON entity and all subentities. */ -extern void cJSON_Delete(cJSON *c); - -/* Returns the number of items in an array (or object). */ -extern int cJSON_GetArraySize(cJSON *array); -/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */ -extern cJSON *cJSON_GetArrayItem(cJSON *array,int item); -/* Get item "string" from object. Case insensitive. */ -extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string); -extern int cJSON_HasObjectItem(cJSON *object,const char *string); -/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ -extern const char *cJSON_GetErrorPtr(void); - -/* These calls create a cJSON item of the appropriate type. */ -extern cJSON *cJSON_CreateNull(void); -extern cJSON *cJSON_CreateTrue(void); -extern cJSON *cJSON_CreateFalse(void); -extern cJSON *cJSON_CreateBool(int b); -extern cJSON *cJSON_CreateNumber(double num); -extern cJSON *cJSON_CreateString(const char *string); -extern cJSON *cJSON_CreateArray(void); -extern cJSON *cJSON_CreateObject(void); - -/* These utilities create an Array of count items. */ -extern cJSON *cJSON_CreateIntArray(const int *numbers,int count); -extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count); -extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count); -extern cJSON *cJSON_CreateStringArray(const char **strings,int count); - -/* Append item to the specified array/object. */ -extern void cJSON_AddItemToArray(cJSON *array, cJSON *item); -extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item); -extern void cJSON_AddItemToObjectCS(cJSON *object,const char *string,cJSON *item); /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object */ -/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ -extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); -extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item); - -/* Remove/Detatch items from Arrays/Objects. */ -extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which); -extern void cJSON_DeleteItemFromArray(cJSON *array,int which); -extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string); -extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string); - -/* Update array items. */ -extern void cJSON_InsertItemInArray(cJSON *array,int which,cJSON *newitem); /* Shifts pre-existing items to the right. */ -extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem); -extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); - -/* Duplicate a cJSON item */ -extern cJSON *cJSON_Duplicate(cJSON *item,int recurse); -/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will -need to be released. With recurse!=0, it will duplicate any children connected to the item. -The item->next and ->prev pointers are always zero on return from Duplicate. */ - -/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ -/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error. If not, then cJSON_GetErrorPtr() does the job. */ -extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated); - -extern void cJSON_Minify(char *json); - -/* Macros for creating things quickly. */ -#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull()) -#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue()) -#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse()) -#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) -#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) -#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) - -/* When assigning an integer value, it needs to be propagated to valuedouble too. */ -#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val)) -#define cJSON_SetNumberValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val)) - -/* Macro for iterating over an array */ -#define cJSON_ArrayForEach(pos, head) for(pos = (head)->child; pos != NULL; pos = pos->next) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.pbxproj deleted file mode 100644 index 383e9c701..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.pbxproj +++ /dev/null @@ -1,257 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03B1DD3E1D567D8400FEDE27 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD3D1D567D8400FEDE27 /* main.c */; }; - 03B1DD461D567D9F00FEDE27 /* cJSON.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD441D567D9F00FEDE27 /* cJSON.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03B1DD381D567D8400FEDE27 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03B1DD3A1D567D8400FEDE27 /* test-cJSON */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "test-cJSON"; sourceTree = BUILT_PRODUCTS_DIR; }; - 03B1DD3D1D567D8400FEDE27 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 03B1DD441D567D9F00FEDE27 /* cJSON.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cJSON.c; sourceTree = ""; }; - 03B1DD451D567D9F00FEDE27 /* cJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cJSON.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03B1DD371D567D8400FEDE27 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03B1DD311D567D8400FEDE27 = { - isa = PBXGroup; - children = ( - 03B1DD441D567D9F00FEDE27 /* cJSON.c */, - 03B1DD451D567D9F00FEDE27 /* cJSON.h */, - 03B1DD3C1D567D8400FEDE27 /* test-cJSON */, - 03B1DD3B1D567D8400FEDE27 /* Products */, - ); - sourceTree = ""; - }; - 03B1DD3B1D567D8400FEDE27 /* Products */ = { - isa = PBXGroup; - children = ( - 03B1DD3A1D567D8400FEDE27 /* test-cJSON */, - ); - name = Products; - sourceTree = ""; - }; - 03B1DD3C1D567D8400FEDE27 /* test-cJSON */ = { - isa = PBXGroup; - children = ( - 03B1DD3D1D567D8400FEDE27 /* main.c */, - ); - path = "test-cJSON"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03B1DD391D567D8400FEDE27 /* test-cJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03B1DD411D567D8400FEDE27 /* Build configuration list for PBXNativeTarget "test-cJSON" */; - buildPhases = ( - 03B1DD361D567D8400FEDE27 /* Sources */, - 03B1DD371D567D8400FEDE27 /* Frameworks */, - 03B1DD381D567D8400FEDE27 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "test-cJSON"; - productName = "test-cJSON"; - productReference = 03B1DD3A1D567D8400FEDE27 /* test-cJSON */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03B1DD321D567D8400FEDE27 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03B1DD391D567D8400FEDE27 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - DevelopmentTeamName = "Nicolas Seriot"; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03B1DD351D567D8400FEDE27 /* Build configuration list for PBXProject "test-cJSON" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03B1DD311D567D8400FEDE27; - productRefGroup = 03B1DD3B1D567D8400FEDE27 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03B1DD391D567D8400FEDE27 /* test-cJSON */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03B1DD361D567D8400FEDE27 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03B1DD3E1D567D8400FEDE27 /* main.c in Sources */, - 03B1DD461D567D9F00FEDE27 /* cJSON.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03B1DD3F1D567D8400FEDE27 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03B1DD401D567D8400FEDE27 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03B1DD421D567D8400FEDE27 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03B1DD431D567D8400FEDE27 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03B1DD351D567D8400FEDE27 /* Build configuration list for PBXProject "test-cJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03B1DD3F1D567D8400FEDE27 /* Debug */, - 03B1DD401D567D8400FEDE27 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03B1DD411D567D8400FEDE27 /* Build configuration list for PBXNativeTarget "test-cJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03B1DD421D567D8400FEDE27 /* Debug */, - 03B1DD431D567D8400FEDE27 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03B1DD321D567D8400FEDE27 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index a417731f6..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 7e43f6eff..000000000 Binary files a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b45415..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-cJSON.xcscheme b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-cJSON.xcscheme deleted file mode 100644 index 546599ec6..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test-cJSON.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 78d2c7aa8..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test-cJSON.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03B1DD391D567D8400FEDE27 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON/main.c b/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON/main.c deleted file mode 100644 index 0750b8304..000000000 --- a/tests/JSONTestSuite/parsers/test_cJSON/test-cJSON/main.c +++ /dev/null @@ -1,69 +0,0 @@ -// -// main.c -// test-cJSON -// -// Created by nst on 06/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#include -#include -#include -#include -#include -#include -#include "cJSON.h" - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -/* Parse text to JSON, then render back to text, and print! */ -TestStatus parseData(char *data, int printParsingResults) { - cJSON *json=cJSON_Parse(data); - if (!json) { -// if (printParsingResults) { -// printf("Error before: [%s]\n",cJSON_GetErrorPtr()); -// } - return FAIL; - } - - char *out=cJSON_Print(json); - cJSON_Delete(json); - if (printParsingResults) { - printf("-- in: %s\n", data); - printf("-- out: %s\n", out); - } - free(out); - return PASS; -} - -/* Read a file, parse, render back, etc. */ -TestStatus testFile(const char *filename, int printParsingResults) { - - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return ERROR; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - TestStatus status = parseData(data, printParsingResults); - free(data); - return status; -} - -int main(int argc, const char * argv[]) { - - const char* path = argv[1]; - - int printParsingResults = 0; - - int result = testFile(path, printParsingResults); - - if (result == PASS) { - return 0; - } else { - return 1; - } -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/bin/test_ccan b/tests/JSONTestSuite/parsers/test_ccan_json/bin/test_ccan deleted file mode 100755 index 1b4620797..000000000 Binary files a/tests/JSONTestSuite/parsers/test_ccan_json/bin/test_ccan and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/common.h b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/common.h deleted file mode 100644 index 328cb73c0..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/common.h +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -#include -#include - -static char *chomp(char *s) -{ - char *e; - - if (s == NULL || *s == 0) - return s; - - e = strchr(s, 0); - if (e[-1] == '\n') - *--e = 0; - return s; -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_10.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_10.json deleted file mode 100644 index fbbcb4f97..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_10.json +++ /dev/null @@ -1 +0,0 @@ -[1,2,] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_101.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_101.json deleted file mode 100644 index b63ee25ec..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_101.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n\r\t\v"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_11.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_11.json deleted file mode 100644 index aca16d26c..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_11.json +++ /dev/null @@ -1 +0,0 @@ -[1:2} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_12.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_12.json deleted file mode 100644 index 2b3d85b22..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_12.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2,} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_125.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_125.json deleted file mode 100644 index b6fc4c620..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_125.json +++ /dev/null @@ -1 +0,0 @@ -hello \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_127.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_127.json deleted file mode 100644 index eea7b054d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_127.json +++ /dev/null @@ -1 +0,0 @@ -[32, \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_13.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_13.json deleted file mode 100644 index ccf2e045a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_13.json +++ /dev/null @@ -1 +0,0 @@ -{1:2} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_136.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_136.json deleted file mode 100644 index 186532917..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_136.json +++ /dev/null @@ -1 +0,0 @@ -3. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_137.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_137.json deleted file mode 100644 index 2d24db90b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_137.json +++ /dev/null @@ -1 +0,0 @@ -.3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_139.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_139.json deleted file mode 100644 index 159e7d308..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_139.json +++ /dev/null @@ -1 +0,0 @@ -0.3e \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_14.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_14.json deleted file mode 100644 index 889188fb2..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_14.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "2.5" : [3, 4, {}, {"5": ["6"], [7 ]}]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_140.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_140.json deleted file mode 100644 index dc54c22af..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_140.json +++ /dev/null @@ -1 +0,0 @@ -0.3e+ \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_145.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_145.json deleted file mode 100644 index 8eeccfcff..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_145.json +++ /dev/null @@ -1 +0,0 @@ -+3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_147.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_147.json deleted file mode 100644 index 0ed89618c..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_147.json +++ /dev/null @@ -1 +0,0 @@ --3. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_149.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_149.json deleted file mode 100644 index cdfa3b2bf..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_149.json +++ /dev/null @@ -1 +0,0 @@ -.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_15.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_15.json deleted file mode 100644 index 81055890a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_15.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "2.5" : [3, 4, {}, {"5": ["6"], [7]}]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_150.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_150.json deleted file mode 100644 index 91dcb6a87..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_150.json +++ /dev/null @@ -1 +0,0 @@ -5. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_151.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_151.json deleted file mode 100644 index 25121dc0d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_151.json +++ /dev/null @@ -1 +0,0 @@ -5.e1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_153.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_153.json deleted file mode 100644 index ba10198c5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_153.json +++ /dev/null @@ -1 +0,0 @@ -.3e1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_154.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_154.json deleted file mode 100644 index d55411179..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_154.json +++ /dev/null @@ -1 +0,0 @@ -.3e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_155.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_155.json deleted file mode 100644 index e585887d3..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_155.json +++ /dev/null @@ -1 +0,0 @@ -.3e-1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_156.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_156.json deleted file mode 100644 index f1baff786..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_156.json +++ /dev/null @@ -1 +0,0 @@ -.3e-1 .5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_157.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_157.json deleted file mode 100644 index 97f0edccb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_157.json +++ /dev/null @@ -1 +0,0 @@ -.3e-1.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_158.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_158.json deleted file mode 100644 index 943f81f17..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_158.json +++ /dev/null @@ -1 +0,0 @@ -.3e+1.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_159.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_159.json deleted file mode 100644 index 22501fefb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_159.json +++ /dev/null @@ -1 +0,0 @@ -.3e+. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_16.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_16.json deleted file mode 100644 index 659f8b63f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_16.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "2.5" : [3, 4, {}, {"5": ["6"], "7" :[8 ]}] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_160.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_160.json deleted file mode 100644 index 20b107254..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_160.json +++ /dev/null @@ -1 +0,0 @@ -.3e+.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_161.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_161.json deleted file mode 100644 index 943f81f17..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_161.json +++ /dev/null @@ -1 +0,0 @@ -.3e+1.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_162.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_162.json deleted file mode 100644 index d65aaf1ff..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_162.json +++ /dev/null @@ -1 +0,0 @@ -9.3e+1.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_163.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_163.json deleted file mode 100644 index 7193555c6..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_163.json +++ /dev/null @@ -1 +0,0 @@ -9.e+1.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_164.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_164.json deleted file mode 100644 index 3ed879cf2..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_164.json +++ /dev/null @@ -1 +0,0 @@ -9.e+ \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_165.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_165.json deleted file mode 100644 index a00f07a24..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_165.json +++ /dev/null @@ -1 +0,0 @@ -9.e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_169.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_169.json deleted file mode 100644 index 3ba07412d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_169.json +++ /dev/null @@ -1 +0,0 @@ -"\".". \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_17.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_17.json deleted file mode 100644 index 004f6a17c..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_17.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "2.5" : [3, 4, {}, {"5": ["6"], "7" :[8 ]}]] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_171.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_171.json deleted file mode 100644 index 07d240e68..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_171.json +++ /dev/null @@ -1 +0,0 @@ -"\"\"\"\""" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_172.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_172.json deleted file mode 100644 index 78ae15ffa..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_172.json +++ /dev/null @@ -1 +0,0 @@ -["\"\"\"\"", .5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_173.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_173.json deleted file mode 100644 index 6d73141c9..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_173.json +++ /dev/null @@ -1 +0,0 @@ -[.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_175.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_175.json deleted file mode 100644 index 78ae15ffa..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_175.json +++ /dev/null @@ -1 +0,0 @@ -["\"\"\"\"", .5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_176.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_176.json deleted file mode 100644 index 947cf22e8..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_176.json +++ /dev/null @@ -1 +0,0 @@ -["\"\"\"\"",.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_177.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_177.json deleted file mode 100644 index 56af0904f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_177.json +++ /dev/null @@ -1 +0,0 @@ -["\"",.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_178.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_178.json deleted file mode 100644 index cec8cc1b8..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_178.json +++ /dev/null @@ -1 +0,0 @@ -["\".5",.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_179.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_179.json deleted file mode 100644 index 087aea861..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_179.json +++ /dev/null @@ -1 +0,0 @@ -["\".5",".5\"".5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_18.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_18.json deleted file mode 100644 index 812e24dbb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_18.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "3":4 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_180.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_180.json deleted file mode 100644 index 4983ce6c7..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_180.json +++ /dev/null @@ -1 +0,0 @@ -["\".5",".5\"", .5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_181.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_181.json deleted file mode 100644 index 6f56b3f98..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_181.json +++ /dev/null @@ -1 +0,0 @@ -["\".5",".5\"",.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_183.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_183.json deleted file mode 100644 index f835671b7..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_183.json +++ /dev/null @@ -1 +0,0 @@ -{"key":/*comment*/"value"} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_184.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_184.json deleted file mode 100644 index 38612c8e4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_184.json +++ /dev/null @@ -1 +0,0 @@ -{"key":/*comment"value"} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_185.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_185.json deleted file mode 100644 index f9111c2cd..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_185.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}/* \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_186.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_186.json deleted file mode 100644 index d93ac169d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_186.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}/**/ \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_187.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_187.json deleted file mode 100644 index 64bdb4c58..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_187.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}/***/ \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_188.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_188.json deleted file mode 100644 index 89a52a2b4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_188.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}/**// \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_189.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_189.json deleted file mode 100644 index 3928a41cb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_189.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}/**/// \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_19.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_19.json deleted file mode 100644 index 792644163..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_19.json +++ /dev/null @@ -1 +0,0 @@ -"1\u2" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_190.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_190.json deleted file mode 100644 index 4bf7ea764..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_190.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}/**///---- \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_191.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_191.json deleted file mode 100644 index a1f31441e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_191.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}# \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_192.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_192.json deleted file mode 100644 index 358c79f5e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_192.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}#{ \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_193.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_193.json deleted file mode 100644 index 6d92a3197..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_193.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}#{} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_194.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_194.json deleted file mode 100644 index 1385e24d4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_194.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"}#, \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_195.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_195.json deleted file mode 100644 index eee37ac9a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_195.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"value"/**/, "k2":"v2"} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_197.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_197.json deleted file mode 100644 index 0ab9e96b6..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_197.json +++ /dev/null @@ -1 +0,0 @@ -"hello\'" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_198.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_198.json deleted file mode 100644 index 98d8532a3..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_198.json +++ /dev/null @@ -1 +0,0 @@ -'hello\'' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_199.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_199.json deleted file mode 100644 index 78783cfd1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_199.json +++ /dev/null @@ -1 +0,0 @@ -'hello' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_2.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_2.json deleted file mode 100644 index 9d68933c4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_2.json +++ /dev/null @@ -1 +0,0 @@ -" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_20.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_20.json deleted file mode 100644 index ae0360310..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_20.json +++ /dev/null @@ -1 +0,0 @@ -[,2] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_200.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_200.json deleted file mode 100644 index d08c9c603..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_200.json +++ /dev/null @@ -1 +0,0 @@ -'hell\'o' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_201.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_201.json deleted file mode 100644 index 62007bd3b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_201.json +++ /dev/null @@ -1 +0,0 @@ -'\'hello' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_202.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_202.json deleted file mode 100644 index d9950b0e4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_202.json +++ /dev/null @@ -1 +0,0 @@ -'\'hello\'' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_203.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_203.json deleted file mode 100644 index bead26091..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_203.json +++ /dev/null @@ -1 +0,0 @@ -\'hello\' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_204.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_204.json deleted file mode 100644 index a3c013e95..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_204.json +++ /dev/null @@ -1 +0,0 @@ -'hello\' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_205.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_205.json deleted file mode 100644 index 70aeecaa9..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_205.json +++ /dev/null @@ -1 +0,0 @@ -['hello\'] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_206.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_206.json deleted file mode 100644 index 81dde3b7b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_206.json +++ /dev/null @@ -1 +0,0 @@ -['hello\''] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_207.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_207.json deleted file mode 100644 index b01102a4e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_207.json +++ /dev/null @@ -1 +0,0 @@ -['hello"'] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_208.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_208.json deleted file mode 100644 index ab8e93222..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_208.json +++ /dev/null @@ -1 +0,0 @@ -['hello\"'] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_209.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_209.json deleted file mode 100644 index fd9c57330..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_209.json +++ /dev/null @@ -1 +0,0 @@ -['hello"o'] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_21.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_21.json deleted file mode 100644 index 98464bc25..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_21.json +++ /dev/null @@ -1 +0,0 @@ -"3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_210.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_210.json deleted file mode 100644 index 110b4d426..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_210.json +++ /dev/null @@ -1 +0,0 @@ -['"'] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_211.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_211.json deleted file mode 100644 index c55dfd73d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_211.json +++ /dev/null @@ -1 +0,0 @@ -'"' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_212.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_212.json deleted file mode 100644 index c1a900583..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_212.json +++ /dev/null @@ -1 +0,0 @@ -'"hello"' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_213.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_213.json deleted file mode 100644 index 757d3ac03..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_213.json +++ /dev/null @@ -1 +0,0 @@ -'"hello' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_214.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_214.json deleted file mode 100644 index 0d3b7a826..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_214.json +++ /dev/null @@ -1 +0,0 @@ -'"hi"' \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_216.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_216.json deleted file mode 100644 index 90b5a8424..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_216.json +++ /dev/null @@ -1 +0,0 @@ -nil \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_217.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_217.json deleted file mode 100644 index 692b80505..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_217.json +++ /dev/null @@ -1 +0,0 @@ -fals \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_218.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_218.json deleted file mode 100644 index 457955166..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_218.json +++ /dev/null @@ -1 +0,0 @@ -falsify \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_219.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_219.json deleted file mode 100644 index 095520be2..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_219.json +++ /dev/null @@ -1 +0,0 @@ -falsetto \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_22.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_22.json deleted file mode 100644 index 1cf2b7bd8..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_22.json +++ /dev/null @@ -1 +0,0 @@ -"3" "4" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_220.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_220.json deleted file mode 100644 index ac801342e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_220.json +++ /dev/null @@ -1 +0,0 @@ -truism \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_221.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_221.json deleted file mode 100644 index 9c6f8a146..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_221.json +++ /dev/null @@ -1 +0,0 @@ -{"key" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_222.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_222.json deleted file mode 100644 index dac8cd1a1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_222.json +++ /dev/null @@ -1 +0,0 @@ -{"key","key2":value} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_223.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_223.json deleted file mode 100644 index ed6780dcb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_223.json +++ /dev/null @@ -1 +0,0 @@ -"\u0000" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_23.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_23.json deleted file mode 100644 index c836c4821..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_23.json +++ /dev/null @@ -1 +0,0 @@ -[3[4] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_24.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_24.json deleted file mode 100644 index c70b71647..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_24.json +++ /dev/null @@ -1 +0,0 @@ -[3[4]] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_25.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_25.json deleted file mode 100644 index acb9f3b31..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_25.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6] 7, 8 9] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_26.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_26.json deleted file mode 100644 index d7164f194..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_26.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6] 7, 8, 9] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_27.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_27.json deleted file mode 100644 index 6965027f5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_27.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6], 7, 8 9] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_28.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_28.json deleted file mode 100644 index 12988c603..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_28.json +++ /dev/null @@ -1 +0,0 @@ -{"hello":true, "bye":false, null} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_29.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_29.json deleted file mode 100644 index de1e3ab66..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_29.json +++ /dev/null @@ -1 +0,0 @@ -{"hello":true, "bye":false, null:null} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_3.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_3.json deleted file mode 100644 index 9d7077c68..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_3.json +++ /dev/null @@ -1 +0,0 @@ -[,] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_30.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_30.json deleted file mode 100644 index 659e69c0a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_30.json +++ /dev/null @@ -1 +0,0 @@ -"hi \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_31.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_31.json deleted file mode 100644 index b83aa5b12..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_31.json +++ /dev/null @@ -1 +0,0 @@ -"hi""" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_32.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_32.json deleted file mode 100644 index 17c9387e1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_32.json +++ /dev/null @@ -1 +0,0 @@ -{"hi": "bye"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_33.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_33.json deleted file mode 100644 index 307712c8d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_33.json +++ /dev/null @@ -1 +0,0 @@ -"\uD800\uD800" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_34.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_34.json deleted file mode 100644 index 1c22a4729..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_34.json +++ /dev/null @@ -1 +0,0 @@ -"\uD800\uDBFF" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_35.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_35.json deleted file mode 100644 index 4a131e38c..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_35.json +++ /dev/null @@ -1 +0,0 @@ -"\UD834\UDD1E" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_36.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_36.json deleted file mode 100644 index 723400fda..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_36.json +++ /dev/null @@ -1 +0,0 @@ -"\uDB00" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_37.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_37.json deleted file mode 100644 index 767600b3b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_37.json +++ /dev/null @@ -1 +0,0 @@ -"\uDB00\uDBFF" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_4.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_4.json deleted file mode 100644 index 050346d38..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_4.json +++ /dev/null @@ -1 +0,0 @@ -[) \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_40.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_40.json deleted file mode 100644 index 945c9b46d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_40.json +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_44.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_44.json deleted file mode 100644 index 47f877290..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_44.json +++ /dev/null @@ -1 +0,0 @@ -+. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_46.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_46.json deleted file mode 100644 index 5e284f0e1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_46.json +++ /dev/null @@ -1 +0,0 @@ -0.e1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_5.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_5.json deleted file mode 100644 index 0ce005cd0..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_5.json +++ /dev/null @@ -1 +0,0 @@ -[]] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_54.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_54.json deleted file mode 100644 index facc97282..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_54.json +++ /dev/null @@ -1 +0,0 @@ -+1234 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_55.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_55.json deleted file mode 100644 index f2515bd33..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_55.json +++ /dev/null @@ -1 +0,0 @@ -++1234 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_59.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_59.json deleted file mode 100644 index fd054c910..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_59.json +++ /dev/null @@ -1 +0,0 @@ -123.e-142 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_6.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_6.json deleted file mode 100644 index 06727763d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_6.json +++ /dev/null @@ -1 +0,0 @@ -[} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_63.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_63.json deleted file mode 100644 index a03d8a909..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_63.json +++ /dev/null @@ -1 +0,0 @@ -.246e-142 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_64.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_64.json deleted file mode 100644 index 0a64239c5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_64.json +++ /dev/null @@ -1 +0,0 @@ -.2e-142 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_66.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_66.json deleted file mode 100644 index 2d24db90b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_66.json +++ /dev/null @@ -1 +0,0 @@ -.3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_69.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_69.json deleted file mode 100644 index 023778de0..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_69.json +++ /dev/null @@ -1 +0,0 @@ -+3. \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_7.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_7.json deleted file mode 100644 index 4f7034e21..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_7.json +++ /dev/null @@ -1 +0,0 @@ -{,} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_77.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_77.json deleted file mode 100644 index 3e4809f44..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_77.json +++ /dev/null @@ -1 +0,0 @@ -+3.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_78.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_78.json deleted file mode 100644 index 99e52756f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_78.json +++ /dev/null @@ -1 +0,0 @@ -.3e \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_79.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_79.json deleted file mode 100644 index ba10198c5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_79.json +++ /dev/null @@ -1 +0,0 @@ -.3e1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_8.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_8.json deleted file mode 100644 index eebc700a1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_8.json +++ /dev/null @@ -1 +0,0 @@ -{] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_80.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_80.json deleted file mode 100644 index e585887d3..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_80.json +++ /dev/null @@ -1 +0,0 @@ -.3e-1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_81.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_81.json deleted file mode 100644 index d55411179..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_81.json +++ /dev/null @@ -1 +0,0 @@ -.3e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_82.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_82.json deleted file mode 100644 index 38577d92d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_82.json +++ /dev/null @@ -1 +0,0 @@ -3.e1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_83.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_83.json deleted file mode 100644 index 350db8563..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_83.json +++ /dev/null @@ -1 +0,0 @@ -3.e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_85.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_85.json deleted file mode 100644 index cdfa3b2bf..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_85.json +++ /dev/null @@ -1 +0,0 @@ -.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_86.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_86.json deleted file mode 100644 index 9778001fb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_86.json +++ /dev/null @@ -1 +0,0 @@ -+.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_87.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_87.json deleted file mode 100644 index 334ba608d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_87.json +++ /dev/null @@ -1 +0,0 @@ -.5e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_9.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_9.json deleted file mode 100644 index 255c0f23e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_9.json +++ /dev/null @@ -1 +0,0 @@ -["1":2] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_91.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_91.json deleted file mode 100644 index 67504f648..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/n_91.json +++ /dev/null @@ -1 +0,0 @@ -.e-14234 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_100.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_100.json deleted file mode 100644 index c96f830fb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_100.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n\r\t\b",true , false, null] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_102.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_102.json deleted file mode 100644 index 794fab4cc..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_102.json +++ /dev/null @@ -1 +0,0 @@ -{"hello":true} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_103.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_103.json deleted file mode 100644 index c2d105307..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_103.json +++ /dev/null @@ -1 +0,0 @@ -{"hello":true, "bye":false} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_104.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_104.json deleted file mode 100644 index c5507dd1a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_104.json +++ /dev/null @@ -1 +0,0 @@ -{"hello":true, "bye":false, "foo":["one","two","three"]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_105.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_105.json deleted file mode 100644 index 492d091b3..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_105.json +++ /dev/null @@ -1 +0,0 @@ -"hi" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_106.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_106.json deleted file mode 100644 index 18b72474c..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_106.json +++ /dev/null @@ -1 +0,0 @@ -["hi"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_107.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_107.json deleted file mode 100644 index 2c69e38b0..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_107.json +++ /dev/null @@ -1 +0,0 @@ -["hi", "bye"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_108.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_108.json deleted file mode 100644 index ff5d32d3e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_108.json +++ /dev/null @@ -1 +0,0 @@ -{"hi": "bye"} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_109.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_109.json deleted file mode 100644 index c741b7a03..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_109.json +++ /dev/null @@ -1 +0,0 @@ -["hi", "bye", 3] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_110.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_110.json deleted file mode 100644 index ef64bd51b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_110.json +++ /dev/null @@ -1 +0,0 @@ -["hi", "bye[", 3] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_111.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_111.json deleted file mode 100644 index dbe52b421..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_111.json +++ /dev/null @@ -1 +0,0 @@ -"\u0007" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_112.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_112.json deleted file mode 100644 index d693198b4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_112.json +++ /dev/null @@ -1 +0,0 @@ -"\u0008" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_113.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_113.json deleted file mode 100644 index a74a96b46..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_113.json +++ /dev/null @@ -1 +0,0 @@ -"\u0009" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_114.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_114.json deleted file mode 100644 index 32d9f692b..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_114.json +++ /dev/null @@ -1 +0,0 @@ -"\u0010" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_115.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_115.json deleted file mode 100644 index 10ff7b374..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_115.json +++ /dev/null @@ -1 +0,0 @@ -"\u0020" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_116.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_116.json deleted file mode 100644 index 1c1b5f6d1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_116.json +++ /dev/null @@ -1 +0,0 @@ -"\u10000" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_117.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_117.json deleted file mode 100644 index e601c0714..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_117.json +++ /dev/null @@ -1 +0,0 @@ -"\u1234" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_118.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_118.json deleted file mode 100644 index e15667aa6..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_118.json +++ /dev/null @@ -1 +0,0 @@ -"\u99999" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_119.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_119.json deleted file mode 100644 index 9b5ecbc74..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_119.json +++ /dev/null @@ -1 +0,0 @@ -"\ud800\udc00" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_120.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_120.json deleted file mode 100644 index 8f6372003..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_120.json +++ /dev/null @@ -1 +0,0 @@ -"\uD800\uDC00" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_121.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_121.json deleted file mode 100644 index dae65c515..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_121.json +++ /dev/null @@ -1 +0,0 @@ -"\uD834\uDD1E" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_122.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_122.json deleted file mode 100644 index 86deb51af..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_122.json +++ /dev/null @@ -1 +0,0 @@ -"\uDBFF\uDFFF" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_123.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_123.json deleted file mode 100644 index aed67070a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_123.json +++ /dev/null @@ -1 +0,0 @@ -"\uFFFD" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_124.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_124.json deleted file mode 100644 index 933fac26a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_124.json +++ /dev/null @@ -1 +0,0 @@ -"\uFFFF" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_126.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_126.json deleted file mode 100644 index 1bd4ff62f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_126.json +++ /dev/null @@ -1 +0,0 @@ -[32, 1] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_128.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_128.json deleted file mode 100644 index 8f6372003..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_128.json +++ /dev/null @@ -1 +0,0 @@ -"\uD800\uDC00" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_129.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_129.json deleted file mode 100644 index 5a373848c..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_129.json +++ /dev/null @@ -1 +0,0 @@ -"\n" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_130.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_130.json deleted file mode 100644 index 84ed78b69..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_130.json +++ /dev/null @@ -1 +0,0 @@ -"hello" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_131.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_131.json deleted file mode 100644 index dfc5a58b5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_131.json +++ /dev/null @@ -1 +0,0 @@ -"hello\u0009world" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_132.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_132.json deleted file mode 100644 index 84ed78b69..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_132.json +++ /dev/null @@ -1 +0,0 @@ -"hello" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_133.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_133.json deleted file mode 100644 index d7757d09e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_133.json +++ /dev/null @@ -1 +0,0 @@ -"hello\n" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_134.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_134.json deleted file mode 100644 index 84ed78b69..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_134.json +++ /dev/null @@ -1 +0,0 @@ -"hello" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_135.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_135.json deleted file mode 100644 index e440e5c84..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_135.json +++ /dev/null @@ -1 +0,0 @@ -3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_138.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_138.json deleted file mode 100644 index 1d71ef974..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_138.json +++ /dev/null @@ -1 +0,0 @@ -0.3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_141.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_141.json deleted file mode 100644 index 97b3e6126..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_141.json +++ /dev/null @@ -1 +0,0 @@ -0.3e+5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_142.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_142.json deleted file mode 100644 index b19ed9680..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_142.json +++ /dev/null @@ -1 +0,0 @@ -0.3e-5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_143.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_143.json deleted file mode 100644 index 8e1a0f434..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_143.json +++ /dev/null @@ -1 +0,0 @@ -0.3e5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_144.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_144.json deleted file mode 100644 index 84ed78b69..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_144.json +++ /dev/null @@ -1 +0,0 @@ -"hello" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_146.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_146.json deleted file mode 100644 index 7d105a7b4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_146.json +++ /dev/null @@ -1 +0,0 @@ --3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_148.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_148.json deleted file mode 100644 index c3e8a4880..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_148.json +++ /dev/null @@ -1 +0,0 @@ --3.1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_152.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_152.json deleted file mode 100644 index ea2303bc0..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_152.json +++ /dev/null @@ -1 +0,0 @@ -0.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_166.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_166.json deleted file mode 100644 index a3ec2ed7a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_166.json +++ /dev/null @@ -1 +0,0 @@ -"\"" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_167.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_167.json deleted file mode 100644 index 703e61a0d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_167.json +++ /dev/null @@ -1 +0,0 @@ -"\"3.5" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_168.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_168.json deleted file mode 100644 index 05292c213..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_168.json +++ /dev/null @@ -1 +0,0 @@ -"\"." \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_170.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_170.json deleted file mode 100644 index a036b8a33..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_170.json +++ /dev/null @@ -1 +0,0 @@ -"\"....." \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_174.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_174.json deleted file mode 100644 index e8f96e200..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_174.json +++ /dev/null @@ -1 +0,0 @@ -["\"\"\"\"", 0.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_182.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_182.json deleted file mode 100644 index 7deb2f856..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_182.json +++ /dev/null @@ -1 +0,0 @@ -["\".5",".5\"",0.5] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_196.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_196.json deleted file mode 100644 index 9cc41f4b7..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_196.json +++ /dev/null @@ -1 +0,0 @@ -"\u0027" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_215.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_215.json deleted file mode 100644 index e069a156a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_215.json +++ /dev/null @@ -1 +0,0 @@ - [ 1 , 2 , 3 ] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_38.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_38.json deleted file mode 100644 index 0b8e19971..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_38.json +++ /dev/null @@ -1 +0,0 @@ -"\uFFFE" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_39.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_39.json deleted file mode 100644 index 933fac26a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_39.json +++ /dev/null @@ -1 +0,0 @@ -"\uFFFF" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_41.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_41.json deleted file mode 100644 index 3cc762b55..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_41.json +++ /dev/null @@ -1 +0,0 @@ -"" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_42.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_42.json deleted file mode 100644 index 0637a088a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_42.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_43.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_43.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_43.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_45.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_45.json deleted file mode 100644 index ea2303bc0..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_45.json +++ /dev/null @@ -1 +0,0 @@ -0.5 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_47.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_47.json deleted file mode 100644 index 1b0525cc8..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_47.json +++ /dev/null @@ -1 +0,0 @@ -{"1":{}} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_48.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_48.json deleted file mode 100644 index e3ff3f95a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_48.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_49.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_49.json deleted file mode 100644 index 42394dd77..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_49.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "2.5" : [3, 4, {}, {"5": ["6"]}]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_50.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_50.json deleted file mode 100644 index 7416e7f80..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_50.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "2.5" : [3, 4, {}, {"5": ["6"], "7" :[8 ]}]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_51.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_51.json deleted file mode 100644 index 274c0052d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_51.json +++ /dev/null @@ -1 +0,0 @@ -1234 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_52.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_52.json deleted file mode 100644 index c38fa6a0a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_52.json +++ /dev/null @@ -1 +0,0 @@ --1234 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_53.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_53.json deleted file mode 100644 index 60c85e235..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_53.json +++ /dev/null @@ -1 +0,0 @@ -{"1":2, "3":4} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_56.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_56.json deleted file mode 100644 index 9704d308f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_56.json +++ /dev/null @@ -1 +0,0 @@ -123.456e142 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_57.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_57.json deleted file mode 100644 index a379a6987..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_57.json +++ /dev/null @@ -1 +0,0 @@ -123.456e-142 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_58.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_58.json deleted file mode 100644 index d3b2a2f39..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_58.json +++ /dev/null @@ -1 +0,0 @@ -123.456e+142 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_60.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_60.json deleted file mode 100644 index 3fe18c4d4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_60.json +++ /dev/null @@ -1 +0,0 @@ -"1\u2000" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_61.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_61.json deleted file mode 100644 index 87d181004..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_61.json +++ /dev/null @@ -1 +0,0 @@ -"1\u20001" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_62.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_62.json deleted file mode 100644 index d8263ee98..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_62.json +++ /dev/null @@ -1 +0,0 @@ -2 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_65.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_65.json deleted file mode 100644 index e440e5c84..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_65.json +++ /dev/null @@ -1 +0,0 @@ -3 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_67.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_67.json deleted file mode 100644 index 73c8b7031..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_67.json +++ /dev/null @@ -1 +0,0 @@ -"3" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_68.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_68.json deleted file mode 100644 index 810c539bc..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_68.json +++ /dev/null @@ -1 +0,0 @@ -[3] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_70.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_70.json deleted file mode 100644 index 50ad37f4f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_70.json +++ /dev/null @@ -1 +0,0 @@ -3.2e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_71.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_71.json deleted file mode 100644 index 5edbb5b1e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_71.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4]] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_72.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_72.json deleted file mode 100644 index a659a1268..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_72.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5]]] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_73.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_73.json deleted file mode 100644 index b77b4f5aa..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_73.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6]] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_74.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_74.json deleted file mode 100644 index 64040d8ed..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_74.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6], 7] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_75.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_75.json deleted file mode 100644 index 5110efb74..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_75.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6], 7, 8] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_76.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_76.json deleted file mode 100644 index e160a80f1..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_76.json +++ /dev/null @@ -1 +0,0 @@ -[3, [4, [5], 6], 7, 8, 9] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_84.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_84.json deleted file mode 100644 index 846692da5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_84.json +++ /dev/null @@ -1 +0,0 @@ -3e+1 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_88.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_88.json deleted file mode 100644 index 940148c67..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_88.json +++ /dev/null @@ -1 +0,0 @@ -[ 7] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_89.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_89.json deleted file mode 100644 index c97a6d4f6..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_89.json +++ /dev/null @@ -1 +0,0 @@ -[7 ] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_90.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_90.json deleted file mode 100644 index 0b73788b4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_90.json +++ /dev/null @@ -1 +0,0 @@ -[7] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_92.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_92.json deleted file mode 100644 index 84ed78b69..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_92.json +++ /dev/null @@ -1 +0,0 @@ -"hello" \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_93.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_93.json deleted file mode 100644 index 7c9ef20f4..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_93.json +++ /dev/null @@ -1 +0,0 @@ -["hello"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_94.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_94.json deleted file mode 100644 index 7439d9ddf..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_94.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_95.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_95.json deleted file mode 100644 index 647d3ccbe..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_95.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_96.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_96.json deleted file mode 100644 index 621522f7e..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_96.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n\r\t"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_97.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_97.json deleted file mode 100644 index 421f9b5a9..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_97.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n\r\t\b"] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_98.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_98.json deleted file mode 100644 index 895d6981d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_98.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n\r\t\b",true] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_99.json b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_99.json deleted file mode 100644 index 10ef058ae..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/nst_files/y_99.json +++ /dev/null @@ -1 +0,0 @@ -["hello", "bye\n\r\t\b",true , false] \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-construction.c b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-construction.c deleted file mode 100644 index cc9a395fb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-construction.c +++ /dev/null @@ -1,191 +0,0 @@ -/* Build a list of numbers with various appends and prepends, verify them by testing against their encoded value, do pointer consistency checks each time, do element lookups, and remove items as well. */ - -#include "common.h" - -#define should_be(var, expected) should_be_(var, #var, expected) - -static void should_be_(const JsonNode *node, const char *name, const char *expected) -{ - char errmsg[256]; - char *encoded; - - if (!json_check(node, errmsg)) { - fail("Invariants check failed: %s", errmsg); - return; - } - - encoded = json_encode(node); - - if (strcmp(encoded, expected) == 0) - pass("%s is %s", name, expected); - else - fail("%s should be %s, but is actually %s", name, expected, encoded); - - free(encoded); -} - -static void test_string(void) -{ - JsonNode *str; - - str = json_mkstring("Hello\tworld!\n\001"); - should_be(str, "\"Hello\\tworld!\\n\\u0001\""); - json_delete(str); - - str = json_mkstring("\"\\\b\f\n\r\t"); - should_be(str, "\"\\\"\\\\\\b\\f\\n\\r\\t\""); - json_delete(str); -} - -static void test_number(void) -{ - JsonNode *num; - - num = json_mknumber(5678901234.0); - should_be(num, "5678901234"); - json_delete(num); - - num = json_mknumber(-5678901234.0); - should_be(num, "-5678901234"); - json_delete(num); - - num = json_mknumber(0.0 / 0.0); - should_be(num, "null"); - json_delete(num); -} - -static void test_array(void) -{ - JsonNode *array; - JsonNode *children[5 + 1]; - - array = json_mkarray(); - should_be(array, "[]"); - - children[1] = json_mknumber(1); - children[2] = json_mknumber(2); - children[3] = json_mknumber(3); - children[4] = json_mknumber(4); - children[5] = json_mknumber(5); - - json_append_element(array, children[3]); - should_be(array, "[3]"); - - json_remove_from_parent(children[3]); - should_be(array, "[]"); - - json_prepend_element(array, children[3]); - should_be(array, "[3]"); - - json_prepend_element(array, children[2]); - should_be(array, "[2,3]"); - - json_append_element(array, children[4]); - should_be(array, "[2,3,4]"); - - json_delete(children[3]); - should_be(array, "[2,4]"); - - json_prepend_element(array, children[1]); - should_be(array, "[1,2,4]"); - - json_delete(children[1]); - should_be(array, "[2,4]"); - - json_delete(children[4]); - should_be(array, "[2]"); - - ok1(json_find_element(array, 0) == children[2]); - ok1(json_find_element(array, -1) == NULL); - ok1(json_find_element(array, 1) == NULL); - - json_append_element(array, children[5]); - should_be(array, "[2,5]"); - - ok1(json_find_element(array, 0) == children[2]); - ok1(json_find_element(array, 1) == children[5]); - ok1(json_find_element(array, -1) == NULL); - ok1(json_find_element(array, 2) == NULL); - - json_delete(children[2]); - json_delete(children[5]); - should_be(array, "[]"); - - ok1(json_find_element(array, -1) == NULL); - ok1(json_find_element(array, 0) == NULL); - ok1(json_find_element(array, 1) == NULL); - - json_delete(array); -} - -static void test_object(void) -{ - JsonNode *object; - JsonNode *children[5 + 1]; - - object = json_mkobject(); - should_be(object, "{}"); - - children[1] = json_mknumber(1); - children[2] = json_mknumber(2); - children[3] = json_mknumber(3); - - ok1(json_find_member(object, "one") == NULL); - ok1(json_find_member(object, "two") == NULL); - ok1(json_find_member(object, "three") == NULL); - - json_append_member(object, "one", children[1]); - should_be(object, "{\"one\":1}"); - - ok1(json_find_member(object, "one") == children[1]); - ok1(json_find_member(object, "two") == NULL); - ok1(json_find_member(object, "three") == NULL); - - json_prepend_member(object, "two", children[2]); - should_be(object, "{\"two\":2,\"one\":1}"); - - ok1(json_find_member(object, "one") == children[1]); - ok1(json_find_member(object, "two") == children[2]); - ok1(json_find_member(object, "three") == NULL); - - json_append_member(object, "three", children[3]); - should_be(object, "{\"two\":2,\"one\":1,\"three\":3}"); - - ok1(json_find_member(object, "one") == children[1]); - ok1(json_find_member(object, "two") == children[2]); - ok1(json_find_member(object, "three") == children[3]); - - json_delete(object); -} - -int main(void) -{ - JsonNode *node; - - (void) chomp; - - plan_tests(49); - - ok1(json_find_element(NULL, 0) == NULL); - ok1(json_find_member(NULL, "") == NULL); - ok1(json_first_child(NULL) == NULL); - - node = json_mknull(); - should_be(node, "null"); - json_delete(node); - - node = json_mkbool(false); - should_be(node, "false"); - json_delete(node); - - node = json_mkbool(true); - should_be(node, "true"); - json_delete(node); - - test_string(); - test_number(); - test_array(); - test_object(); - - return exit_status(); -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-decode-encode.c b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-decode-encode.c deleted file mode 100644 index 6bdf7c3d5..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-decode-encode.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "common.h" - -int main(void) -{ - const char *strings_file = "test/test-strings"; - const char *strings_reencoded_file = "test/test-strings-reencoded"; - FILE *f, *f2; - char buffer[1024], buffer2[1024]; - - plan_tests(90); - - f = fopen(strings_file, "rb"); - if (f == NULL) { - diag("Could not open %s: %s", strings_file, strerror(errno)); - return 1; - } - f2 = fopen(strings_reencoded_file, "rb"); - if (f2 == NULL) { - diag("Could not open %s: %s", strings_reencoded_file, strerror(errno)); - return 1; - } - - while (fgets(buffer, sizeof(buffer), f)) { - const char *s = chomp(buffer); - bool valid; - JsonNode *node; - - if (expect_literal(&s, "valid ")) { - valid = true; - } else if (expect_literal(&s, "invalid ")) { - valid = false; - } else { - fail("Invalid line in test-strings: %s", buffer); - continue; - } - - node = json_decode(s); - - if (valid) { - char *reencoded; - char errmsg[256]; - - if (node == NULL) { - fail("%s is valid, but json_decode returned NULL", s); - continue; - } - - if (!json_check(node, errmsg)) { - fail("Corrupt tree produced by json_decode: %s", errmsg); - continue; - } - - reencoded = json_encode(node); - - if (!fgets(buffer2, sizeof(buffer2), f2)) { - fail("test-strings-reencoded is missing this line: %s", reencoded); - continue; - } - chomp(buffer2); - - ok(strcmp(reencoded, buffer2) == 0, "re-encode %s -> %s", s, reencoded); - - free(reencoded); - json_delete(node); - } else if (node != NULL) { - fail("%s is invalid, but json_decode returned non-NULL", s); - continue; - } - } - - if (ferror(f) || fclose(f) != 0 || ferror(f2) || fclose(f2) != 0) { - diag("I/O error reading test data."); - return 1; - } - - return exit_status(); -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-stringify.c b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-stringify.c deleted file mode 100644 index 3a4cb7319..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-stringify.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "common.h" - -static char buf1[256], buf2[256]; - -/* Used for pass and fail messages */ -static char *quote_string(const char *str, char buf[256]) -{ - char *out = buf; - - *out++ = '"'; - for (; *str != 0; str++) { - if (out - buf > 256 - 5) { - /* String is too long. End it with `...' */ - out = buf + 256 - 5; - *out++ = '.'; - *out++ = '.'; - *out++ = '.'; - break; - } - switch (*str) { - case '\t': - *out++ = '\\'; - *out++ = 't'; - break; - case '\n': - *out++ = '\\'; - *out++ = 'n'; - break; - case '"': - *out++ = '\\'; - *out++ = '"'; - break; - case '\\': - *out++ = '\\'; - *out++ = '\\'; - break; - default: - *out++ = *str; - break; - } - } - *out++ = '"'; - - *out = 0; - return buf; -} - -static void test_stringify(const char *input, const char *expected) -{ - JsonNode *node = NULL; - char *enc = NULL; - char *strn = NULL; - char *str = NULL; - - node = json_decode(input); - if (node == NULL) { - fail("Failed to decode %s", input); - goto end; - } - - enc = json_encode(node); - if (strcmp(enc, input) != 0) { - fail("%s re-encodes to %s. Either encode/decode is broken, or the input string needs to be normalized", input, enc); - goto end; - } - - strn = json_stringify(node, NULL); - if (strcmp(strn, enc) != 0) { - fail("json_stringify with NULL space produced a different string than json_encode"); - goto end; - } - - str = json_stringify(node, "\t"); - if (strcmp(str, expected) != 0) { - fail("Expected %s, but json_stringify produced %s", - quote_string(expected, buf1), quote_string(str, buf2)); - goto end; - } - - pass("stringify %s", input); - -end: - json_delete(node); - free(enc); - free(strn); - free(str); -} - -int main(void) -{ - (void) chomp; - - plan_tests(9); - - test_stringify("[]", "[]"); - test_stringify("[1]", "[\n\t1\n]"); - test_stringify("[1,2,3]", "[\n\t1,\n\t2,\n\t3\n]"); - test_stringify("[[]]", "[\n\t[]\n]"); - test_stringify("[[1,2],[3,4]]", "[\n\t[\n\t\t1,\n\t\t2\n\t],\n\t[\n\t\t3,\n\t\t4\n\t]\n]"); - - test_stringify("{}", "{}"); - test_stringify("{\"one\":1}", "{\n\t\"one\": 1\n}"); - test_stringify("{\"one\":1,\"t*\":[2,3,10]}", "{\n\t\"one\": 1,\n\t\"t*\": [\n\t\t2,\n\t\t3,\n\t\t10\n\t]\n}"); - test_stringify("{\"a\":{\"1\":1,\"2\":2},\"b\":{\"3\":[null,false,true,\"\\f\"]}}", - "{\n\t\"a\": {\n\t\t\"1\": 1,\n\t\t\"2\": 2\n\t},\n\t\"b\": {\n\t\t\"3\": [\n\t\t\tnull,\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t\"\\f\"\n\t\t]\n\t}\n}"); - - return exit_status(); -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-validate.c b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-validate.c deleted file mode 100644 index f7bb3b024..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/run-validate.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "common.h" - -int main(void) -{ - const char *strings_file = "test/test-strings"; - FILE *f; - char buffer[1024]; - - plan_tests(224); - - f = fopen(strings_file, "rb"); - if (f == NULL) { - diag("Could not open %s: %s", strings_file, strerror(errno)); - return 1; - } - - while (fgets(buffer, sizeof(buffer), f)) { - const char *s = chomp(buffer); - bool valid; - - if (expect_literal(&s, "valid ")) { - valid = true; - } else if (expect_literal(&s, "invalid ")) { - valid = false; - } else { - fail("Invalid line in test-strings: %s", buffer); - continue; - } - - if (strcmp(s, "\"1\\u2\"") == 0) - puts("here"); - - if (json_validate(s) == valid) { - pass("%s %s", valid ? "valid" : "invalid", s); - } else { - fail("%s is %s, but json_validate returned %s", - s, - valid ? "valid" : "invalid", - valid ? "false" : "true"); - } - } - - if (ferror(f) || fclose(f) != 0) { - diag("I/O error reading test strings."); - return 1; - } - - return exit_status(); -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/test-strings b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/test-strings deleted file mode 100644 index 439be7d3f..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/test-strings +++ /dev/null @@ -1,224 +0,0 @@ -invalid -invalid -invalid " -invalid [,] -invalid [) -invalid []] -invalid [} -invalid {,} -invalid {] -invalid ["1":2] -invalid [1,2,] -invalid [1:2} -invalid {"1":2,} -invalid {1:2} -invalid {"1":2, "2.5" : [3, 4, {}, {"5": ["6"], [7 ]}]} -invalid {"1":2, "2.5" : [3, 4, {}, {"5": ["6"], [7]}]} -invalid {"1":2, "2.5" : [3, 4, {}, {"5": ["6"], "7" :[8 ]}] -invalid {"1":2, "2.5" : [3, 4, {}, {"5": ["6"], "7" :[8 ]}]] -invalid {"1":2, "3":4 -invalid "1\u2" -invalid [,2] -invalid "3 -invalid "3" "4" -invalid [3[4] -invalid [3[4]] -invalid [3, [4, [5], 6] 7, 8 9] -invalid [3, [4, [5], 6] 7, 8, 9] -invalid [3, [4, [5], 6], 7, 8 9] -invalid {"hello":true, "bye":false, null} -invalid {"hello":true, "bye":false, null:null} -invalid "hi -invalid "hi""" -invalid {"hi": "bye"] -invalid "\uD800\uD800" -invalid "\uD800\uDBFF" -invalid "\UD834\UDD1E" -invalid "\uDB00" -invalid "\uDB00\uDBFF" -valid "\uFFFE" -valid "\uFFFF" -invalid . -valid "" -valid [] -valid {} -invalid +. -valid 0.5 -invalid 0.e1 -valid {"1":{}} -valid {"1":2} -valid {"1":2, "2.5" : [3, 4, {}, {"5": ["6"]}]} -valid {"1":2, "2.5" : [3, 4, {}, {"5": ["6"], "7" :[8 ]}]} -valid 1234 -valid -1234 -valid {"1":2, "3":4} -invalid +1234 -invalid ++1234 -valid 123.456e142 -valid 123.456e-142 -valid 123.456e+142 -invalid 123.e-142 -valid "1\u2000" -valid "1\u20001" -valid 2 -invalid .246e-142 -invalid .2e-142 -valid 3 -invalid .3 -valid "3" -valid [3] -invalid +3. -valid 3.2e+1 -valid [3, [4]] -valid [3, [4, [5]]] -valid [3, [4, [5], 6]] -valid [3, [4, [5], 6], 7] -valid [3, [4, [5], 6], 7, 8] -valid [3, [4, [5], 6], 7, 8, 9] -invalid +3.5 -invalid .3e -invalid .3e1 -invalid .3e-1 -invalid .3e+1 -invalid 3.e1 -invalid 3.e+1 -valid 3e+1 -invalid .5 -invalid +.5 -invalid .5e+1 -valid [ 7] -valid [7 ] -valid [7] -invalid .e-14234 -valid "hello" -valid ["hello"] -valid ["hello", "bye"] -valid ["hello", "bye\n"] -valid ["hello", "bye\n\r\t"] -valid ["hello", "bye\n\r\t\b"] -valid ["hello", "bye\n\r\t\b",true] -valid ["hello", "bye\n\r\t\b",true , false] -valid ["hello", "bye\n\r\t\b",true , false, null] -invalid ["hello", "bye\n\r\t\v"] -valid {"hello":true} -valid {"hello":true, "bye":false} -valid {"hello":true, "bye":false, "foo":["one","two","three"]} -valid "hi" -valid ["hi"] -valid ["hi", "bye"] -valid {"hi": "bye"} -valid ["hi", "bye", 3] -valid ["hi", "bye[", 3] -valid "\u0007" -valid "\u0008" -valid "\u0009" -valid "\u0010" -valid "\u0020" -valid "\u10000" -valid "\u1234" -valid "\u99999" -valid "\ud800\udc00" -valid "\uD800\uDC00" -valid "\uD834\uDD1E" -valid "\uDBFF\uDFFF" -valid "\uFFFD" -valid "\uFFFF" -invalid hello -valid [32, 1] -invalid [32, -valid "\uD800\uDC00" -valid "\n" -valid "hello" -valid "hello\u0009world" -valid "hello" -valid "hello\n" -valid "hello" -valid 3 -invalid 3. -invalid .3 -valid 0.3 -invalid 0.3e -invalid 0.3e+ -valid 0.3e+5 -valid 0.3e-5 -valid 0.3e5 -valid "hello" -invalid +3 -valid -3 -invalid -3. -valid -3.1 -invalid .5 -invalid 5. -invalid 5.e1 -valid 0.5 -invalid .3e1 -invalid .3e+1 -invalid .3e-1 -invalid .3e-1 .5 -invalid .3e-1.5 -invalid .3e+1.5 -invalid .3e+. -invalid .3e+.5 -invalid .3e+1.5 -invalid 9.3e+1.5 -invalid 9.e+1.5 -invalid 9.e+ -invalid 9.e+1 -valid "\"" -valid "\"3.5" -valid "\"." -invalid "\".". -valid "\"....." -invalid "\"\"\"\""" -invalid ["\"\"\"\"", .5] -invalid [.5] -valid ["\"\"\"\"", 0.5] -invalid ["\"\"\"\"", .5] -invalid ["\"\"\"\"",.5] -invalid ["\"",.5] -invalid ["\".5",.5] -invalid ["\".5",".5\"".5] -invalid ["\".5",".5\"", .5] -invalid ["\".5",".5\"",.5] -valid ["\".5",".5\"",0.5] -invalid {"key":/*comment*/"value"} -invalid {"key":/*comment"value"} -invalid {"key":"value"}/* -invalid {"key":"value"}/**/ -invalid {"key":"value"}/***/ -invalid {"key":"value"}/**// -invalid {"key":"value"}/**/// -invalid {"key":"value"}/**///---- -invalid {"key":"value"}# -invalid {"key":"value"}#{ -invalid {"key":"value"}#{} -invalid {"key":"value"}#, -invalid {"key":"value"/**/, "k2":"v2"} -valid "\u0027" -invalid "hello\'" -invalid 'hello\'' -invalid 'hello' -invalid 'hell\'o' -invalid '\'hello' -invalid '\'hello\'' -invalid \'hello\' -invalid 'hello\' -invalid ['hello\'] -invalid ['hello\''] -invalid ['hello"'] -invalid ['hello\"'] -invalid ['hello"o'] -invalid ['"'] -invalid '"' -invalid '"hello"' -invalid '"hello' -invalid '"hi"' -valid [ 1 , 2 , 3 ] -invalid nil -invalid fals -invalid falsify -invalid falsetto -invalid truism -invalid {"key" -invalid {"key","key2":value} -invalid "\u0000" diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/test-strings-reencoded b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/test-strings-reencoded deleted file mode 100644 index 97890c1dc..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/test-strings-reencoded +++ /dev/null @@ -1,90 +0,0 @@ -"￾" -"￿" -"" -[] -{} -0.5 -{"1":{}} -{"1":2} -{"1":2,"2.5":[3,4,{},{"5":["6"]}]} -{"1":2,"2.5":[3,4,{},{"5":["6"],"7":[8]}]} -1234 --1234 -{"1":2,"3":4} -1.23456e+144 -1.23456e-140 -1.23456e+144 -"1 " -"1 1" -2 -3 -"3" -[3] -32 -[3,[4]] -[3,[4,[5]]] -[3,[4,[5],6]] -[3,[4,[5],6],7] -[3,[4,[5],6],7,8] -[3,[4,[5],6],7,8,9] -30 -[7] -[7] -[7] -"hello" -["hello"] -["hello","bye"] -["hello","bye\n"] -["hello","bye\n\r\t"] -["hello","bye\n\r\t\b"] -["hello","bye\n\r\t\b",true] -["hello","bye\n\r\t\b",true,false] -["hello","bye\n\r\t\b",true,false,null] -{"hello":true} -{"hello":true,"bye":false} -{"hello":true,"bye":false,"foo":["one","two","three"]} -"hi" -["hi"] -["hi","bye"] -{"hi":"bye"} -["hi","bye",3] -["hi","bye[",3] -"\u0007" -"\b" -"\t" -"\u0010" -" " -"က0" -"ሴ" -"香9" -"𐀀" -"𐀀" -"𝄞" -"􏿿" -"�" -"￿" -[32,1] -"𐀀" -"\n" -"hello" -"hello\tworld" -"hello" -"hello\n" -"hello" -3 -0.3 -30000 -3e-06 -30000 -"hello" --3 --3.1 -0.5 -"\"" -"\"3.5" -"\"." -"\"....." -["\"\"\"\"",0.5] -["\".5",".5\"",0.5] -"'" -[1,2,3] diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/x.py b/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/x.py deleted file mode 100644 index c1c0832f2..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/_test/x.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -import os - -with open("test-strings") as f: - for (i,l) in enumerate(f): - l = l.rstrip() - if l.startswith("valid"): - filename = "y_%s.json" % i - else: - filename = "n_%s.json" % i - - try: - l = l[l.index(" ")+1:] - - f = open(os.path.sep.join(["nst_files", filename]), 'wb+') - f.write(l) - f.close() - except: - pass - \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/json.c b/tests/JSONTestSuite/parsers/test_ccan_json/json/json.c deleted file mode 100644 index 2f0452aeb..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/json.c +++ /dev/null @@ -1,1381 +0,0 @@ -/* - Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com) - All rights reserved. - - 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. -*/ - -#include "json.h" - -#include -#include -#include -#include -#include - -#define out_of_memory() do { \ - fprintf(stderr, "Out of memory.\n"); \ - exit(EXIT_FAILURE); \ - } while (0) - -/* Sadly, strdup is not portable. */ -static char *json_strdup(const char *str) -{ - char *ret = (char*) malloc(strlen(str) + 1); - if (ret == NULL) - out_of_memory(); - strcpy(ret, str); - return ret; -} - -/* String buffer */ - -typedef struct -{ - char *cur; - char *end; - char *start; -} SB; - -static void sb_init(SB *sb) -{ - sb->start = (char*) malloc(17); - if (sb->start == NULL) - out_of_memory(); - sb->cur = sb->start; - sb->end = sb->start + 16; -} - -/* sb and need may be evaluated multiple times. */ -#define sb_need(sb, need) do { \ - if ((sb)->end - (sb)->cur < (need)) \ - sb_grow(sb, need); \ - } while (0) - -static void sb_grow(SB *sb, int need) -{ - size_t length = sb->cur - sb->start; - size_t alloc = sb->end - sb->start; - - do { - alloc *= 2; - } while (alloc < length + need); - - sb->start = (char*) realloc(sb->start, alloc + 1); - if (sb->start == NULL) - out_of_memory(); - sb->cur = sb->start + length; - sb->end = sb->start + alloc; -} - -static void sb_put(SB *sb, const char *bytes, int count) -{ - sb_need(sb, count); - memcpy(sb->cur, bytes, count); - sb->cur += count; -} - -#define sb_putc(sb, c) do { \ - if ((sb)->cur >= (sb)->end) \ - sb_grow(sb, 1); \ - *(sb)->cur++ = (c); \ - } while (0) - -static void sb_puts(SB *sb, const char *str) -{ - sb_put(sb, str, strlen(str)); -} - -static char *sb_finish(SB *sb) -{ - *sb->cur = 0; - assert(sb->start <= sb->cur && strlen(sb->start) == (size_t)(sb->cur - sb->start)); - return sb->start; -} - -static void sb_free(SB *sb) -{ - free(sb->start); -} - -/* - * Unicode helper functions - * - * These are taken from the ccan/charset module and customized a bit. - * Putting them here means the compiler can (choose to) inline them, - * and it keeps ccan/json from having a dependency. - */ - -/* - * Type for Unicode codepoints. - * We need our own because wchar_t might be 16 bits. - */ -typedef uint32_t uchar_t; - -/* - * Validate a single UTF-8 character starting at @s. - * The string must be null-terminated. - * - * If it's valid, return its length (1 thru 4). - * If it's invalid or clipped, return 0. - * - * This function implements the syntax given in RFC3629, which is - * the same as that given in The Unicode Standard, Version 6.0. - * - * It has the following properties: - * - * * All codepoints U+0000..U+10FFFF may be encoded, - * except for U+D800..U+DFFF, which are reserved - * for UTF-16 surrogate pair encoding. - * * UTF-8 byte sequences longer than 4 bytes are not permitted, - * as they exceed the range of Unicode. - * * The sixty-six Unicode "non-characters" are permitted - * (namely, U+FDD0..U+FDEF, U+xxFFFE, and U+xxFFFF). - */ -static int utf8_validate_cz(const char *s) -{ - unsigned char c = *s++; - - if (c <= 0x7F) { /* 00..7F */ - return 1; - } else if (c <= 0xC1) { /* 80..C1 */ - /* Disallow overlong 2-byte sequence. */ - return 0; - } else if (c <= 0xDF) { /* C2..DF */ - /* Make sure subsequent byte is in the range 0x80..0xBF. */ - if (((unsigned char)*s++ & 0xC0) != 0x80) - return 0; - - return 2; - } else if (c <= 0xEF) { /* E0..EF */ - /* Disallow overlong 3-byte sequence. */ - if (c == 0xE0 && (unsigned char)*s < 0xA0) - return 0; - - /* Disallow U+D800..U+DFFF. */ - if (c == 0xED && (unsigned char)*s > 0x9F) - return 0; - - /* Make sure subsequent bytes are in the range 0x80..0xBF. */ - if (((unsigned char)*s++ & 0xC0) != 0x80) - return 0; - if (((unsigned char)*s++ & 0xC0) != 0x80) - return 0; - - return 3; - } else if (c <= 0xF4) { /* F0..F4 */ - /* Disallow overlong 4-byte sequence. */ - if (c == 0xF0 && (unsigned char)*s < 0x90) - return 0; - - /* Disallow codepoints beyond U+10FFFF. */ - if (c == 0xF4 && (unsigned char)*s > 0x8F) - return 0; - - /* Make sure subsequent bytes are in the range 0x80..0xBF. */ - if (((unsigned char)*s++ & 0xC0) != 0x80) - return 0; - if (((unsigned char)*s++ & 0xC0) != 0x80) - return 0; - if (((unsigned char)*s++ & 0xC0) != 0x80) - return 0; - - return 4; - } else { /* F5..FF */ - return 0; - } -} - -/* Validate a null-terminated UTF-8 string. */ -static bool utf8_validate(const char *s) -{ - int len; - - for (; *s != 0; s += len) { - len = utf8_validate_cz(s); - if (len == 0) - return false; - } - - return true; -} - -/* - * Read a single UTF-8 character starting at @s, - * returning the length, in bytes, of the character read. - * - * This function assumes input is valid UTF-8, - * and that there are enough characters in front of @s. - */ -static int utf8_read_char(const char *s, uchar_t *out) -{ - const unsigned char *c = (const unsigned char*) s; - - assert(utf8_validate_cz(s)); - - if (c[0] <= 0x7F) { - /* 00..7F */ - *out = c[0]; - return 1; - } else if (c[0] <= 0xDF) { - /* C2..DF (unless input is invalid) */ - *out = ((uchar_t)c[0] & 0x1F) << 6 | - ((uchar_t)c[1] & 0x3F); - return 2; - } else if (c[0] <= 0xEF) { - /* E0..EF */ - *out = ((uchar_t)c[0] & 0xF) << 12 | - ((uchar_t)c[1] & 0x3F) << 6 | - ((uchar_t)c[2] & 0x3F); - return 3; - } else { - /* F0..F4 (unless input is invalid) */ - *out = ((uchar_t)c[0] & 0x7) << 18 | - ((uchar_t)c[1] & 0x3F) << 12 | - ((uchar_t)c[2] & 0x3F) << 6 | - ((uchar_t)c[3] & 0x3F); - return 4; - } -} - -/* - * Write a single UTF-8 character to @s, - * returning the length, in bytes, of the character written. - * - * @unicode must be U+0000..U+10FFFF, but not U+D800..U+DFFF. - * - * This function will write up to 4 bytes to @out. - */ -static int utf8_write_char(uchar_t unicode, char *out) -{ - unsigned char *o = (unsigned char*) out; - - assert(unicode <= 0x10FFFF && !(unicode >= 0xD800 && unicode <= 0xDFFF)); - - if (unicode <= 0x7F) { - /* U+0000..U+007F */ - *o++ = unicode; - return 1; - } else if (unicode <= 0x7FF) { - /* U+0080..U+07FF */ - *o++ = 0xC0 | unicode >> 6; - *o++ = 0x80 | (unicode & 0x3F); - return 2; - } else if (unicode <= 0xFFFF) { - /* U+0800..U+FFFF */ - *o++ = 0xE0 | unicode >> 12; - *o++ = 0x80 | (unicode >> 6 & 0x3F); - *o++ = 0x80 | (unicode & 0x3F); - return 3; - } else { - /* U+10000..U+10FFFF */ - *o++ = 0xF0 | unicode >> 18; - *o++ = 0x80 | (unicode >> 12 & 0x3F); - *o++ = 0x80 | (unicode >> 6 & 0x3F); - *o++ = 0x80 | (unicode & 0x3F); - return 4; - } -} - -/* - * Compute the Unicode codepoint of a UTF-16 surrogate pair. - * - * @uc should be 0xD800..0xDBFF, and @lc should be 0xDC00..0xDFFF. - * If they aren't, this function returns false. - */ -static bool from_surrogate_pair(uint16_t uc, uint16_t lc, uchar_t *unicode) -{ - if (uc >= 0xD800 && uc <= 0xDBFF && lc >= 0xDC00 && lc <= 0xDFFF) { - *unicode = 0x10000 + ((((uchar_t)uc & 0x3FF) << 10) | (lc & 0x3FF)); - return true; - } else { - return false; - } -} - -/* - * Construct a UTF-16 surrogate pair given a Unicode codepoint. - * - * @unicode must be U+10000..U+10FFFF. - */ -static void to_surrogate_pair(uchar_t unicode, uint16_t *uc, uint16_t *lc) -{ - uchar_t n; - - assert(unicode >= 0x10000 && unicode <= 0x10FFFF); - - n = unicode - 0x10000; - *uc = ((n >> 10) & 0x3FF) | 0xD800; - *lc = (n & 0x3FF) | 0xDC00; -} - -#define is_space(c) ((c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == ' ') -#define is_digit(c) ((c) >= '0' && (c) <= '9') - -static bool parse_value (const char **sp, JsonNode **out); -static bool parse_string (const char **sp, char **out); -static bool parse_number (const char **sp, double *out); -static bool parse_array (const char **sp, JsonNode **out); -static bool parse_object (const char **sp, JsonNode **out); -static bool parse_hex16 (const char **sp, uint16_t *out); - -static bool expect_literal (const char **sp, const char *str); -static void skip_space (const char **sp); - -static void emit_value (SB *out, const JsonNode *node); -static void emit_value_indented (SB *out, const JsonNode *node, const char *space, int indent_level); -static void emit_string (SB *out, const char *str); -static void emit_number (SB *out, double num); -static void emit_array (SB *out, const JsonNode *array); -static void emit_array_indented (SB *out, const JsonNode *array, const char *space, int indent_level); -static void emit_object (SB *out, const JsonNode *object); -static void emit_object_indented (SB *out, const JsonNode *object, const char *space, int indent_level); - -static int write_hex16(char *out, uint16_t val); - -static JsonNode *mknode(JsonTag tag); -static void append_node(JsonNode *parent, JsonNode *child); -static void prepend_node(JsonNode *parent, JsonNode *child); -static void append_member(JsonNode *object, char *key, JsonNode *value); - -/* Assertion-friendly validity checks */ -static bool tag_is_valid(unsigned int tag); -static bool number_is_valid(const char *num); - -JsonNode *json_decode(const char *json) -{ - const char *s = json; - JsonNode *ret; - - skip_space(&s); - if (!parse_value(&s, &ret)) - return NULL; - - skip_space(&s); - if (*s != 0) { - json_delete(ret); - return NULL; - } - - return ret; -} - -char *json_encode(const JsonNode *node) -{ - return json_stringify(node, NULL); -} - -char *json_encode_string(const char *str) -{ - SB sb; - sb_init(&sb); - - emit_string(&sb, str); - - return sb_finish(&sb); -} - -char *json_stringify(const JsonNode *node, const char *space) -{ - SB sb; - sb_init(&sb); - - if (space != NULL) - emit_value_indented(&sb, node, space, 0); - else - emit_value(&sb, node); - - return sb_finish(&sb); -} - -void json_delete(JsonNode *node) -{ - if (node != NULL) { - json_remove_from_parent(node); - - switch (node->tag) { - case JSON_STRING: - free(node->string_); - break; - case JSON_ARRAY: - case JSON_OBJECT: - { - JsonNode *child, *next; - for (child = node->children.head; child != NULL; child = next) { - next = child->next; - json_delete(child); - } - break; - } - default:; - } - - free(node); - } -} - -bool json_validate(const char *json) -{ - const char *s = json; - - skip_space(&s); - if (!parse_value(&s, NULL)) - return false; - - skip_space(&s); - if (*s != 0) - return false; - - return true; -} - -JsonNode *json_find_element(JsonNode *array, int index) -{ - JsonNode *element; - int i = 0; - - if (array == NULL || array->tag != JSON_ARRAY) - return NULL; - - json_foreach(element, array) { - if (i == index) - return element; - i++; - } - - return NULL; -} - -JsonNode *json_find_member(JsonNode *object, const char *name) -{ - JsonNode *member; - - if (object == NULL || object->tag != JSON_OBJECT) - return NULL; - - json_foreach(member, object) - if (strcmp(member->key, name) == 0) - return member; - - return NULL; -} - -JsonNode *json_first_child(const JsonNode *node) -{ - if (node != NULL && (node->tag == JSON_ARRAY || node->tag == JSON_OBJECT)) - return node->children.head; - return NULL; -} - -static JsonNode *mknode(JsonTag tag) -{ - JsonNode *ret = (JsonNode*) calloc(1, sizeof(JsonNode)); - if (ret == NULL) - out_of_memory(); - ret->tag = tag; - return ret; -} - -JsonNode *json_mknull(void) -{ - return mknode(JSON_NULL); -} - -JsonNode *json_mkbool(bool b) -{ - JsonNode *ret = mknode(JSON_BOOL); - ret->bool_ = b; - return ret; -} - -static JsonNode *mkstring(char *s) -{ - JsonNode *ret = mknode(JSON_STRING); - ret->string_ = s; - return ret; -} - -JsonNode *json_mkstring(const char *s) -{ - return mkstring(json_strdup(s)); -} - -JsonNode *json_mknumber(double n) -{ - JsonNode *node = mknode(JSON_NUMBER); - node->number_ = n; - return node; -} - -JsonNode *json_mkarray(void) -{ - return mknode(JSON_ARRAY); -} - -JsonNode *json_mkobject(void) -{ - return mknode(JSON_OBJECT); -} - -static void append_node(JsonNode *parent, JsonNode *child) -{ - child->parent = parent; - child->prev = parent->children.tail; - child->next = NULL; - - if (parent->children.tail != NULL) - parent->children.tail->next = child; - else - parent->children.head = child; - parent->children.tail = child; -} - -static void prepend_node(JsonNode *parent, JsonNode *child) -{ - child->parent = parent; - child->prev = NULL; - child->next = parent->children.head; - - if (parent->children.head != NULL) - parent->children.head->prev = child; - else - parent->children.tail = child; - parent->children.head = child; -} - -static void append_member(JsonNode *object, char *key, JsonNode *value) -{ - value->key = key; - append_node(object, value); -} - -void json_append_element(JsonNode *array, JsonNode *element) -{ - assert(array->tag == JSON_ARRAY); - assert(element->parent == NULL); - - append_node(array, element); -} - -void json_prepend_element(JsonNode *array, JsonNode *element) -{ - assert(array->tag == JSON_ARRAY); - assert(element->parent == NULL); - - prepend_node(array, element); -} - -void json_append_member(JsonNode *object, const char *key, JsonNode *value) -{ - assert(object->tag == JSON_OBJECT); - assert(value->parent == NULL); - - append_member(object, json_strdup(key), value); -} - -void json_prepend_member(JsonNode *object, const char *key, JsonNode *value) -{ - assert(object->tag == JSON_OBJECT); - assert(value->parent == NULL); - - value->key = json_strdup(key); - prepend_node(object, value); -} - -void json_remove_from_parent(JsonNode *node) -{ - JsonNode *parent = node->parent; - - if (parent != NULL) { - if (node->prev != NULL) - node->prev->next = node->next; - else - parent->children.head = node->next; - if (node->next != NULL) - node->next->prev = node->prev; - else - parent->children.tail = node->prev; - - free(node->key); - - node->parent = NULL; - node->prev = node->next = NULL; - node->key = NULL; - } -} - -static bool parse_value(const char **sp, JsonNode **out) -{ - const char *s = *sp; - - switch (*s) { - case 'n': - if (expect_literal(&s, "null")) { - if (out) - *out = json_mknull(); - *sp = s; - return true; - } - return false; - - case 'f': - if (expect_literal(&s, "false")) { - if (out) - *out = json_mkbool(false); - *sp = s; - return true; - } - return false; - - case 't': - if (expect_literal(&s, "true")) { - if (out) - *out = json_mkbool(true); - *sp = s; - return true; - } - return false; - - case '"': { - char *str; - if (parse_string(&s, out ? &str : NULL)) { - if (out) - *out = mkstring(str); - *sp = s; - return true; - } - return false; - } - - case '[': - if (parse_array(&s, out)) { - *sp = s; - return true; - } - return false; - - case '{': - if (parse_object(&s, out)) { - *sp = s; - return true; - } - return false; - - default: { - double num; - if (parse_number(&s, out ? &num : NULL)) { - if (out) - *out = json_mknumber(num); - *sp = s; - return true; - } - return false; - } - } -} - -static bool parse_array(const char **sp, JsonNode **out) -{ - const char *s = *sp; - JsonNode *ret = out ? json_mkarray() : NULL; - JsonNode *element; - - if (*s++ != '[') - goto failure; - skip_space(&s); - - if (*s == ']') { - s++; - goto success; - } - - for (;;) { - if (!parse_value(&s, out ? &element : NULL)) - goto failure; - skip_space(&s); - - if (out) - json_append_element(ret, element); - - if (*s == ']') { - s++; - goto success; - } - - if (*s++ != ',') - goto failure; - skip_space(&s); - } - -success: - *sp = s; - if (out) - *out = ret; - return true; - -failure: - json_delete(ret); - return false; -} - -static bool parse_object(const char **sp, JsonNode **out) -{ - const char *s = *sp; - JsonNode *ret = out ? json_mkobject() : NULL; - char *key; - JsonNode *value; - - if (*s++ != '{') - goto failure; - skip_space(&s); - - if (*s == '}') { - s++; - goto success; - } - - for (;;) { - if (!parse_string(&s, out ? &key : NULL)) - goto failure; - skip_space(&s); - - if (*s++ != ':') - goto failure_free_key; - skip_space(&s); - - if (!parse_value(&s, out ? &value : NULL)) - goto failure_free_key; - skip_space(&s); - - if (out) - append_member(ret, key, value); - - if (*s == '}') { - s++; - goto success; - } - - if (*s++ != ',') - goto failure; - skip_space(&s); - } - -success: - *sp = s; - if (out) - *out = ret; - return true; - -failure_free_key: - if (out) - free(key); -failure: - json_delete(ret); - return false; -} - -bool parse_string(const char **sp, char **out) -{ - const char *s = *sp; - SB sb; - char throwaway_buffer[4]; - /* enough space for a UTF-8 character */ - char *b; - - if (*s++ != '"') - return false; - - if (out) { - sb_init(&sb); - sb_need(&sb, 4); - b = sb.cur; - } else { - b = throwaway_buffer; - } - - while (*s != '"') { - unsigned char c = *s++; - - /* Parse next character, and write it to b. */ - if (c == '\\') { - c = *s++; - switch (c) { - case '"': - case '\\': - case '/': - *b++ = c; - break; - case 'b': - *b++ = '\b'; - break; - case 'f': - *b++ = '\f'; - break; - case 'n': - *b++ = '\n'; - break; - case 'r': - *b++ = '\r'; - break; - case 't': - *b++ = '\t'; - break; - case 'u': - { - uint16_t uc, lc; - uchar_t unicode; - - if (!parse_hex16(&s, &uc)) - goto failed; - - if (uc >= 0xD800 && uc <= 0xDFFF) { - /* Handle UTF-16 surrogate pair. */ - if (*s++ != '\\' || *s++ != 'u' || !parse_hex16(&s, &lc)) - goto failed; /* Incomplete surrogate pair. */ - if (!from_surrogate_pair(uc, lc, &unicode)) - goto failed; /* Invalid surrogate pair. */ - } else if (uc == 0) { - /* Disallow "\u0000". */ - goto failed; - } else { - unicode = uc; - } - - b += utf8_write_char(unicode, b); - break; - } - default: - /* Invalid escape */ - goto failed; - } - } else if (c <= 0x1F) { - /* Control characters are not allowed in string literals. */ - goto failed; - } else { - /* Validate and echo a UTF-8 character. */ - int len; - - s--; - len = utf8_validate_cz(s); - if (len == 0) - goto failed; /* Invalid UTF-8 character. */ - - while (len--) - *b++ = *s++; - } - - /* - * Update sb to know about the new bytes, - * and set up b to write another character. - */ - if (out) { - sb.cur = b; - sb_need(&sb, 4); - b = sb.cur; - } else { - b = throwaway_buffer; - } - } - s++; - - if (out) - *out = sb_finish(&sb); - *sp = s; - return true; - -failed: - if (out) - sb_free(&sb); - return false; -} - -/* - * The JSON spec says that a number shall follow this precise pattern - * (spaces and quotes added for readability): - * '-'? (0 | [1-9][0-9]*) ('.' [0-9]+)? ([Ee] [+-]? [0-9]+)? - * - * However, some JSON parsers are more liberal. For instance, PHP accepts - * '.5' and '1.'. JSON.parse accepts '+3'. - * - * This function takes the strict approach. - */ -bool parse_number(const char **sp, double *out) -{ - const char *s = *sp; - - /* '-'? */ - if (*s == '-') - s++; - - /* (0 | [1-9][0-9]*) */ - if (*s == '0') { - s++; - } else { - if (!is_digit(*s)) - return false; - do { - s++; - } while (is_digit(*s)); - } - - /* ('.' [0-9]+)? */ - if (*s == '.') { - s++; - if (!is_digit(*s)) - return false; - do { - s++; - } while (is_digit(*s)); - } - - /* ([Ee] [+-]? [0-9]+)? */ - if (*s == 'E' || *s == 'e') { - s++; - if (*s == '+' || *s == '-') - s++; - if (!is_digit(*s)) - return false; - do { - s++; - } while (is_digit(*s)); - } - - if (out) - *out = strtod(*sp, NULL); - - *sp = s; - return true; -} - -static void skip_space(const char **sp) -{ - const char *s = *sp; - while (is_space(*s)) - s++; - *sp = s; -} - -static void emit_value(SB *out, const JsonNode *node) -{ - assert(tag_is_valid(node->tag)); - switch (node->tag) { - case JSON_NULL: - sb_puts(out, "null"); - break; - case JSON_BOOL: - sb_puts(out, node->bool_ ? "true" : "false"); - break; - case JSON_STRING: - emit_string(out, node->string_); - break; - case JSON_NUMBER: - emit_number(out, node->number_); - break; - case JSON_ARRAY: - emit_array(out, node); - break; - case JSON_OBJECT: - emit_object(out, node); - break; - default: - assert(false); - } -} - -void emit_value_indented(SB *out, const JsonNode *node, const char *space, int indent_level) -{ - assert(tag_is_valid(node->tag)); - switch (node->tag) { - case JSON_NULL: - sb_puts(out, "null"); - break; - case JSON_BOOL: - sb_puts(out, node->bool_ ? "true" : "false"); - break; - case JSON_STRING: - emit_string(out, node->string_); - break; - case JSON_NUMBER: - emit_number(out, node->number_); - break; - case JSON_ARRAY: - emit_array_indented(out, node, space, indent_level); - break; - case JSON_OBJECT: - emit_object_indented(out, node, space, indent_level); - break; - default: - assert(false); - } -} - -static void emit_array(SB *out, const JsonNode *array) -{ - const JsonNode *element; - - sb_putc(out, '['); - json_foreach(element, array) { - emit_value(out, element); - if (element->next != NULL) - sb_putc(out, ','); - } - sb_putc(out, ']'); -} - -static void emit_array_indented(SB *out, const JsonNode *array, const char *space, int indent_level) -{ - const JsonNode *element = array->children.head; - int i; - - if (element == NULL) { - sb_puts(out, "[]"); - return; - } - - sb_puts(out, "[\n"); - while (element != NULL) { - for (i = 0; i < indent_level + 1; i++) - sb_puts(out, space); - emit_value_indented(out, element, space, indent_level + 1); - - element = element->next; - sb_puts(out, element != NULL ? ",\n" : "\n"); - } - for (i = 0; i < indent_level; i++) - sb_puts(out, space); - sb_putc(out, ']'); -} - -static void emit_object(SB *out, const JsonNode *object) -{ - const JsonNode *member; - - sb_putc(out, '{'); - json_foreach(member, object) { - emit_string(out, member->key); - sb_putc(out, ':'); - emit_value(out, member); - if (member->next != NULL) - sb_putc(out, ','); - } - sb_putc(out, '}'); -} - -static void emit_object_indented(SB *out, const JsonNode *object, const char *space, int indent_level) -{ - const JsonNode *member = object->children.head; - int i; - - if (member == NULL) { - sb_puts(out, "{}"); - return; - } - - sb_puts(out, "{\n"); - while (member != NULL) { - for (i = 0; i < indent_level + 1; i++) - sb_puts(out, space); - emit_string(out, member->key); - sb_puts(out, ": "); - emit_value_indented(out, member, space, indent_level + 1); - - member = member->next; - sb_puts(out, member != NULL ? ",\n" : "\n"); - } - for (i = 0; i < indent_level; i++) - sb_puts(out, space); - sb_putc(out, '}'); -} - -void emit_string(SB *out, const char *str) -{ - bool escape_unicode = false; - const char *s = str; - char *b; - - assert(utf8_validate(str)); - - /* - * 14 bytes is enough space to write up to two - * \uXXXX escapes and two quotation marks. - */ - sb_need(out, 14); - b = out->cur; - - *b++ = '"'; - while (*s != 0) { - unsigned char c = *s++; - - /* Encode the next character, and write it to b. */ - switch (c) { - case '"': - *b++ = '\\'; - *b++ = '"'; - break; - case '\\': - *b++ = '\\'; - *b++ = '\\'; - break; - case '\b': - *b++ = '\\'; - *b++ = 'b'; - break; - case '\f': - *b++ = '\\'; - *b++ = 'f'; - break; - case '\n': - *b++ = '\\'; - *b++ = 'n'; - break; - case '\r': - *b++ = '\\'; - *b++ = 'r'; - break; - case '\t': - *b++ = '\\'; - *b++ = 't'; - break; - default: { - int len; - - s--; - len = utf8_validate_cz(s); - - if (len == 0) { - /* - * Handle invalid UTF-8 character gracefully in production - * by writing a replacement character (U+FFFD) - * and skipping a single byte. - * - * This should never happen when assertions are enabled - * due to the assertion at the beginning of this function. - */ - assert(false); - if (escape_unicode) { - strcpy(b, "\\uFFFD"); - b += 6; - } else { - *b++ = 0xEF; - *b++ = 0xBF; - *b++ = 0xBD; - } - s++; - } else if (c < 0x1F || (c >= 0x80 && escape_unicode)) { - /* Encode using \u.... */ - uint32_t unicode; - - s += utf8_read_char(s, &unicode); - - if (unicode <= 0xFFFF) { - *b++ = '\\'; - *b++ = 'u'; - b += write_hex16(b, unicode); - } else { - /* Produce a surrogate pair. */ - uint16_t uc, lc; - assert(unicode <= 0x10FFFF); - to_surrogate_pair(unicode, &uc, &lc); - *b++ = '\\'; - *b++ = 'u'; - b += write_hex16(b, uc); - *b++ = '\\'; - *b++ = 'u'; - b += write_hex16(b, lc); - } - } else { - /* Write the character directly. */ - while (len--) - *b++ = *s++; - } - - break; - } - } - - /* - * Update *out to know about the new bytes, - * and set up b to write another encoded character. - */ - out->cur = b; - sb_need(out, 14); - b = out->cur; - } - *b++ = '"'; - - out->cur = b; -} - -static void emit_number(SB *out, double num) -{ - /* - * This isn't exactly how JavaScript renders numbers, - * but it should produce valid JSON for reasonable numbers - * preserve precision well enough, and avoid some oddities - * like 0.3 -> 0.299999999999999988898 . - */ - char buf[64]; - sprintf(buf, "%.16g", num); - - if (number_is_valid(buf)) - sb_puts(out, buf); - else - sb_puts(out, "null"); -} - -static bool tag_is_valid(unsigned int tag) -{ - return (/* tag >= JSON_NULL && */ tag <= JSON_OBJECT); -} - -static bool number_is_valid(const char *num) -{ - return (parse_number(&num, NULL) && *num == '\0'); -} - -static bool expect_literal(const char **sp, const char *str) -{ - const char *s = *sp; - - while (*str != '\0') - if (*s++ != *str++) - return false; - - *sp = s; - return true; -} - -/* - * Parses exactly 4 hex characters (capital or lowercase). - * Fails if any input chars are not [0-9A-Fa-f]. - */ -static bool parse_hex16(const char **sp, uint16_t *out) -{ - const char *s = *sp; - uint16_t ret = 0; - uint16_t i; - uint16_t tmp; - char c; - - for (i = 0; i < 4; i++) { - c = *s++; - if (c >= '0' && c <= '9') - tmp = c - '0'; - else if (c >= 'A' && c <= 'F') - tmp = c - 'A' + 10; - else if (c >= 'a' && c <= 'f') - tmp = c - 'a' + 10; - else - return false; - - ret <<= 4; - ret += tmp; - } - - if (out) - *out = ret; - *sp = s; - return true; -} - -/* - * Encodes a 16-bit number into hexadecimal, - * writing exactly 4 hex chars. - */ -static int write_hex16(char *out, uint16_t val) -{ - const char *hex = "0123456789ABCDEF"; - - *out++ = hex[(val >> 12) & 0xF]; - *out++ = hex[(val >> 8) & 0xF]; - *out++ = hex[(val >> 4) & 0xF]; - *out++ = hex[ val & 0xF]; - - return 4; -} - -bool json_check(const JsonNode *node, char errmsg[256]) -{ - #define problem(...) do { \ - if (errmsg != NULL) \ - snprintf(errmsg, 256, __VA_ARGS__); \ - return false; \ - } while (0) - - if (node->key != NULL && !utf8_validate(node->key)) - problem("key contains invalid UTF-8"); - - if (!tag_is_valid(node->tag)) - problem("tag is invalid (%u)", node->tag); - - if (node->tag == JSON_BOOL) { - if (node->bool_ != false && node->bool_ != true) - problem("bool_ is neither false (%d) nor true (%d)", (int)false, (int)true); - } else if (node->tag == JSON_STRING) { - if (node->string_ == NULL) - problem("string_ is NULL"); - if (!utf8_validate(node->string_)) - problem("string_ contains invalid UTF-8"); - } else if (node->tag == JSON_ARRAY || node->tag == JSON_OBJECT) { - JsonNode *head = node->children.head; - JsonNode *tail = node->children.tail; - - if (head == NULL || tail == NULL) { - if (head != NULL) - problem("tail is NULL, but head is not"); - if (tail != NULL) - problem("head is NULL, but tail is not"); - } else { - JsonNode *child; - JsonNode *last = NULL; - - if (head->prev != NULL) - problem("First child's prev pointer is not NULL"); - - for (child = head; child != NULL; last = child, child = child->next) { - if (child == node) - problem("node is its own child"); - if (child->next == child) - problem("child->next == child (cycle)"); - if (child->next == head) - problem("child->next == head (cycle)"); - - if (child->parent != node) - problem("child does not point back to parent"); - if (child->next != NULL && child->next->prev != child) - problem("child->next does not point back to child"); - - if (node->tag == JSON_ARRAY && child->key != NULL) - problem("Array element's key is not NULL"); - if (node->tag == JSON_OBJECT && child->key == NULL) - problem("Object member's key is NULL"); - - if (!json_check(child, errmsg)) - return false; - } - - if (last != tail) - problem("tail does not match pointer found by starting at head and following next links"); - } - } - - return true; - - #undef problem -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/json/json.h b/tests/JSONTestSuite/parsers/test_ccan_json/json/json.h deleted file mode 100644 index ed5255e68..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/json/json.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com) - All rights reserved. - - 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. -*/ - -#ifndef CCAN_JSON_H -#define CCAN_JSON_H - -#include -#include - -typedef enum { - JSON_NULL, - JSON_BOOL, - JSON_STRING, - JSON_NUMBER, - JSON_ARRAY, - JSON_OBJECT, -} JsonTag; - -typedef struct JsonNode JsonNode; - -struct JsonNode -{ - /* only if parent is an object or array (NULL otherwise) */ - JsonNode *parent; - JsonNode *prev, *next; - - /* only if parent is an object (NULL otherwise) */ - char *key; /* Must be valid UTF-8. */ - - JsonTag tag; - union { - /* JSON_BOOL */ - bool bool_; - - /* JSON_STRING */ - char *string_; /* Must be valid UTF-8. */ - - /* JSON_NUMBER */ - double number_; - - /* JSON_ARRAY */ - /* JSON_OBJECT */ - struct { - JsonNode *head, *tail; - } children; - }; -}; - -/*** Encoding, decoding, and validation ***/ - -JsonNode *json_decode (const char *json); -char *json_encode (const JsonNode *node); -char *json_encode_string (const char *str); -char *json_stringify (const JsonNode *node, const char *space); -void json_delete (JsonNode *node); - -bool json_validate (const char *json); - -/*** Lookup and traversal ***/ - -JsonNode *json_find_element (JsonNode *array, int index); -JsonNode *json_find_member (JsonNode *object, const char *key); - -JsonNode *json_first_child (const JsonNode *node); - -#define json_foreach(i, object_or_array) \ - for ((i) = json_first_child(object_or_array); \ - (i) != NULL; \ - (i) = (i)->next) - -/*** Construction and manipulation ***/ - -JsonNode *json_mknull(void); -JsonNode *json_mkbool(bool b); -JsonNode *json_mkstring(const char *s); -JsonNode *json_mknumber(double n); -JsonNode *json_mkarray(void); -JsonNode *json_mkobject(void); - -void json_append_element(JsonNode *array, JsonNode *element); -void json_prepend_element(JsonNode *array, JsonNode *element); -void json_append_member(JsonNode *object, const char *key, JsonNode *value); -void json_prepend_member(JsonNode *object, const char *key, JsonNode *value); - -void json_remove_from_parent(JsonNode *node); - -/*** Debugging ***/ - -/* - * Look for structure and encoding problems in a JsonNode or its descendents. - * - * If a problem is detected, return false, writing a description of the problem - * to errmsg (unless errmsg is NULL). - */ -bool json_check(const JsonNode *node, char errmsg[256]); - -#endif diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.pbxproj deleted file mode 100644 index 46105549a..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.pbxproj +++ /dev/null @@ -1,262 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03997FA71D71B34E0001C89F /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 03997FA61D71B34E0001C89F /* main.c */; }; - 03997FAF1D71B3580001C89F /* json.c in Sources */ = {isa = PBXBuildFile; fileRef = 03997FAD1D71B3580001C89F /* json.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03997FA11D71B34E0001C89F /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03997FA31D71B34E0001C89F /* test_ccan */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_ccan; sourceTree = BUILT_PRODUCTS_DIR; }; - 03997FA61D71B34E0001C89F /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 03997FAD1D71B3580001C89F /* json.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = json.c; path = ../json/json.c; sourceTree = ""; }; - 03997FAE1D71B3580001C89F /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json.h; path = ../json/json.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03997FA01D71B34E0001C89F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03997F9A1D71B34E0001C89F = { - isa = PBXGroup; - children = ( - 03997FAD1D71B3580001C89F /* json.c */, - 03997FAE1D71B3580001C89F /* json.h */, - 03997FA51D71B34E0001C89F /* test_ccan */, - 03997FA41D71B34E0001C89F /* Products */, - ); - sourceTree = ""; - }; - 03997FA41D71B34E0001C89F /* Products */ = { - isa = PBXGroup; - children = ( - 03997FA31D71B34E0001C89F /* test_ccan */, - ); - name = Products; - sourceTree = ""; - }; - 03997FA51D71B34E0001C89F /* test_ccan */ = { - isa = PBXGroup; - children = ( - 03997FA61D71B34E0001C89F /* main.c */, - ); - path = test_ccan; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03997FA21D71B34E0001C89F /* test_ccan */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03997FAA1D71B34E0001C89F /* Build configuration list for PBXNativeTarget "test_ccan" */; - buildPhases = ( - 03997F9F1D71B34E0001C89F /* Sources */, - 03997FA01D71B34E0001C89F /* Frameworks */, - 03997FA11D71B34E0001C89F /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_ccan; - productName = test_ccan; - productReference = 03997FA31D71B34E0001C89F /* test_ccan */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03997F9B1D71B34E0001C89F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03997FA21D71B34E0001C89F = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03997F9E1D71B34E0001C89F /* Build configuration list for PBXProject "test_ccan" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03997F9A1D71B34E0001C89F; - productRefGroup = 03997FA41D71B34E0001C89F /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03997FA21D71B34E0001C89F /* test_ccan */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03997F9F1D71B34E0001C89F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03997FA71D71B34E0001C89F /* main.c in Sources */, - 03997FAF1D71B3580001C89F /* json.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03997FA81D71B34E0001C89F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03997FA91D71B34E0001C89F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03997FAB1D71B34E0001C89F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03997FAC1D71B34E0001C89F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = VBYRKYS73S; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03997F9E1D71B34E0001C89F /* Build configuration list for PBXProject "test_ccan" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03997FA81D71B34E0001C89F /* Debug */, - 03997FA91D71B34E0001C89F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03997FAA1D71B34E0001C89F /* Build configuration list for PBXNativeTarget "test_ccan" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03997FAB1D71B34E0001C89F /* Debug */, - 03997FAC1D71B34E0001C89F /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03997F9B1D71B34E0001C89F /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 9abfb504d..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 017953f38..000000000 Binary files a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_ccan.xcscheme b/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_ccan.xcscheme deleted file mode 100644 index 9ecc1cd05..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_ccan.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 326100823..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_ccan.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03997FA21D71B34E0001C89F - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan/main.c b/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan/main.c deleted file mode 100644 index e1526c7c9..000000000 --- a/tests/JSONTestSuite/parsers/test_ccan_json/test_ccan/test_ccan/main.c +++ /dev/null @@ -1,44 +0,0 @@ -// -// main.c -// test_ccan -// -// Created by nst on 27/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#include -#include -#include "json.h" - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -TestStatus testFile(const char *filename) { - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return ERROR; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - - bool isValid = json_validate(data); - - free(data); - - return isValid ? PASS : FAIL; -} - -int main(int argc, const char * argv[]) { - - const char* path = argv[1]; - - int result = testFile(path); - - if (result == PASS) { - return 0; - } else { - return 1; - } -} diff --git a/tests/JSONTestSuite/parsers/test_dkjson.lua b/tests/JSONTestSuite/parsers/test_dkjson.lua deleted file mode 100644 index 242369bc5..000000000 --- a/tests/JSONTestSuite/parsers/test_dkjson.lua +++ /dev/null @@ -1,25 +0,0 @@ -local json = require ("dkjson") -- luarocks install dkjson - -function readAll(file) - local f = io.open(file, "rb") - local content = f:read("*all") - f:close() - return content -end - -local data = readAll(arg[1]) - -local obj, pos, err = json.decode(data) - --- print ("obj:", obj) --- print ("pos:", pos) --- print ("err:", err) - -if err then - print ("Error:", err) - os.exit(1) -end - --- print ("--", obj) - -os.exit(0) diff --git a/tests/JSONTestSuite/parsers/test_go/test_json b/tests/JSONTestSuite/parsers/test_go/test_json deleted file mode 100755 index 8ffd41d31..000000000 Binary files a/tests/JSONTestSuite/parsers/test_go/test_json and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_go/test_json.go b/tests/JSONTestSuite/parsers/test_go/test_json.go deleted file mode 100644 index 109e7a27c..000000000 --- a/tests/JSONTestSuite/parsers/test_go/test_json.go +++ /dev/null @@ -1,30 +0,0 @@ -// Go offers built-in support for JSON encoding and -// decoding, including to and from built-in and custom -// data types. - -package main - -import "encoding/json" -import "io/ioutil" -import "os" - -//import "fmt" - -func main() { - - b, file_err := ioutil.ReadFile(os.Args[1]) - if file_err != nil { - os.Exit(-1) - } - - var f interface{} - err := json.Unmarshal(b, &f) - - //fmt.Println(f) - - if err != nil { - os.Exit(1) - } - - os.Exit(0) -} diff --git a/tests/JSONTestSuite/parsers/test_haskell-aeson/.gitignore b/tests/JSONTestSuite/parsers/test_haskell-aeson/.gitignore deleted file mode 100644 index 8ee1bf948..000000000 --- a/tests/JSONTestSuite/parsers/test_haskell-aeson/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.stack-work diff --git a/tests/JSONTestSuite/parsers/test_haskell-aeson/package.yaml b/tests/JSONTestSuite/parsers/test_haskell-aeson/package.yaml deleted file mode 100644 index ec67c12d5..000000000 --- a/tests/JSONTestSuite/parsers/test_haskell-aeson/package.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: testaeson - -dependencies: - - base >= 4.7 && < 5 - - aeson - - base-prelude - - bytestring - -executables: - testaeson: - source-dirs: src - main: Main.hs diff --git a/tests/JSONTestSuite/parsers/test_haskell-aeson/src/Main.hs b/tests/JSONTestSuite/parsers/test_haskell-aeson/src/Main.hs deleted file mode 100644 index 91974a7a0..000000000 --- a/tests/JSONTestSuite/parsers/test_haskell-aeson/src/Main.hs +++ /dev/null @@ -1,29 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} - -module Main (main) where - -import qualified Data.Aeson as Aeson -import qualified Data.ByteString as Bytes -import BasePrelude -import System.IO - -_main :: Bytes.ByteString -> IO () -_main bytes = - case Aeson.eitherDecodeStrict' bytes of - Right (value :: Aeson.Value) -> - print value - Left e -> do - hPutStrLn stderr ("error: " <> show e) - exitWith (ExitFailure 1) - -main :: IO () -main = do - progName <- getProgName - args <- getArgs - case args of - [file] -> do - contents <- Bytes.readFile file - _main contents - _ -> do - hPutStrLn stderr ("Usage: " <> progName <> " file.json") - exitWith (ExitFailure 1) diff --git a/tests/JSONTestSuite/parsers/test_haskell-aeson/stack.yaml b/tests/JSONTestSuite/parsers/test_haskell-aeson/stack.yaml deleted file mode 100644 index e8d0944bb..000000000 --- a/tests/JSONTestSuite/parsers/test_haskell-aeson/stack.yaml +++ /dev/null @@ -1 +0,0 @@ -resolver: lts-6.22 diff --git a/tests/JSONTestSuite/parsers/test_haskell-aeson/testaeson b/tests/JSONTestSuite/parsers/test_haskell-aeson/testaeson deleted file mode 100755 index 9b1e28b28..000000000 --- a/tests/JSONTestSuite/parsers/test_haskell-aeson/testaeson +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -eu -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -cd $DIR -stack build -stack exec testaeson $@ diff --git a/tests/JSONTestSuite/parsers/test_haskell-aeson/testaeson.cabal b/tests/JSONTestSuite/parsers/test_haskell-aeson/testaeson.cabal deleted file mode 100644 index d439ac71f..000000000 --- a/tests/JSONTestSuite/parsers/test_haskell-aeson/testaeson.cabal +++ /dev/null @@ -1,21 +0,0 @@ --- This file has been generated from package.yaml by hpack version 0.28.2. --- --- see: https://github.com/sol/hpack --- --- hash: 716ef4c3e64849526f097b85ed05015e0072c2e2afcc1f91e58d8bea68b123b2 - -name: testaeson -version: 0.0.0 -build-type: Simple -cabal-version: >= 1.10 - -executable testaeson - main-is: Main.hs - hs-source-dirs: - src - build-depends: - aeson - , base >=4.7 && <5 - , base-prelude - , bytestring - default-language: Haskell2010 diff --git a/tests/JSONTestSuite/parsers/test_jansson/bin/test_jansson b/tests/JSONTestSuite/parsers/test_jansson/bin/test_jansson deleted file mode 100755 index e4f5dfa66..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jansson/bin/test_jansson and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jansson/dump.c b/tests/JSONTestSuite/parsers/test_jansson/dump.c deleted file mode 100644 index 912f955fc..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/dump.c +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include - -#include "jansson.h" -#include "jansson_private.h" -#include "strbuffer.h" -#include "utf.h" - -#define MAX_INTEGER_STR_LENGTH 100 -#define MAX_REAL_STR_LENGTH 100 - -#define FLAGS_TO_INDENT(f) ((f) & 0x1F) -#define FLAGS_TO_PRECISION(f) (((f) >> 11) & 0x1F) - -struct object_key { - size_t serial; - const char *key; -}; - -static int dump_to_strbuffer(const char *buffer, size_t size, void *data) -{ - return strbuffer_append_bytes((strbuffer_t *)data, buffer, size); -} - -static int dump_to_file(const char *buffer, size_t size, void *data) -{ - FILE *dest = (FILE *)data; - if(fwrite(buffer, size, 1, dest) != 1) - return -1; - return 0; -} - -/* 32 spaces (the maximum indentation size) */ -static const char whitespace[] = " "; - -static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t dump, void *data) -{ - if(FLAGS_TO_INDENT(flags) > 0) - { - unsigned int ws_count = FLAGS_TO_INDENT(flags), n_spaces = depth * ws_count; - - if(dump("\n", 1, data)) - return -1; - - while(n_spaces > 0) - { - int cur_n = n_spaces < sizeof whitespace - 1 ? n_spaces : sizeof whitespace - 1; - - if(dump(whitespace, cur_n, data)) - return -1; - - n_spaces -= cur_n; - } - } - else if(space && !(flags & JSON_COMPACT)) - { - return dump(" ", 1, data); - } - return 0; -} - -static int dump_string(const char *str, size_t len, json_dump_callback_t dump, void *data, size_t flags) -{ - const char *pos, *end, *lim; - int32_t codepoint; - - if(dump("\"", 1, data)) - return -1; - - end = pos = str; - lim = str + len; - while(1) - { - const char *text; - char seq[13]; - int length; - - while(end < lim) - { - end = utf8_iterate(pos, lim - pos, &codepoint); - if(!end) - return -1; - - /* mandatory escape or control char */ - if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20) - break; - - /* slash */ - if((flags & JSON_ESCAPE_SLASH) && codepoint == '/') - break; - - /* non-ASCII */ - if((flags & JSON_ENSURE_ASCII) && codepoint > 0x7F) - break; - - pos = end; - } - - if(pos != str) { - if(dump(str, pos - str, data)) - return -1; - } - - if(end == pos) - break; - - /* handle \, /, ", and control codes */ - length = 2; - switch(codepoint) - { - case '\\': text = "\\\\"; break; - case '\"': text = "\\\""; break; - case '\b': text = "\\b"; break; - case '\f': text = "\\f"; break; - case '\n': text = "\\n"; break; - case '\r': text = "\\r"; break; - case '\t': text = "\\t"; break; - case '/': text = "\\/"; break; - default: - { - /* codepoint is in BMP */ - if(codepoint < 0x10000) - { - snprintf(seq, sizeof(seq), "\\u%04X", (unsigned int)codepoint); - length = 6; - } - - /* not in BMP -> construct a UTF-16 surrogate pair */ - else - { - int32_t first, last; - - codepoint -= 0x10000; - first = 0xD800 | ((codepoint & 0xffc00) >> 10); - last = 0xDC00 | (codepoint & 0x003ff); - - snprintf(seq, sizeof(seq), "\\u%04X\\u%04X", (unsigned int)first, (unsigned int)last); - length = 12; - } - - text = seq; - break; - } - } - - if(dump(text, length, data)) - return -1; - - str = pos = end; - } - - return dump("\"", 1, data); -} - -static int object_key_compare_keys(const void *key1, const void *key2) -{ - return strcmp(((const struct object_key *)key1)->key, - ((const struct object_key *)key2)->key); -} - -static int object_key_compare_serials(const void *key1, const void *key2) -{ - size_t a = ((const struct object_key *)key1)->serial; - size_t b = ((const struct object_key *)key2)->serial; - - return a < b ? -1 : a == b ? 0 : 1; -} - -static int do_dump(const json_t *json, size_t flags, int depth, - json_dump_callback_t dump, void *data) -{ - if(!json) - return -1; - - switch(json_typeof(json)) { - case JSON_NULL: - return dump("null", 4, data); - - case JSON_TRUE: - return dump("true", 4, data); - - case JSON_FALSE: - return dump("false", 5, data); - - case JSON_INTEGER: - { - char buffer[MAX_INTEGER_STR_LENGTH]; - int size; - - size = snprintf(buffer, MAX_INTEGER_STR_LENGTH, - "%" JSON_INTEGER_FORMAT, - json_integer_value(json)); - if(size < 0 || size >= MAX_INTEGER_STR_LENGTH) - return -1; - - return dump(buffer, size, data); - } - - case JSON_REAL: - { - char buffer[MAX_REAL_STR_LENGTH]; - int size; - double value = json_real_value(json); - - size = jsonp_dtostr(buffer, MAX_REAL_STR_LENGTH, value, - FLAGS_TO_PRECISION(flags)); - if(size < 0) - return -1; - - return dump(buffer, size, data); - } - - case JSON_STRING: - return dump_string(json_string_value(json), json_string_length(json), dump, data, flags); - - case JSON_ARRAY: - { - size_t n; - size_t i; - - json_array_t *array; - - /* detect circular references */ - array = json_to_array(json); - if(array->visited) - goto array_error; - array->visited = 1; - - n = json_array_size(json); - - if(dump("[", 1, data)) - goto array_error; - if(n == 0) { - array->visited = 0; - return dump("]", 1, data); - } - if(dump_indent(flags, depth + 1, 0, dump, data)) - goto array_error; - - for(i = 0; i < n; ++i) { - if(do_dump(json_array_get(json, i), flags, depth + 1, - dump, data)) - goto array_error; - - if(i < n - 1) - { - if(dump(",", 1, data) || - dump_indent(flags, depth + 1, 1, dump, data)) - goto array_error; - } - else - { - if(dump_indent(flags, depth, 0, dump, data)) - goto array_error; - } - } - - array->visited = 0; - return dump("]", 1, data); - - array_error: - array->visited = 0; - return -1; - } - - case JSON_OBJECT: - { - json_object_t *object; - void *iter; - const char *separator; - int separator_length; - - if(flags & JSON_COMPACT) { - separator = ":"; - separator_length = 1; - } - else { - separator = ": "; - separator_length = 2; - } - - /* detect circular references */ - object = json_to_object(json); - if(object->visited) - goto object_error; - object->visited = 1; - - iter = json_object_iter((json_t *)json); - - if(dump("{", 1, data)) - goto object_error; - if(!iter) { - object->visited = 0; - return dump("}", 1, data); - } - if(dump_indent(flags, depth + 1, 0, dump, data)) - goto object_error; - - if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER) - { - struct object_key *keys; - size_t size, i; - int (*cmp_func)(const void *, const void *); - - size = json_object_size(json); - keys = jsonp_malloc(size * sizeof(struct object_key)); - if(!keys) - goto object_error; - - i = 0; - while(iter) - { - keys[i].serial = hashtable_iter_serial(iter); - keys[i].key = json_object_iter_key(iter); - iter = json_object_iter_next((json_t *)json, iter); - i++; - } - assert(i == size); - - if(flags & JSON_SORT_KEYS) - cmp_func = object_key_compare_keys; - else - cmp_func = object_key_compare_serials; - - qsort(keys, size, sizeof(struct object_key), cmp_func); - - for(i = 0; i < size; i++) - { - const char *key; - json_t *value; - - key = keys[i].key; - value = json_object_get(json, key); - assert(value); - - dump_string(key, strlen(key), dump, data, flags); - if(dump(separator, separator_length, data) || - do_dump(value, flags, depth + 1, dump, data)) - { - jsonp_free(keys); - goto object_error; - } - - if(i < size - 1) - { - if(dump(",", 1, data) || - dump_indent(flags, depth + 1, 1, dump, data)) - { - jsonp_free(keys); - goto object_error; - } - } - else - { - if(dump_indent(flags, depth, 0, dump, data)) - { - jsonp_free(keys); - goto object_error; - } - } - } - - jsonp_free(keys); - } - else - { - /* Don't sort keys */ - - while(iter) - { - void *next = json_object_iter_next((json_t *)json, iter); - const char *key = json_object_iter_key(iter); - - dump_string(key, strlen(key), dump, data, flags); - if(dump(separator, separator_length, data) || - do_dump(json_object_iter_value(iter), flags, depth + 1, - dump, data)) - goto object_error; - - if(next) - { - if(dump(",", 1, data) || - dump_indent(flags, depth + 1, 1, dump, data)) - goto object_error; - } - else - { - if(dump_indent(flags, depth, 0, dump, data)) - goto object_error; - } - - iter = next; - } - } - - object->visited = 0; - return dump("}", 1, data); - - object_error: - object->visited = 0; - return -1; - } - - default: - /* not reached */ - return -1; - } -} - -char *json_dumps(const json_t *json, size_t flags) -{ - strbuffer_t strbuff; - char *result; - - if(strbuffer_init(&strbuff)) - return NULL; - - if(json_dump_callback(json, dump_to_strbuffer, (void *)&strbuff, flags)) - result = NULL; - else - result = jsonp_strdup(strbuffer_value(&strbuff)); - - strbuffer_close(&strbuff); - return result; -} - -int json_dumpf(const json_t *json, FILE *output, size_t flags) -{ - return json_dump_callback(json, dump_to_file, (void *)output, flags); -} - -int json_dump_file(const json_t *json, const char *path, size_t flags) -{ - int result; - - FILE *output = fopen(path, "w"); - if(!output) - return -1; - - result = json_dumpf(json, output, flags); - - fclose(output); - return result; -} - -int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags) -{ - if(!(flags & JSON_ENCODE_ANY)) { - if(!json_is_array(json) && !json_is_object(json)) - return -1; - } - - return do_dump(json, flags, 0, callback, data); -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/error.c b/tests/JSONTestSuite/parsers/test_jansson/error.c deleted file mode 100644 index 58c83790d..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/error.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include "jansson_private.h" - -void jsonp_error_init(json_error_t *error, const char *source) -{ - if(error) - { - error->text[0] = '\0'; - error->line = -1; - error->column = -1; - error->position = 0; - if(source) - jsonp_error_set_source(error, source); - else - error->source[0] = '\0'; - } -} - -void jsonp_error_set_source(json_error_t *error, const char *source) -{ - size_t length; - - if(!error || !source) - return; - - length = strlen(source); - if(length < JSON_ERROR_SOURCE_LENGTH) - strncpy(error->source, source, length + 1); - else { - size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; - strncpy(error->source, "...", 3); - strncpy(error->source + 3, source + extra, length - extra + 1); - } -} - -void jsonp_error_set(json_error_t *error, int line, int column, - size_t position, const char *msg, ...) -{ - va_list ap; - - va_start(ap, msg); - jsonp_error_vset(error, line, column, position, msg, ap); - va_end(ap); -} - -void jsonp_error_vset(json_error_t *error, int line, int column, - size_t position, const char *msg, va_list ap) -{ - if(!error) - return; - - if(error->text[0] != '\0') { - /* error already set */ - return; - } - - error->line = line; - error->column = column; - error->position = (int)position; - - vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); - error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/hashtable.c b/tests/JSONTestSuite/parsers/test_jansson/hashtable.c deleted file mode 100644 index 1ff78063b..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/hashtable.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#if HAVE_CONFIG_H -#include -#endif - -#include -#include - -#if HAVE_STDINT_H -#include -#endif - -#include "jansson_config.h" /* for JSON_INLINE */ -#include "jansson_private.h" /* for container_of() */ -#include "hashtable.h" - -#ifndef INITIAL_HASHTABLE_ORDER -#define INITIAL_HASHTABLE_ORDER 3 -#endif - -typedef struct hashtable_list list_t; -typedef struct hashtable_pair pair_t; -typedef struct hashtable_bucket bucket_t; - -extern volatile uint32_t hashtable_seed; - -/* Implementation of the hash function */ -#include "lookup3.h" - -#define list_to_pair(list_) container_of(list_, pair_t, list) -#define hash_str(key) ((size_t)hashlittle((key), strlen(key), hashtable_seed)) - -static JSON_INLINE void list_init(list_t *list) -{ - list->next = list; - list->prev = list; -} - -static JSON_INLINE void list_insert(list_t *list, list_t *node) -{ - node->next = list; - node->prev = list->prev; - list->prev->next = node; - list->prev = node; -} - -static JSON_INLINE void list_remove(list_t *list) -{ - list->prev->next = list->next; - list->next->prev = list->prev; -} - -static JSON_INLINE int bucket_is_empty(hashtable_t *hashtable, bucket_t *bucket) -{ - return bucket->first == &hashtable->list && bucket->first == bucket->last; -} - -static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket, - list_t *list) -{ - if(bucket_is_empty(hashtable, bucket)) - { - list_insert(&hashtable->list, list); - bucket->first = bucket->last = list; - } - else - { - list_insert(bucket->first, list); - bucket->first = list; - } -} - -static pair_t *hashtable_find_pair(hashtable_t *hashtable, bucket_t *bucket, - const char *key, size_t hash) -{ - list_t *list; - pair_t *pair; - - if(bucket_is_empty(hashtable, bucket)) - return NULL; - - list = bucket->first; - while(1) - { - pair = list_to_pair(list); - if(pair->hash == hash && strcmp(pair->key, key) == 0) - return pair; - - if(list == bucket->last) - break; - - list = list->next; - } - - return NULL; -} - -/* returns 0 on success, -1 if key was not found */ -static int hashtable_do_del(hashtable_t *hashtable, - const char *key, size_t hash) -{ - pair_t *pair; - bucket_t *bucket; - size_t index; - - index = hash & hashmask(hashtable->order); - bucket = &hashtable->buckets[index]; - - pair = hashtable_find_pair(hashtable, bucket, key, hash); - if(!pair) - return -1; - - if(&pair->list == bucket->first && &pair->list == bucket->last) - bucket->first = bucket->last = &hashtable->list; - - else if(&pair->list == bucket->first) - bucket->first = pair->list.next; - - else if(&pair->list == bucket->last) - bucket->last = pair->list.prev; - - list_remove(&pair->list); - json_decref(pair->value); - - jsonp_free(pair); - hashtable->size--; - - return 0; -} - -static void hashtable_do_clear(hashtable_t *hashtable) -{ - list_t *list, *next; - pair_t *pair; - - for(list = hashtable->list.next; list != &hashtable->list; list = next) - { - next = list->next; - pair = list_to_pair(list); - json_decref(pair->value); - jsonp_free(pair); - } -} - -static int hashtable_do_rehash(hashtable_t *hashtable) -{ - list_t *list, *next; - pair_t *pair; - size_t i, index, new_size; - - jsonp_free(hashtable->buckets); - - hashtable->order++; - new_size = hashsize(hashtable->order); - - hashtable->buckets = jsonp_malloc(new_size * sizeof(bucket_t)); - if(!hashtable->buckets) - return -1; - - for(i = 0; i < hashsize(hashtable->order); i++) - { - hashtable->buckets[i].first = hashtable->buckets[i].last = - &hashtable->list; - } - - list = hashtable->list.next; - list_init(&hashtable->list); - - for(; list != &hashtable->list; list = next) { - next = list->next; - pair = list_to_pair(list); - index = pair->hash % new_size; - insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list); - } - - return 0; -} - - -int hashtable_init(hashtable_t *hashtable) -{ - size_t i; - - hashtable->size = 0; - hashtable->order = INITIAL_HASHTABLE_ORDER; - hashtable->buckets = jsonp_malloc(hashsize(hashtable->order) * sizeof(bucket_t)); - if(!hashtable->buckets) - return -1; - - list_init(&hashtable->list); - - for(i = 0; i < hashsize(hashtable->order); i++) - { - hashtable->buckets[i].first = hashtable->buckets[i].last = - &hashtable->list; - } - - return 0; -} - -void hashtable_close(hashtable_t *hashtable) -{ - hashtable_do_clear(hashtable); - jsonp_free(hashtable->buckets); -} - -int hashtable_set(hashtable_t *hashtable, - const char *key, size_t serial, - json_t *value) -{ - pair_t *pair; - bucket_t *bucket; - size_t hash, index; - - /* rehash if the load ratio exceeds 1 */ - if(hashtable->size >= hashsize(hashtable->order)) - if(hashtable_do_rehash(hashtable)) - return -1; - - hash = hash_str(key); - index = hash & hashmask(hashtable->order); - bucket = &hashtable->buckets[index]; - pair = hashtable_find_pair(hashtable, bucket, key, hash); - - if(pair) - { - json_decref(pair->value); - pair->value = value; - } - else - { - /* offsetof(...) returns the size of pair_t without the last, - flexible member. This way, the correct amount is - allocated. */ - - size_t len = strlen(key); - if(len >= (size_t)-1 - offsetof(pair_t, key)) { - /* Avoid an overflow if the key is very long */ - return -1; - } - - pair = jsonp_malloc(offsetof(pair_t, key) + len + 1); - if(!pair) - return -1; - - pair->hash = hash; - pair->serial = serial; - strncpy(pair->key, key, len + 1); - pair->value = value; - list_init(&pair->list); - - insert_to_bucket(hashtable, bucket, &pair->list); - - hashtable->size++; - } - return 0; -} - -void *hashtable_get(hashtable_t *hashtable, const char *key) -{ - pair_t *pair; - size_t hash; - bucket_t *bucket; - - hash = hash_str(key); - bucket = &hashtable->buckets[hash & hashmask(hashtable->order)]; - - pair = hashtable_find_pair(hashtable, bucket, key, hash); - if(!pair) - return NULL; - - return pair->value; -} - -int hashtable_del(hashtable_t *hashtable, const char *key) -{ - size_t hash = hash_str(key); - return hashtable_do_del(hashtable, key, hash); -} - -void hashtable_clear(hashtable_t *hashtable) -{ - size_t i; - - hashtable_do_clear(hashtable); - - for(i = 0; i < hashsize(hashtable->order); i++) - { - hashtable->buckets[i].first = hashtable->buckets[i].last = - &hashtable->list; - } - - list_init(&hashtable->list); - hashtable->size = 0; -} - -void *hashtable_iter(hashtable_t *hashtable) -{ - return hashtable_iter_next(hashtable, &hashtable->list); -} - -void *hashtable_iter_at(hashtable_t *hashtable, const char *key) -{ - pair_t *pair; - size_t hash; - bucket_t *bucket; - - hash = hash_str(key); - bucket = &hashtable->buckets[hash & hashmask(hashtable->order)]; - - pair = hashtable_find_pair(hashtable, bucket, key, hash); - if(!pair) - return NULL; - - return &pair->list; -} - -void *hashtable_iter_next(hashtable_t *hashtable, void *iter) -{ - list_t *list = (list_t *)iter; - if(list->next == &hashtable->list) - return NULL; - return list->next; -} - -void *hashtable_iter_key(void *iter) -{ - pair_t *pair = list_to_pair((list_t *)iter); - return pair->key; -} - -size_t hashtable_iter_serial(void *iter) -{ - pair_t *pair = list_to_pair((list_t *)iter); - return pair->serial; -} - -void *hashtable_iter_value(void *iter) -{ - pair_t *pair = list_to_pair((list_t *)iter); - return pair->value; -} - -void hashtable_iter_set(void *iter, json_t *value) -{ - pair_t *pair = list_to_pair((list_t *)iter); - - json_decref(pair->value); - pair->value = value; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/hashtable.h b/tests/JSONTestSuite/parsers/test_jansson/hashtable.h deleted file mode 100644 index fab6443ad..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/hashtable.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef HASHTABLE_H -#define HASHTABLE_H - -#include -#include "jansson.h" - -struct hashtable_list { - struct hashtable_list *prev; - struct hashtable_list *next; -}; - -/* "pair" may be a bit confusing a name, but think of it as a - key-value pair. In this case, it just encodes some extra data, - too */ -struct hashtable_pair { - struct hashtable_list list; - size_t hash; - json_t *value; - size_t serial; - char key[1]; -}; - -struct hashtable_bucket { - struct hashtable_list *first; - struct hashtable_list *last; -}; - -typedef struct hashtable { - size_t size; - struct hashtable_bucket *buckets; - size_t order; /* hashtable has pow(2, order) buckets */ - struct hashtable_list list; -} hashtable_t; - - -#define hashtable_key_to_iter(key_) \ - (&(container_of(key_, struct hashtable_pair, key)->list)) - - -/** - * hashtable_init - Initialize a hashtable object - * - * @hashtable: The (statically allocated) hashtable object - * - * Initializes a statically allocated hashtable object. The object - * should be cleared with hashtable_close when it's no longer used. - * - * Returns 0 on success, -1 on error (out of memory). - */ -int hashtable_init(hashtable_t *hashtable); - -/** - * hashtable_close - Release all resources used by a hashtable object - * - * @hashtable: The hashtable - * - * Destroys a statically allocated hashtable object. - */ -void hashtable_close(hashtable_t *hashtable); - -/** - * hashtable_set - Add/modify value in hashtable - * - * @hashtable: The hashtable object - * @key: The key - * @serial: For addition order of keys - * @value: The value - * - * If a value with the given key already exists, its value is replaced - * with the new value. Value is "stealed" in the sense that hashtable - * doesn't increment its refcount but decreases the refcount when the - * value is no longer needed. - * - * Returns 0 on success, -1 on failure (out of memory). - */ -int hashtable_set(hashtable_t *hashtable, - const char *key, size_t serial, - json_t *value); - -/** - * hashtable_get - Get a value associated with a key - * - * @hashtable: The hashtable object - * @key: The key - * - * Returns value if it is found, or NULL otherwise. - */ -void *hashtable_get(hashtable_t *hashtable, const char *key); - -/** - * hashtable_del - Remove a value from the hashtable - * - * @hashtable: The hashtable object - * @key: The key - * - * Returns 0 on success, or -1 if the key was not found. - */ -int hashtable_del(hashtable_t *hashtable, const char *key); - -/** - * hashtable_clear - Clear hashtable - * - * @hashtable: The hashtable object - * - * Removes all items from the hashtable. - */ -void hashtable_clear(hashtable_t *hashtable); - -/** - * hashtable_iter - Iterate over hashtable - * - * @hashtable: The hashtable object - * - * Returns an opaque iterator to the first element in the hashtable. - * The iterator should be passed to hashtable_iter_* functions. - * The hashtable items are not iterated over in any particular order. - * - * There's no need to free the iterator in any way. The iterator is - * valid as long as the item that is referenced by the iterator is not - * deleted. Other values may be added or deleted. In particular, - * hashtable_iter_next() may be called on an iterator, and after that - * the key/value pair pointed by the old iterator may be deleted. - */ -void *hashtable_iter(hashtable_t *hashtable); - -/** - * hashtable_iter_at - Return an iterator at a specific key - * - * @hashtable: The hashtable object - * @key: The key that the iterator should point to - * - * Like hashtable_iter() but returns an iterator pointing to a - * specific key. - */ -void *hashtable_iter_at(hashtable_t *hashtable, const char *key); - -/** - * hashtable_iter_next - Advance an iterator - * - * @hashtable: The hashtable object - * @iter: The iterator - * - * Returns a new iterator pointing to the next element in the - * hashtable or NULL if the whole hastable has been iterated over. - */ -void *hashtable_iter_next(hashtable_t *hashtable, void *iter); - -/** - * hashtable_iter_key - Retrieve the key pointed by an iterator - * - * @iter: The iterator - */ -void *hashtable_iter_key(void *iter); - -/** - * hashtable_iter_serial - Retrieve the serial number pointed to by an iterator - * - * @iter: The iterator - */ -size_t hashtable_iter_serial(void *iter); - -/** - * hashtable_iter_value - Retrieve the value pointed by an iterator - * - * @iter: The iterator - */ -void *hashtable_iter_value(void *iter); - -/** - * hashtable_iter_set - Set the value pointed by an iterator - * - * @iter: The iterator - * @value: The value to set - */ -void hashtable_iter_set(void *iter, json_t *value); - -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/hashtable_seed.c b/tests/JSONTestSuite/parsers/test_jansson/hashtable_seed.c deleted file mode 100644 index 751e0e326..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/hashtable_seed.c +++ /dev/null @@ -1,277 +0,0 @@ -/* Generate sizeof(uint32_t) bytes of as random data as possible to seed - the hash function. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_FCNTL_H -#include -#endif - -#ifdef HAVE_SCHED_H -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#ifdef HAVE_SYS_TIME_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#if defined(_WIN32) -/* For GetModuleHandle(), GetProcAddress() and GetCurrentProcessId() */ -#include -#endif - -#include "jansson.h" - - -static uint32_t buf_to_uint32(char *data) { - size_t i; - uint32_t result = 0; - - for (i = 0; i < sizeof(uint32_t); i++) - result = (result << 8) | (unsigned char)data[i]; - - return result; -} - - - -/* /dev/urandom */ -#if !defined(_WIN32) && defined(USE_URANDOM) -static int seed_from_urandom(uint32_t *seed) { - /* Use unbuffered I/O if we have open(), close() and read(). Otherwise - fall back to fopen() */ - - char data[sizeof(uint32_t)]; - int ok; - -#if defined(HAVE_OPEN) && defined(HAVE_CLOSE) && defined(HAVE_READ) - int urandom; - urandom = open("/dev/urandom", O_RDONLY); - if (urandom == -1) - return 1; - - ok = read(urandom, data, sizeof(uint32_t)) == sizeof(uint32_t); - close(urandom); -#else - FILE *urandom; - - urandom = fopen("/dev/urandom", "rb"); - if (!urandom) - return 1; - - ok = fread(data, 1, sizeof(uint32_t), urandom) == sizeof(uint32_t); - fclose(urandom); -#endif - - if (!ok) - return 1; - - *seed = buf_to_uint32(data); - return 0; -} -#endif - -/* Windows Crypto API */ -#if defined(_WIN32) && defined(USE_WINDOWS_CRYPTOAPI) -#include - -typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTA)(HCRYPTPROV *phProv, LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags); -typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer); -typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV hProv, DWORD dwFlags); - -static int seed_from_windows_cryptoapi(uint32_t *seed) -{ - HINSTANCE hAdvAPI32 = NULL; - CRYPTACQUIRECONTEXTA pCryptAcquireContext = NULL; - CRYPTGENRANDOM pCryptGenRandom = NULL; - CRYPTRELEASECONTEXT pCryptReleaseContext = NULL; - HCRYPTPROV hCryptProv = 0; - BYTE data[sizeof(uint32_t)]; - int ok; - - hAdvAPI32 = GetModuleHandle(TEXT("advapi32.dll")); - if(hAdvAPI32 == NULL) - return 1; - - pCryptAcquireContext = (CRYPTACQUIRECONTEXTA)GetProcAddress(hAdvAPI32, "CryptAcquireContextA"); - if (!pCryptAcquireContext) - return 1; - - pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress(hAdvAPI32, "CryptGenRandom"); - if (!pCryptGenRandom) - return 1; - - pCryptReleaseContext = (CRYPTRELEASECONTEXT)GetProcAddress(hAdvAPI32, "CryptReleaseContext"); - if (!pCryptReleaseContext) - return 1; - - if (!pCryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) - return 1; - - ok = pCryptGenRandom(hCryptProv, sizeof(uint32_t), data); - pCryptReleaseContext(hCryptProv, 0); - - if (!ok) - return 1; - - *seed = buf_to_uint32((char *)data); - return 0; -} -#endif - -/* gettimeofday() and getpid() */ -static int seed_from_timestamp_and_pid(uint32_t *seed) { -#ifdef HAVE_GETTIMEOFDAY - /* XOR of seconds and microseconds */ - struct timeval tv; - gettimeofday(&tv, NULL); - *seed = (uint32_t)tv.tv_sec ^ (uint32_t)tv.tv_usec; -#else - /* Seconds only */ - *seed = (uint32_t)time(NULL); -#endif - - /* XOR with PID for more randomness */ -#if defined(_WIN32) - *seed ^= (uint32_t)GetCurrentProcessId(); -#elif defined(HAVE_GETPID) - *seed ^= (uint32_t)getpid(); -#endif - - return 0; -} - -static uint32_t generate_seed() { - uint32_t seed; - int done = 0; - -#if !defined(_WIN32) && defined(USE_URANDOM) - if (!done && seed_from_urandom(&seed) == 0) - done = 1; -#endif - -#if defined(_WIN32) && defined(USE_WINDOWS_CRYPTOAPI) - if (!done && seed_from_windows_cryptoapi(&seed) == 0) - done = 1; -#endif - - if (!done) { - /* Fall back to timestamp and PID if no better randomness is - available */ - seed_from_timestamp_and_pid(&seed); - } - - /* Make sure the seed is never zero */ - if (seed == 0) - seed = 1; - - return seed; -} - - -volatile uint32_t hashtable_seed = 0; - -#if defined(HAVE_ATOMIC_BUILTINS) && (defined(HAVE_SCHED_YIELD) || !defined(_WIN32)) -static volatile char seed_initialized = 0; - -void json_object_seed(size_t seed) { - uint32_t new_seed = (uint32_t)seed; - - if (hashtable_seed == 0) { - if (__atomic_test_and_set(&seed_initialized, __ATOMIC_RELAXED) == 0) { - /* Do the seeding ourselves */ - if (new_seed == 0) - new_seed = generate_seed(); - - __atomic_store_n(&hashtable_seed, new_seed, __ATOMIC_RELEASE); - } else { - /* Wait for another thread to do the seeding */ - do { -#ifdef HAVE_SCHED_YIELD - sched_yield(); -#endif - } while(__atomic_load_n(&hashtable_seed, __ATOMIC_ACQUIRE) == 0); - } - } -} -#elif defined(HAVE_SYNC_BUILTINS) && (defined(HAVE_SCHED_YIELD) || !defined(_WIN32)) -void json_object_seed(size_t seed) { - uint32_t new_seed = (uint32_t)seed; - - if (hashtable_seed == 0) { - if (new_seed == 0) { - /* Explicit synchronization fences are not supported by the - __sync builtins, so every thread getting here has to - generate the seed value. - */ - new_seed = generate_seed(); - } - - do { - if (__sync_bool_compare_and_swap(&hashtable_seed, 0, new_seed)) { - /* We were the first to seed */ - break; - } else { - /* Wait for another thread to do the seeding */ -#ifdef HAVE_SCHED_YIELD - sched_yield(); -#endif - } - } while(hashtable_seed == 0); - } -} -#elif defined(_WIN32) -static long seed_initialized = 0; -void json_object_seed(size_t seed) { - uint32_t new_seed = (uint32_t)seed; - - if (hashtable_seed == 0) { - if (InterlockedIncrement(&seed_initialized) == 1) { - /* Do the seeding ourselves */ - if (new_seed == 0) - new_seed = generate_seed(); - - hashtable_seed = new_seed; - } else { - /* Wait for another thread to do the seeding */ - do { - SwitchToThread(); - } while (hashtable_seed == 0); - } - } -} -#else -/* Fall back to a thread-unsafe version */ -void json_object_seed(size_t seed) { - uint32_t new_seed = (uint32_t)seed; - - if (hashtable_seed == 0) { - if (new_seed == 0) - new_seed = generate_seed(); - - hashtable_seed = new_seed; - } -} -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/jansson.h b/tests/JSONTestSuite/parsers/test_jansson/jansson.h deleted file mode 100644 index ee607946e..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/jansson.h +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef JANSSON_H -#define JANSSON_H - -#include -#include /* for size_t */ -#include - -#include "jansson_config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* version */ - -#define JANSSON_MAJOR_VERSION 2 -#define JANSSON_MINOR_VERSION 7 -#define JANSSON_MICRO_VERSION 0 - -/* Micro version is omitted if it's 0 */ -#define JANSSON_VERSION "2.7" - -/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this - for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ -#define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ - (JANSSON_MINOR_VERSION << 8) | \ - (JANSSON_MICRO_VERSION << 0)) - - -/* types */ - -typedef enum { - JSON_OBJECT, - JSON_ARRAY, - JSON_STRING, - JSON_INTEGER, - JSON_REAL, - JSON_TRUE, - JSON_FALSE, - JSON_NULL -} json_type; - -typedef struct json_t { - json_type type; - size_t refcount; -} json_t; - -#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ -#if JSON_INTEGER_IS_LONG_LONG -#ifdef _WIN32 -#define JSON_INTEGER_FORMAT "I64d" -#else -#define JSON_INTEGER_FORMAT "lld" -#endif -typedef long long json_int_t; -#else -#define JSON_INTEGER_FORMAT "ld" -typedef long json_int_t; -#endif /* JSON_INTEGER_IS_LONG_LONG */ -#endif - -#define json_typeof(json) ((json)->type) -#define json_is_object(json) ((json) && json_typeof(json) == JSON_OBJECT) -#define json_is_array(json) ((json) && json_typeof(json) == JSON_ARRAY) -#define json_is_string(json) ((json) && json_typeof(json) == JSON_STRING) -#define json_is_integer(json) ((json) && json_typeof(json) == JSON_INTEGER) -#define json_is_real(json) ((json) && json_typeof(json) == JSON_REAL) -#define json_is_number(json) (json_is_integer(json) || json_is_real(json)) -#define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE) -#define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE) -#define json_boolean_value json_is_true -#define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) -#define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL) - -/* construction, destruction, reference counting */ - -json_t *json_object(void); -json_t *json_array(void); -json_t *json_string(const char *value); -json_t *json_stringn(const char *value, size_t len); -json_t *json_string_nocheck(const char *value); -json_t *json_stringn_nocheck(const char *value, size_t len); -json_t *json_integer(json_int_t value); -json_t *json_real(double value); -json_t *json_true(void); -json_t *json_false(void); -#define json_boolean(val) ((val) ? json_true() : json_false()) -json_t *json_null(void); - -static JSON_INLINE -json_t *json_incref(json_t *json) -{ - if(json && json->refcount != (size_t)-1) - ++json->refcount; - return json; -} - -/* do not call json_delete directly */ -void json_delete(json_t *json); - -static JSON_INLINE -void json_decref(json_t *json) -{ - if(json && json->refcount != (size_t)-1 && --json->refcount == 0) - json_delete(json); -} - - -/* error reporting */ - -#define JSON_ERROR_TEXT_LENGTH 160 -#define JSON_ERROR_SOURCE_LENGTH 80 - -typedef struct { - int line; - int column; - int position; - char source[JSON_ERROR_SOURCE_LENGTH]; - char text[JSON_ERROR_TEXT_LENGTH]; -} json_error_t; - - -/* getters, setters, manipulation */ - -void json_object_seed(size_t seed); -size_t json_object_size(const json_t *object); -json_t *json_object_get(const json_t *object, const char *key); -int json_object_set_new(json_t *object, const char *key, json_t *value); -int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value); -int json_object_del(json_t *object, const char *key); -int json_object_clear(json_t *object); -int json_object_update(json_t *object, json_t *other); -int json_object_update_existing(json_t *object, json_t *other); -int json_object_update_missing(json_t *object, json_t *other); -void *json_object_iter(json_t *object); -void *json_object_iter_at(json_t *object, const char *key); -void *json_object_key_to_iter(const char *key); -void *json_object_iter_next(json_t *object, void *iter); -const char *json_object_iter_key(void *iter); -json_t *json_object_iter_value(void *iter); -int json_object_iter_set_new(json_t *object, void *iter, json_t *value); - -#define json_object_foreach(object, key, value) \ - for(key = json_object_iter_key(json_object_iter(object)); \ - key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ - key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key)))) - -#define json_object_foreach_safe(object, n, key, value) \ - for(key = json_object_iter_key(json_object_iter(object)), \ - n = json_object_iter_next(object, json_object_key_to_iter(key)); \ - key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ - key = json_object_iter_key(n), \ - n = json_object_iter_next(object, json_object_key_to_iter(key))) - -#define json_array_foreach(array, index, value) \ - for(index = 0; \ - index < json_array_size(array) && (value = json_array_get(array, index)); \ - index++) - -static JSON_INLINE -int json_object_set(json_t *object, const char *key, json_t *value) -{ - return json_object_set_new(object, key, json_incref(value)); -} - -static JSON_INLINE -int json_object_set_nocheck(json_t *object, const char *key, json_t *value) -{ - return json_object_set_new_nocheck(object, key, json_incref(value)); -} - -static JSON_INLINE -int json_object_iter_set(json_t *object, void *iter, json_t *value) -{ - return json_object_iter_set_new(object, iter, json_incref(value)); -} - -size_t json_array_size(const json_t *array); -json_t *json_array_get(const json_t *array, size_t index); -int json_array_set_new(json_t *array, size_t index, json_t *value); -int json_array_append_new(json_t *array, json_t *value); -int json_array_insert_new(json_t *array, size_t index, json_t *value); -int json_array_remove(json_t *array, size_t index); -int json_array_clear(json_t *array); -int json_array_extend(json_t *array, json_t *other); - -static JSON_INLINE -int json_array_set(json_t *array, size_t ind, json_t *value) -{ - return json_array_set_new(array, ind, json_incref(value)); -} - -static JSON_INLINE -int json_array_append(json_t *array, json_t *value) -{ - return json_array_append_new(array, json_incref(value)); -} - -static JSON_INLINE -int json_array_insert(json_t *array, size_t ind, json_t *value) -{ - return json_array_insert_new(array, ind, json_incref(value)); -} - -const char *json_string_value(const json_t *string); -size_t json_string_length(const json_t *string); -json_int_t json_integer_value(const json_t *integer); -double json_real_value(const json_t *real); -double json_number_value(const json_t *json); - -int json_string_set(json_t *string, const char *value); -int json_string_setn(json_t *string, const char *value, size_t len); -int json_string_set_nocheck(json_t *string, const char *value); -int json_string_setn_nocheck(json_t *string, const char *value, size_t len); -int json_integer_set(json_t *integer, json_int_t value); -int json_real_set(json_t *real, double value); - -/* pack, unpack */ - -json_t *json_pack(const char *fmt, ...); -json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...); -json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap); - -#define JSON_VALIDATE_ONLY 0x1 -#define JSON_STRICT 0x2 - -int json_unpack(json_t *root, const char *fmt, ...); -int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...); -int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap); - - -/* equality */ - -int json_equal(json_t *value1, json_t *value2); - - -/* copying */ - -json_t *json_copy(json_t *value); -json_t *json_deep_copy(const json_t *value); - - -/* decoding */ - -#define JSON_REJECT_DUPLICATES 0x1 -#define JSON_DISABLE_EOF_CHECK 0x2 -#define JSON_DECODE_ANY 0x4 -#define JSON_DECODE_INT_AS_REAL 0x8 -#define JSON_ALLOW_NUL 0x10 - -typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data); - -json_t *json_loads(const char *input, size_t flags, json_error_t *error); -json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error); -json_t *json_loadf(FILE *input, size_t flags, json_error_t *error); -json_t *json_load_file(const char *path, size_t flags, json_error_t *error); -json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error); - - -/* encoding */ - -#define JSON_MAX_INDENT 0x1F -#define JSON_INDENT(n) ((n) & JSON_MAX_INDENT) -#define JSON_COMPACT 0x20 -#define JSON_ENSURE_ASCII 0x40 -#define JSON_SORT_KEYS 0x80 -#define JSON_PRESERVE_ORDER 0x100 -#define JSON_ENCODE_ANY 0x200 -#define JSON_ESCAPE_SLASH 0x400 -#define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11) - -typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data); - -char *json_dumps(const json_t *json, size_t flags); -int json_dumpf(const json_t *json, FILE *output, size_t flags); -int json_dump_file(const json_t *json, const char *path, size_t flags); -int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags); - -/* custom memory allocation */ - -typedef void *(*json_malloc_t)(size_t); -typedef void (*json_free_t)(void *); - -void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); -void json_get_alloc_funcs(json_malloc_t *malloc_fn, json_free_t *free_fn); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/jansson_config.h b/tests/JSONTestSuite/parsers/test_jansson/jansson_config.h deleted file mode 100644 index 0d600e880..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/jansson_config.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - * - * - * This file specifies a part of the site-specific configuration for - * Jansson, namely those things that affect the public API in - * jansson.h. - * - * The configure script copies this file to jansson_config.h and - * replaces @var@ substitutions by values that fit your system. If you - * cannot run the configure script, you can do the value substitution - * by hand. - */ - -#ifndef JANSSON_CONFIG_H -#define JANSSON_CONFIG_H - -/* If your compiler supports the inline keyword in C, JSON_INLINE is - defined to `inline', otherwise empty. In C++, the inline is always - supported. */ -#ifdef __cplusplus -#define JSON_INLINE inline -#else -#define JSON_INLINE -#endif - -/* If your compiler supports the `long long` type and the strtoll() - library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, - otherwise to 0. */ -#define JSON_INTEGER_IS_LONG_LONG 1 - -/* If locale.h and localeconv() are available, define to 1, - otherwise to 0. */ -#define JSON_HAVE_LOCALECONV 0 - -/* Maximum recursion depth for parsing JSON input. - This limits the depth of e.g. array-within-array constructions. */ -#define JSON_PARSER_MAX_DEPTH 2048 - -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/jansson_private.h b/tests/JSONTestSuite/parsers/test_jansson/jansson_private.h deleted file mode 100644 index ccb3a5744..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/jansson_private.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef JANSSON_PRIVATE_H -#define JANSSON_PRIVATE_H - -#include -#include "jansson.h" -#include "hashtable.h" -#include "strbuffer.h" - -#define container_of(ptr_, type_, member_) \ - ((type_ *)((char *)ptr_ - offsetof(type_, member_))) - -/* On some platforms, max() may already be defined */ -#ifndef max -#define max(a, b) ((a) > (b) ? (a) : (b)) -#endif - -/* va_copy is a C99 feature. In C89 implementations, it's sometimes - available as __va_copy. If not, memcpy() should do the trick. */ -#ifndef va_copy -#ifdef __va_copy -#define va_copy __va_copy -#else -#define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list)) -#endif -#endif - -typedef struct { - json_t json; - hashtable_t hashtable; - size_t serial; - int visited; -} json_object_t; - -typedef struct { - json_t json; - size_t size; - size_t entries; - json_t **table; - int visited; -} json_array_t; - -typedef struct { - json_t json; - char *value; - size_t length; -} json_string_t; - -typedef struct { - json_t json; - double value; -} json_real_t; - -typedef struct { - json_t json; - json_int_t value; -} json_integer_t; - -#define json_to_object(json_) container_of(json_, json_object_t, json) -#define json_to_array(json_) container_of(json_, json_array_t, json) -#define json_to_string(json_) container_of(json_, json_string_t, json) -#define json_to_real(json_) container_of(json_, json_real_t, json) -#define json_to_integer(json_) container_of(json_, json_integer_t, json) - -/* Create a string by taking ownership of an existing buffer */ -json_t *jsonp_stringn_nocheck_own(const char *value, size_t len); - -/* Error message formatting */ -void jsonp_error_init(json_error_t *error, const char *source); -void jsonp_error_set_source(json_error_t *error, const char *source); -void jsonp_error_set(json_error_t *error, int line, int column, - size_t position, const char *msg, ...); -void jsonp_error_vset(json_error_t *error, int line, int column, - size_t position, const char *msg, va_list ap); - -/* Locale independent string<->double conversions */ -int jsonp_strtod(strbuffer_t *strbuffer, double *out); -int jsonp_dtostr(char *buffer, size_t size, double value, int prec); - -/* Wrappers for custom memory functions */ -void* jsonp_malloc(size_t size); -void jsonp_free(void *ptr); -char *jsonp_strndup(const char *str, size_t length); -char *jsonp_strdup(const char *str); -char *jsonp_strndup(const char *str, size_t len); - - -/* Windows compatibility */ -#if defined(_WIN32) || defined(WIN32) -# if defined(_MSC_VER) /* MS compiller */ -# if (_MSC_VER < 1900) && !defined(snprintf) /* snprintf not defined yet & not introduced */ -# define snprintf _snprintf -# endif -# if (_MSC_VER < 1500) && !defined(vsnprintf) /* vsnprintf not defined yet & not introduced */ -# define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) -# endif -# else /* Other Windows compiller, old definition */ -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif -#endif - -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/load.c b/tests/JSONTestSuite/parsers/test_jansson/load.c deleted file mode 100644 index 33a260a8c..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/load.c +++ /dev/null @@ -1,1110 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include - -#include "jansson.h" -#include "jansson_private.h" -#include "strbuffer.h" -#include "utf.h" - -#define STREAM_STATE_OK 0 -#define STREAM_STATE_EOF -1 -#define STREAM_STATE_ERROR -2 - -#define TOKEN_INVALID -1 -#define TOKEN_EOF 0 -#define TOKEN_STRING 256 -#define TOKEN_INTEGER 257 -#define TOKEN_REAL 258 -#define TOKEN_TRUE 259 -#define TOKEN_FALSE 260 -#define TOKEN_NULL 261 - -/* Locale independent versions of isxxx() functions */ -#define l_isupper(c) ('A' <= (c) && (c) <= 'Z') -#define l_islower(c) ('a' <= (c) && (c) <= 'z') -#define l_isalpha(c) (l_isupper(c) || l_islower(c)) -#define l_isdigit(c) ('0' <= (c) && (c) <= '9') -#define l_isxdigit(c) \ - (l_isdigit(c) || ('A' <= (c) && (c) <= 'F') || ('a' <= (c) && (c) <= 'f')) - -/* Read one byte from stream, convert to unsigned char, then int, and - return. return EOF on end of file. This corresponds to the - behaviour of fgetc(). */ -typedef int (*get_func)(void *data); - -typedef struct { - get_func get; - void *data; - char buffer[5]; - size_t buffer_pos; - int state; - int line; - int column, last_column; - size_t position; -} stream_t; - -typedef struct { - stream_t stream; - strbuffer_t saved_text; - size_t flags; - size_t depth; - int token; - union { - struct { - char *val; - size_t len; - } string; - json_int_t integer; - double real; - } value; -} lex_t; - -#define stream_to_lex(stream) container_of(stream, lex_t, stream) - - -/*** error reporting ***/ - -static void error_set(json_error_t *error, const lex_t *lex, - const char *msg, ...) -{ - va_list ap; - char msg_text[JSON_ERROR_TEXT_LENGTH]; - char msg_with_context[JSON_ERROR_TEXT_LENGTH]; - - int line = -1, col = -1; - size_t pos = 0; - const char *result = msg_text; - - if(!error) - return; - - va_start(ap, msg); - vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap); - msg_text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; - va_end(ap); - - if(lex) - { - const char *saved_text = strbuffer_value(&lex->saved_text); - - line = lex->stream.line; - col = lex->stream.column; - pos = lex->stream.position; - - if(saved_text && saved_text[0]) - { - if(lex->saved_text.length <= 20) { - snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, - "%s near '%s'", msg_text, saved_text); - msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; - result = msg_with_context; - } - } - else - { - if(lex->stream.state == STREAM_STATE_ERROR) { - /* No context for UTF-8 decoding errors */ - result = msg_text; - } - else { - snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, - "%s near end of file", msg_text); - msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; - result = msg_with_context; - } - } - } - - jsonp_error_set(error, line, col, pos, "%s", result); -} - - -/*** lexical analyzer ***/ - -static void -stream_init(stream_t *stream, get_func get, void *data) -{ - stream->get = get; - stream->data = data; - stream->buffer[0] = '\0'; - stream->buffer_pos = 0; - - stream->state = STREAM_STATE_OK; - stream->line = 1; - stream->column = 0; - stream->position = 0; -} - -static int stream_get(stream_t *stream, json_error_t *error) -{ - int c; - - if(stream->state != STREAM_STATE_OK) - return stream->state; - - if(!stream->buffer[stream->buffer_pos]) - { - c = stream->get(stream->data); - if(c == EOF) { - stream->state = STREAM_STATE_EOF; - return STREAM_STATE_EOF; - } - - stream->buffer[0] = c; - stream->buffer_pos = 0; - - if(0x80 <= c && c <= 0xFF) - { - /* multi-byte UTF-8 sequence */ - size_t i, count; - - count = utf8_check_first(c); - if(!count) - goto out; - - assert(count >= 2); - - for(i = 1; i < count; i++) - stream->buffer[i] = stream->get(stream->data); - - if(!utf8_check_full(stream->buffer, count, NULL)) - goto out; - - stream->buffer[count] = '\0'; - } - else - stream->buffer[1] = '\0'; - } - - c = stream->buffer[stream->buffer_pos++]; - - stream->position++; - if(c == '\n') { - stream->line++; - stream->last_column = stream->column; - stream->column = 0; - } - else if(utf8_check_first(c)) { - /* track the Unicode character column, so increment only if - this is the first character of a UTF-8 sequence */ - stream->column++; - } - - return c; - -out: - stream->state = STREAM_STATE_ERROR; - error_set(error, stream_to_lex(stream), "unable to decode byte 0x%x", c); - return STREAM_STATE_ERROR; -} - -static void stream_unget(stream_t *stream, int c) -{ - if(c == STREAM_STATE_EOF || c == STREAM_STATE_ERROR) - return; - - stream->position--; - if(c == '\n') { - stream->line--; - stream->column = stream->last_column; - } - else if(utf8_check_first(c)) - stream->column--; - - assert(stream->buffer_pos > 0); - stream->buffer_pos--; - assert(stream->buffer[stream->buffer_pos] == c); -} - - -static int lex_get(lex_t *lex, json_error_t *error) -{ - return stream_get(&lex->stream, error); -} - -static void lex_save(lex_t *lex, int c) -{ - strbuffer_append_byte(&lex->saved_text, c); -} - -static int lex_get_save(lex_t *lex, json_error_t *error) -{ - int c = stream_get(&lex->stream, error); - if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) - lex_save(lex, c); - return c; -} - -static void lex_unget(lex_t *lex, int c) -{ - stream_unget(&lex->stream, c); -} - -static void lex_unget_unsave(lex_t *lex, int c) -{ - if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) { - /* Since we treat warnings as errors, when assertions are turned - * off the "d" variable would be set but never used. Which is - * treated as an error by GCC. - */ - #ifndef NDEBUG - char d; - #endif - stream_unget(&lex->stream, c); - #ifndef NDEBUG - d = - #endif - strbuffer_pop(&lex->saved_text); - assert(c == d); - } -} - -static void lex_save_cached(lex_t *lex) -{ - while(lex->stream.buffer[lex->stream.buffer_pos] != '\0') - { - lex_save(lex, lex->stream.buffer[lex->stream.buffer_pos]); - lex->stream.buffer_pos++; - lex->stream.position++; - } -} - -static void lex_free_string(lex_t *lex) -{ - jsonp_free(lex->value.string.val); - lex->value.string.val = NULL; - lex->value.string.len = 0; -} - -/* assumes that str points to 'u' plus at least 4 valid hex digits */ -static int32_t decode_unicode_escape(const char *str) -{ - int i; - int32_t value = 0; - - assert(str[0] == 'u'); - - for(i = 1; i <= 4; i++) { - char c = str[i]; - value <<= 4; - if(l_isdigit(c)) - value += c - '0'; - else if(l_islower(c)) - value += c - 'a' + 10; - else if(l_isupper(c)) - value += c - 'A' + 10; - else - return -1; - } - - return value; -} - -static void lex_scan_string(lex_t *lex, json_error_t *error) -{ - int c; - const char *p; - char *t; - int i; - - lex->value.string.val = NULL; - lex->token = TOKEN_INVALID; - - c = lex_get_save(lex, error); - - while(c != '"') { - if(c == STREAM_STATE_ERROR) - goto out; - - else if(c == STREAM_STATE_EOF) { - error_set(error, lex, "premature end of input"); - goto out; - } - - else if(0 <= c && c <= 0x1F) { - /* control character */ - lex_unget_unsave(lex, c); - if(c == '\n') - error_set(error, lex, "unexpected newline", c); - else - error_set(error, lex, "control character 0x%x", c); - goto out; - } - - else if(c == '\\') { - c = lex_get_save(lex, error); - if(c == 'u') { - c = lex_get_save(lex, error); - for(i = 0; i < 4; i++) { - if(!l_isxdigit(c)) { - error_set(error, lex, "invalid escape"); - goto out; - } - c = lex_get_save(lex, error); - } - } - else if(c == '"' || c == '\\' || c == '/' || c == 'b' || - c == 'f' || c == 'n' || c == 'r' || c == 't') - c = lex_get_save(lex, error); - else { - error_set(error, lex, "invalid escape"); - goto out; - } - } - else - c = lex_get_save(lex, error); - } - - /* the actual value is at most of the same length as the source - string, because: - - shortcut escapes (e.g. "\t") (length 2) are converted to 1 byte - - a single \uXXXX escape (length 6) is converted to at most 3 bytes - - two \uXXXX escapes (length 12) forming an UTF-16 surrogate pair - are converted to 4 bytes - */ - t = jsonp_malloc(lex->saved_text.length + 1); - if(!t) { - /* this is not very nice, since TOKEN_INVALID is returned */ - goto out; - } - lex->value.string.val = t; - - /* + 1 to skip the " */ - p = strbuffer_value(&lex->saved_text) + 1; - - while(*p != '"') { - if(*p == '\\') { - p++; - if(*p == 'u') { - size_t length; - int32_t value; - - value = decode_unicode_escape(p); - if(value < 0) { - error_set(error, lex, "invalid Unicode escape '%.6s'", p - 1); - goto out; - } - p += 5; - - if(0xD800 <= value && value <= 0xDBFF) { - /* surrogate pair */ - if(*p == '\\' && *(p + 1) == 'u') { - int32_t value2 = decode_unicode_escape(++p); - if(value2 < 0) { - error_set(error, lex, "invalid Unicode escape '%.6s'", p - 1); - goto out; - } - p += 5; - - if(0xDC00 <= value2 && value2 <= 0xDFFF) { - /* valid second surrogate */ - value = - ((value - 0xD800) << 10) + - (value2 - 0xDC00) + - 0x10000; - } - else { - /* invalid second surrogate */ - error_set(error, lex, - "invalid Unicode '\\u%04X\\u%04X'", - value, value2); - goto out; - } - } - else { - /* no second surrogate */ - error_set(error, lex, "invalid Unicode '\\u%04X'", - value); - goto out; - } - } - else if(0xDC00 <= value && value <= 0xDFFF) { - error_set(error, lex, "invalid Unicode '\\u%04X'", value); - goto out; - } - - if(utf8_encode(value, t, &length)) - assert(0); - t += length; - } - else { - switch(*p) { - case '"': case '\\': case '/': - *t = *p; break; - case 'b': *t = '\b'; break; - case 'f': *t = '\f'; break; - case 'n': *t = '\n'; break; - case 'r': *t = '\r'; break; - case 't': *t = '\t'; break; - default: assert(0); - } - t++; - p++; - } - } - else - *(t++) = *(p++); - } - *t = '\0'; - lex->value.string.len = t - lex->value.string.val; - lex->token = TOKEN_STRING; - return; - -out: - lex_free_string(lex); -} - -#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ -#if JSON_INTEGER_IS_LONG_LONG -#ifdef _MSC_VER /* Microsoft Visual Studio */ -#define json_strtoint _strtoi64 -#else -#define json_strtoint strtoll -#endif -#else -#define json_strtoint strtol -#endif -#endif - -static int lex_scan_number(lex_t *lex, int c, json_error_t *error) -{ - const char *saved_text; - char *end; - double doubleval; - - lex->token = TOKEN_INVALID; - - if(c == '-') - c = lex_get_save(lex, error); - - if(c == '0') { - c = lex_get_save(lex, error); - if(l_isdigit(c)) { - lex_unget_unsave(lex, c); - goto out; - } - } - else if(l_isdigit(c)) { - do - c = lex_get_save(lex, error); - while(l_isdigit(c)); - } - else { - lex_unget_unsave(lex, c); - goto out; - } - - if(!(lex->flags & JSON_DECODE_INT_AS_REAL) && - c != '.' && c != 'E' && c != 'e') - { - json_int_t intval; - - lex_unget_unsave(lex, c); - - saved_text = strbuffer_value(&lex->saved_text); - - errno = 0; - intval = json_strtoint(saved_text, &end, 10); - if(errno == ERANGE) { - if(intval < 0) - error_set(error, lex, "too big negative integer"); - else - error_set(error, lex, "too big integer"); - goto out; - } - - assert(end == saved_text + lex->saved_text.length); - - lex->token = TOKEN_INTEGER; - lex->value.integer = intval; - return 0; - } - - if(c == '.') { - c = lex_get(lex, error); - if(!l_isdigit(c)) { - lex_unget(lex, c); - goto out; - } - lex_save(lex, c); - - do - c = lex_get_save(lex, error); - while(l_isdigit(c)); - } - - if(c == 'E' || c == 'e') { - c = lex_get_save(lex, error); - if(c == '+' || c == '-') - c = lex_get_save(lex, error); - - if(!l_isdigit(c)) { - lex_unget_unsave(lex, c); - goto out; - } - - do - c = lex_get_save(lex, error); - while(l_isdigit(c)); - } - - lex_unget_unsave(lex, c); - - if(jsonp_strtod(&lex->saved_text, &doubleval)) { - error_set(error, lex, "real number overflow"); - goto out; - } - - lex->token = TOKEN_REAL; - lex->value.real = doubleval; - return 0; - -out: - return -1; -} - -static int lex_scan(lex_t *lex, json_error_t *error) -{ - int c; - - strbuffer_clear(&lex->saved_text); - - if(lex->token == TOKEN_STRING) - lex_free_string(lex); - - do - c = lex_get(lex, error); - while(c == ' ' || c == '\t' || c == '\n' || c == '\r'); - - if(c == STREAM_STATE_EOF) { - lex->token = TOKEN_EOF; - goto out; - } - - if(c == STREAM_STATE_ERROR) { - lex->token = TOKEN_INVALID; - goto out; - } - - lex_save(lex, c); - - if(c == '{' || c == '}' || c == '[' || c == ']' || c == ':' || c == ',') - lex->token = c; - - else if(c == '"') - lex_scan_string(lex, error); - - else if(l_isdigit(c) || c == '-') { - if(lex_scan_number(lex, c, error)) - goto out; - } - - else if(l_isalpha(c)) { - /* eat up the whole identifier for clearer error messages */ - const char *saved_text; - - do - c = lex_get_save(lex, error); - while(l_isalpha(c)); - lex_unget_unsave(lex, c); - - saved_text = strbuffer_value(&lex->saved_text); - - if(strcmp(saved_text, "true") == 0) - lex->token = TOKEN_TRUE; - else if(strcmp(saved_text, "false") == 0) - lex->token = TOKEN_FALSE; - else if(strcmp(saved_text, "null") == 0) - lex->token = TOKEN_NULL; - else - lex->token = TOKEN_INVALID; - } - - else { - /* save the rest of the input UTF-8 sequence to get an error - message of valid UTF-8 */ - lex_save_cached(lex); - lex->token = TOKEN_INVALID; - } - -out: - return lex->token; -} - -static char *lex_steal_string(lex_t *lex, size_t *out_len) -{ - char *result = NULL; - if(lex->token == TOKEN_STRING) { - result = lex->value.string.val; - *out_len = lex->value.string.len; - lex->value.string.val = NULL; - lex->value.string.len = 0; - } - return result; -} - -static int lex_init(lex_t *lex, get_func get, size_t flags, void *data) -{ - stream_init(&lex->stream, get, data); - if(strbuffer_init(&lex->saved_text)) - return -1; - - lex->flags = flags; - lex->token = TOKEN_INVALID; - return 0; -} - -static void lex_close(lex_t *lex) -{ - if(lex->token == TOKEN_STRING) - lex_free_string(lex); - strbuffer_close(&lex->saved_text); -} - - -/*** parser ***/ - -static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error); - -static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *object = json_object(); - if(!object) - return NULL; - - lex_scan(lex, error); - if(lex->token == '}') - return object; - - while(1) { - char *key; - size_t len; - json_t *value; - - if(lex->token != TOKEN_STRING) { - error_set(error, lex, "string or '}' expected"); - goto error; - } - - key = lex_steal_string(lex, &len); - if(!key) - return NULL; - if (memchr(key, '\0', len)) { - jsonp_free(key); - error_set(error, lex, "NUL byte in object key not supported"); - goto error; - } - - if(flags & JSON_REJECT_DUPLICATES) { - if(json_object_get(object, key)) { - jsonp_free(key); - error_set(error, lex, "duplicate object key"); - goto error; - } - } - - lex_scan(lex, error); - if(lex->token != ':') { - jsonp_free(key); - error_set(error, lex, "':' expected"); - goto error; - } - - lex_scan(lex, error); - value = parse_value(lex, flags, error); - if(!value) { - jsonp_free(key); - goto error; - } - - if(json_object_set_nocheck(object, key, value)) { - jsonp_free(key); - json_decref(value); - goto error; - } - - json_decref(value); - jsonp_free(key); - - lex_scan(lex, error); - if(lex->token != ',') - break; - - lex_scan(lex, error); - } - - if(lex->token != '}') { - error_set(error, lex, "'}' expected"); - goto error; - } - - return object; - -error: - json_decref(object); - return NULL; -} - -static json_t *parse_array(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *array = json_array(); - if(!array) - return NULL; - - lex_scan(lex, error); - if(lex->token == ']') - return array; - - while(lex->token) { - json_t *elem = parse_value(lex, flags, error); - if(!elem) - goto error; - - if(json_array_append(array, elem)) { - json_decref(elem); - goto error; - } - json_decref(elem); - - lex_scan(lex, error); - if(lex->token != ',') - break; - - lex_scan(lex, error); - } - - if(lex->token != ']') { - error_set(error, lex, "']' expected"); - goto error; - } - - return array; - -error: - json_decref(array); - return NULL; -} - -static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *json; - - lex->depth++; - if(lex->depth > JSON_PARSER_MAX_DEPTH) { - error_set(error, lex, "maximum parsing depth reached"); - return NULL; - } - - switch(lex->token) { - case TOKEN_STRING: { - const char *value = lex->value.string.val; - size_t len = lex->value.string.len; - - if(!(flags & JSON_ALLOW_NUL)) { - if(memchr(value, '\0', len)) { - error_set(error, lex, "\\u0000 is not allowed without JSON_ALLOW_NUL"); - return NULL; - } - } - - json = jsonp_stringn_nocheck_own(value, len); - if(json) { - lex->value.string.val = NULL; - lex->value.string.len = 0; - } - break; - } - - case TOKEN_INTEGER: { - json = json_integer(lex->value.integer); - break; - } - - case TOKEN_REAL: { - json = json_real(lex->value.real); - break; - } - - case TOKEN_TRUE: - json = json_true(); - break; - - case TOKEN_FALSE: - json = json_false(); - break; - - case TOKEN_NULL: - json = json_null(); - break; - - case '{': - json = parse_object(lex, flags, error); - break; - - case '[': - json = parse_array(lex, flags, error); - break; - - case TOKEN_INVALID: - error_set(error, lex, "invalid token"); - return NULL; - - default: - error_set(error, lex, "unexpected token"); - return NULL; - } - - if(!json) - return NULL; - - lex->depth--; - return json; -} - -static json_t *parse_json(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *result; - - lex->depth = 0; - - lex_scan(lex, error); - if(!(flags & JSON_DECODE_ANY)) { - if(lex->token != '[' && lex->token != '{') { - error_set(error, lex, "'[' or '{' expected"); - return NULL; - } - } - - result = parse_value(lex, flags, error); - if(!result) - return NULL; - - if(!(flags & JSON_DISABLE_EOF_CHECK)) { - lex_scan(lex, error); - if(lex->token != TOKEN_EOF) { - error_set(error, lex, "end of file expected"); - json_decref(result); - return NULL; - } - } - - if(error) { - /* Save the position even though there was no error */ - error->position = (int)lex->stream.position; - } - - return result; -} - -typedef struct -{ - const char *data; - int pos; -} string_data_t; - -static int string_get(void *data) -{ - char c; - string_data_t *stream = (string_data_t *)data; - c = stream->data[stream->pos]; - if(c == '\0') - return EOF; - else - { - stream->pos++; - return (unsigned char)c; - } -} - -json_t *json_loads(const char *string, size_t flags, json_error_t *error) -{ - lex_t lex; - json_t *result; - string_data_t stream_data; - - jsonp_error_init(error, ""); - - if (string == NULL) { - error_set(error, NULL, "wrong arguments"); - return NULL; - } - - stream_data.data = string; - stream_data.pos = 0; - - if(lex_init(&lex, string_get, flags, (void *)&stream_data)) - return NULL; - - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} - -typedef struct -{ - const char *data; - size_t len; - size_t pos; -} buffer_data_t; - -static int buffer_get(void *data) -{ - char c; - buffer_data_t *stream = data; - if(stream->pos >= stream->len) - return EOF; - - c = stream->data[stream->pos]; - stream->pos++; - return (unsigned char)c; -} - -json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error) -{ - lex_t lex; - json_t *result; - buffer_data_t stream_data; - - jsonp_error_init(error, ""); - - if (buffer == NULL) { - error_set(error, NULL, "wrong arguments"); - return NULL; - } - - stream_data.data = buffer; - stream_data.pos = 0; - stream_data.len = buflen; - - if(lex_init(&lex, buffer_get, flags, (void *)&stream_data)) - return NULL; - - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} - -json_t *json_loadf(FILE *input, size_t flags, json_error_t *error) -{ - lex_t lex; - const char *source; - json_t *result; - - if(input == stdin) - source = ""; - else - source = ""; - - jsonp_error_init(error, source); - - if (input == NULL) { - error_set(error, NULL, "wrong arguments"); - return NULL; - } - - if(lex_init(&lex, (get_func)fgetc, flags, input)) - return NULL; - - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} - -json_t *json_load_file(const char *path, size_t flags, json_error_t *error) -{ - json_t *result; - FILE *fp; - - jsonp_error_init(error, path); - - if (path == NULL) { - error_set(error, NULL, "wrong arguments"); - return NULL; - } - - fp = fopen(path, "rb"); - if(!fp) - { - error_set(error, NULL, "unable to open %s: %s", - path, strerror(errno)); - return NULL; - } - - result = json_loadf(fp, flags, error); - - fclose(fp); - return result; -} - -#define MAX_BUF_LEN 1024 - -typedef struct -{ - char data[MAX_BUF_LEN]; - size_t len; - size_t pos; - json_load_callback_t callback; - void *arg; -} callback_data_t; - -static int callback_get(void *data) -{ - char c; - callback_data_t *stream = data; - - if(stream->pos >= stream->len) { - stream->pos = 0; - stream->len = stream->callback(stream->data, MAX_BUF_LEN, stream->arg); - if(stream->len == 0 || stream->len == (size_t)-1) - return EOF; - } - - c = stream->data[stream->pos]; - stream->pos++; - return (unsigned char)c; -} - -json_t *json_load_callback(json_load_callback_t callback, void *arg, size_t flags, json_error_t *error) -{ - lex_t lex; - json_t *result; - - callback_data_t stream_data; - - memset(&stream_data, 0, sizeof(stream_data)); - stream_data.callback = callback; - stream_data.arg = arg; - - jsonp_error_init(error, ""); - - if (callback == NULL) { - error_set(error, NULL, "wrong arguments"); - return NULL; - } - - if(lex_init(&lex, (get_func)callback_get, flags, &stream_data)) - return NULL; - - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/lookup3.h b/tests/JSONTestSuite/parsers/test_jansson/lookup3.h deleted file mode 100644 index 522a41ae6..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/lookup3.h +++ /dev/null @@ -1,381 +0,0 @@ -/* -------------------------------------------------------------------------------- -lookup3.c, by Bob Jenkins, May 2006, Public Domain. - -These are functions for producing 32-bit hashes for hash table lookup. -hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() -are externally useful functions. Routines to test the hash are included -if SELF_TEST is defined. You can use this free for any purpose. It's in -the public domain. It has no warranty. - -You probably want to use hashlittle(). hashlittle() and hashbig() -hash byte arrays. hashlittle() is is faster than hashbig() on -little-endian machines. Intel and AMD are little-endian machines. -On second thought, you probably want hashlittle2(), which is identical to -hashlittle() except it returns two 32-bit hashes for the price of one. -You could implement hashbig2() if you wanted but I haven't bothered here. - -If you want to find a hash of, say, exactly 7 integers, do - a = i1; b = i2; c = i3; - mix(a,b,c); - a += i4; b += i5; c += i6; - mix(a,b,c); - a += i7; - final(a,b,c); -then use c as the hash value. If you have a variable length array of -4-byte integers to hash, use hashword(). If you have a byte array (like -a character string), use hashlittle(). If you have several byte arrays, or -a mix of things, see the comments above hashlittle(). - -Why is this so big? I read 12 bytes at a time into 3 4-byte integers, -then mix those integers. This is fast (you can do a lot more thorough -mixing with 12*3 instructions on 3 integers than you can with 3 instructions -on 1 byte), but shoehorning those bytes into integers efficiently is messy. -------------------------------------------------------------------------------- -*/ - -#include - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_STDINT_H -#include /* defines uint32_t etc */ -#endif - -#ifdef HAVE_SYS_PARAM_H -#include /* attempt to define endianness */ -#endif - -#ifdef HAVE_ENDIAN_H -# include /* attempt to define endianness */ -#endif - -/* - * My best guess at if you are big-endian or little-endian. This may - * need adjustment. - */ -#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ - __BYTE_ORDER == __LITTLE_ENDIAN) || \ - (defined(i386) || defined(__i386__) || defined(__i486__) || \ - defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)) -# define HASH_LITTLE_ENDIAN 1 -# define HASH_BIG_ENDIAN 0 -#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ - __BYTE_ORDER == __BIG_ENDIAN) || \ - (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 -#else -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 0 -#endif - -#define hashsize(n) ((uint32_t)1<<(n)) -#define hashmask(n) (hashsize(n)-1) -#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) - -/* -------------------------------------------------------------------------------- -mix -- mix 3 32-bit values reversibly. - -This is reversible, so any information in (a,b,c) before mix() is -still in (a,b,c) after mix(). - -If four pairs of (a,b,c) inputs are run through mix(), or through -mix() in reverse, there are at least 32 bits of the output that -are sometimes the same for one pair and different for another pair. -This was tested for: -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that -satisfy this are - 4 6 8 16 19 4 - 9 15 3 18 27 15 - 14 9 3 7 17 3 -Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing -for "differ" defined as + with a one-bit base and a two-bit delta. I -used http://burtleburtle.net/bob/hash/avalanche.html to choose -the operations, constants, and arrangements of the variables. - -This does not achieve avalanche. There are input bits of (a,b,c) -that fail to affect some output bits of (a,b,c), especially of a. The -most thoroughly mixed value is c, but it doesn't really even achieve -avalanche in c. - -This allows some parallelism. Read-after-writes are good at doubling -the number of bits affected, so the goal of mixing pulls in the opposite -direction as the goal of parallelism. I did what I could. Rotates -seem to cost as much as shifts on every machine I could lay my hands -on, and rotates are much kinder to the top and bottom bits, so I used -rotates. -------------------------------------------------------------------------------- -*/ -#define mix(a,b,c) \ -{ \ - a -= c; a ^= rot(c, 4); c += b; \ - b -= a; b ^= rot(a, 6); a += c; \ - c -= b; c ^= rot(b, 8); b += a; \ - a -= c; a ^= rot(c,16); c += b; \ - b -= a; b ^= rot(a,19); a += c; \ - c -= b; c ^= rot(b, 4); b += a; \ -} - -/* -------------------------------------------------------------------------------- -final -- final mixing of 3 32-bit values (a,b,c) into c - -Pairs of (a,b,c) values differing in only a few bits will usually -produce values of c that look totally different. This was tested for -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -These constants passed: - 14 11 25 16 4 14 24 - 12 14 25 16 4 14 24 -and these came close: - 4 8 15 26 3 22 24 - 10 8 15 26 3 22 24 - 11 8 15 26 3 22 24 -------------------------------------------------------------------------------- -*/ -#define final(a,b,c) \ -{ \ - c ^= b; c -= rot(b,14); \ - a ^= c; a -= rot(c,11); \ - b ^= a; b -= rot(a,25); \ - c ^= b; c -= rot(b,16); \ - a ^= c; a -= rot(c,4); \ - b ^= a; b -= rot(a,14); \ - c ^= b; c -= rot(b,24); \ -} - -/* -------------------------------------------------------------------------------- -hashlittle() -- hash a variable-length key into a 32-bit value - k : the key (the unaligned variable-length array of bytes) - length : the length of the key, counting by bytes - initval : can be any 4-byte value -Returns a 32-bit value. Every bit of the key affects every bit of -the return value. Two keys differing by one or two bits will have -totally different hash values. - -The best hash table sizes are powers of 2. There is no need to do -mod a prime (mod is sooo slow!). If you need less than 32 bits, -use a bitmask. For example, if you need only 10 bits, do - h = (h & hashmask(10)); -In which case, the hash table should have hashsize(10) elements. - -If you are hashing n strings (uint8_t **)k, do it like this: - for (i=0, h=0; i 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - /* - * "k[2]&0xffffff" actually reads beyond the end of the string, but - * then masks off the part it's not allowed to read. Because the - * string is aligned, the masked-off tail is in the same word as the - * rest of the string. Every machine with memory protection I've seen - * does it on word boundaries, so is OK with this. But VALGRIND will - * still catch it and complain. The masking trick does make the hash - * noticably faster for short strings (like English words). - */ -#ifndef NO_MASKING_TRICK - - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]&0xffffff; a+=k[0]; break; - case 6 : b+=k[1]&0xffff; a+=k[0]; break; - case 5 : b+=k[1]&0xff; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]&0xffffff; break; - case 2 : a+=k[0]&0xffff; break; - case 1 : a+=k[0]&0xff; break; - case 0 : return c; /* zero length strings require no mixing */ - } - -#else /* make valgrind happy */ - - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]; break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ - case 1 : a+=k8[0]; break; - case 0 : return c; - } - -#endif /* !valgrind */ - - } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { - const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ - const uint8_t *k8; - - /*--------------- all but last block: aligned reads and different mixing */ - while (length > 12) - { - a += k[0] + (((uint32_t)k[1])<<16); - b += k[2] + (((uint32_t)k[3])<<16); - c += k[4] + (((uint32_t)k[5])<<16); - mix(a,b,c); - length -= 12; - k += 6; - } - - /*----------------------------- handle the last (probably partial) block */ - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[4]+(((uint32_t)k[5])<<16); - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=k[4]; - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=k[2]; - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=k[0]; - break; - case 1 : a+=k8[0]; - break; - case 0 : return c; /* zero length requires no mixing */ - } - - } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - a += ((uint32_t)k[1])<<8; - a += ((uint32_t)k[2])<<16; - a += ((uint32_t)k[3])<<24; - b += k[4]; - b += ((uint32_t)k[5])<<8; - b += ((uint32_t)k[6])<<16; - b += ((uint32_t)k[7])<<24; - c += k[8]; - c += ((uint32_t)k[9])<<8; - c += ((uint32_t)k[10])<<16; - c += ((uint32_t)k[11])<<24; - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; - case 1 : a+=k[0]; - break; - case 0 : return c; - } - } - - final(a,b,c); - return c; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/memory.c b/tests/JSONTestSuite/parsers/test_jansson/memory.c deleted file mode 100644 index e2368cf21..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/memory.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * Copyright (c) 2011-2012 Basile Starynkevitch - * - * Jansson is free software; you can redistribute it and/or modify it - * under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include - -#include "jansson.h" -#include "jansson_private.h" - -/* C89 allows these to be macros */ -#undef malloc -#undef free - -/* memory function pointers */ -static json_malloc_t do_malloc = malloc; -static json_free_t do_free = free; - -void *jsonp_malloc(size_t size) -{ - if(!size) - return NULL; - - return (*do_malloc)(size); -} - -void jsonp_free(void *ptr) -{ - if(!ptr) - return; - - (*do_free)(ptr); -} - -char *jsonp_strdup(const char *str) -{ - return jsonp_strndup(str, strlen(str)); -} - -char *jsonp_strndup(const char *str, size_t len) -{ - char *new_str; - - new_str = jsonp_malloc(len + 1); - if(!new_str) - return NULL; - - memcpy(new_str, str, len); - new_str[len] = '\0'; - return new_str; -} - -void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn) -{ - do_malloc = malloc_fn; - do_free = free_fn; -} - -void json_get_alloc_funcs(json_malloc_t *malloc_fn, json_free_t *free_fn) -{ - if (malloc_fn) - *malloc_fn = do_malloc; - if (free_fn) - *free_fn = do_free; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/pack_unpack.c b/tests/JSONTestSuite/parsers/test_jansson/pack_unpack.c deleted file mode 100644 index f6c700c66..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/pack_unpack.c +++ /dev/null @@ -1,871 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * Copyright (c) 2011-2012 Graeme Smecher - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include "jansson.h" -#include "jansson_private.h" -#include "utf.h" - -typedef struct { - int line; - int column; - size_t pos; - char token; -} token_t; - -typedef struct { - const char *start; - const char *fmt; - token_t prev_token; - token_t token; - token_t next_token; - json_error_t *error; - size_t flags; - int line; - int column; - size_t pos; -} scanner_t; - -#define token(scanner) ((scanner)->token.token) - -static const char * const type_names[] = { - "object", - "array", - "string", - "integer", - "real", - "true", - "false", - "null" -}; - -#define type_name(x) type_names[json_typeof(x)] - -static const char unpack_value_starters[] = "{[siIbfFOon"; - -static void scanner_init(scanner_t *s, json_error_t *error, - size_t flags, const char *fmt) -{ - s->error = error; - s->flags = flags; - s->fmt = s->start = fmt; - memset(&s->prev_token, 0, sizeof(token_t)); - memset(&s->token, 0, sizeof(token_t)); - memset(&s->next_token, 0, sizeof(token_t)); - s->line = 1; - s->column = 0; - s->pos = 0; -} - -static void next_token(scanner_t *s) -{ - const char *t; - s->prev_token = s->token; - - if(s->next_token.line) { - s->token = s->next_token; - s->next_token.line = 0; - return; - } - - t = s->fmt; - s->column++; - s->pos++; - - /* skip space and ignored chars */ - while(*t == ' ' || *t == '\t' || *t == '\n' || *t == ',' || *t == ':') { - if(*t == '\n') { - s->line++; - s->column = 1; - } - else - s->column++; - - s->pos++; - t++; - } - - s->token.token = *t; - s->token.line = s->line; - s->token.column = s->column; - s->token.pos = s->pos; - - t++; - s->fmt = t; -} - -static void prev_token(scanner_t *s) -{ - s->next_token = s->token; - s->token = s->prev_token; -} - -static void set_error(scanner_t *s, const char *source, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - - jsonp_error_vset(s->error, s->token.line, s->token.column, s->token.pos, - fmt, ap); - - jsonp_error_set_source(s->error, source); - - va_end(ap); -} - -static json_t *pack(scanner_t *s, va_list *ap); - - -/* ours will be set to 1 if jsonp_free() must be called for the result - afterwards */ -static char *read_string(scanner_t *s, va_list *ap, - const char *purpose, size_t *out_len, int *ours) -{ - char t; - strbuffer_t strbuff; - const char *str; - size_t length; - - next_token(s); - t = token(s); - prev_token(s); - - if(t != '#' && t != '%' && t != '+') { - /* Optimize the simple case */ - str = va_arg(*ap, const char *); - - if(!str) { - set_error(s, "", "NULL string argument"); - return NULL; - } - - length = strlen(str); - - if(!utf8_check_string(str, length)) { - set_error(s, "", "Invalid UTF-8 %s", purpose); - return NULL; - } - - *out_len = length; - *ours = 0; - return (char *)str; - } - - strbuffer_init(&strbuff); - - while(1) { - str = va_arg(*ap, const char *); - if(!str) { - set_error(s, "", "NULL string argument"); - strbuffer_close(&strbuff); - return NULL; - } - - next_token(s); - - if(token(s) == '#') { - length = va_arg(*ap, int); - } - else if(token(s) == '%') { - length = va_arg(*ap, size_t); - } - else { - prev_token(s); - length = strlen(str); - } - - if(strbuffer_append_bytes(&strbuff, str, length) == -1) { - set_error(s, "", "Out of memory"); - strbuffer_close(&strbuff); - return NULL; - } - - next_token(s); - if(token(s) != '+') { - prev_token(s); - break; - } - } - - if(!utf8_check_string(strbuff.value, strbuff.length)) { - set_error(s, "", "Invalid UTF-8 %s", purpose); - strbuffer_close(&strbuff); - return NULL; - } - - *out_len = strbuff.length; - *ours = 1; - return strbuffer_steal_value(&strbuff); -} - -static json_t *pack_object(scanner_t *s, va_list *ap) -{ - json_t *object = json_object(); - next_token(s); - - while(token(s) != '}') { - char *key; - size_t len; - int ours; - json_t *value; - - if(!token(s)) { - set_error(s, "", "Unexpected end of format string"); - goto error; - } - - if(token(s) != 's') { - set_error(s, "", "Expected format 's', got '%c'", token(s)); - goto error; - } - - key = read_string(s, ap, "object key", &len, &ours); - if(!key) - goto error; - - next_token(s); - - value = pack(s, ap); - if(!value) { - if(ours) - jsonp_free(key); - - goto error; - } - - if(json_object_set_new_nocheck(object, key, value)) { - set_error(s, "", "Unable to add key \"%s\"", key); - if(ours) - jsonp_free(key); - - goto error; - } - - if(ours) - jsonp_free(key); - - next_token(s); - } - - return object; - -error: - json_decref(object); - return NULL; -} - -static json_t *pack_array(scanner_t *s, va_list *ap) -{ - json_t *array = json_array(); - next_token(s); - - while(token(s) != ']') { - json_t *value; - - if(!token(s)) { - set_error(s, "", "Unexpected end of format string"); - goto error; - } - - value = pack(s, ap); - if(!value) - goto error; - - if(json_array_append_new(array, value)) { - set_error(s, "", "Unable to append to array"); - goto error; - } - - next_token(s); - } - return array; - -error: - json_decref(array); - return NULL; -} - -static json_t *pack_string(scanner_t *s, va_list *ap) -{ - char *str; - size_t len; - int ours; - int nullable; - - next_token(s); - nullable = token(s) == '?'; - if (!nullable) - prev_token(s); - - str = read_string(s, ap, "string", &len, &ours); - if (!str) { - return nullable ? json_null() : NULL; - } else if (ours) { - return jsonp_stringn_nocheck_own(str, len); - } else { - return json_stringn_nocheck(str, len); - } -} - -static json_t *pack(scanner_t *s, va_list *ap) -{ - switch(token(s)) { - case '{': - return pack_object(s, ap); - - case '[': - return pack_array(s, ap); - - case 's': /* string */ - return pack_string(s, ap); - - case 'n': /* null */ - return json_null(); - - case 'b': /* boolean */ - return va_arg(*ap, int) ? json_true() : json_false(); - - case 'i': /* integer from int */ - return json_integer(va_arg(*ap, int)); - - case 'I': /* integer from json_int_t */ - return json_integer(va_arg(*ap, json_int_t)); - - case 'f': /* real */ - return json_real(va_arg(*ap, double)); - - case 'O': /* a json_t object; increments refcount */ - { - int nullable; - json_t *json; - - next_token(s); - nullable = token(s) == '?'; - if (!nullable) - prev_token(s); - - json = va_arg(*ap, json_t *); - if (!json && nullable) { - return json_null(); - } else { - return json_incref(json); - } - } - - case 'o': /* a json_t object; doesn't increment refcount */ - { - int nullable; - json_t *json; - - next_token(s); - nullable = token(s) == '?'; - if (!nullable) - prev_token(s); - - json = va_arg(*ap, json_t *); - if (!json && nullable) { - return json_null(); - } else { - return json; - } - } - - default: - set_error(s, "", "Unexpected format character '%c'", - token(s)); - return NULL; - } -} - -static int unpack(scanner_t *s, json_t *root, va_list *ap); - -static int unpack_object(scanner_t *s, json_t *root, va_list *ap) -{ - int ret = -1; - int strict = 0; - int gotopt = 0; - - /* Use a set (emulated by a hashtable) to check that all object - keys are accessed. Checking that the correct number of keys - were accessed is not enough, as the same key can be unpacked - multiple times. - */ - hashtable_t key_set; - - if(hashtable_init(&key_set)) { - set_error(s, "", "Out of memory"); - return -1; - } - - if(root && !json_is_object(root)) { - set_error(s, "", "Expected object, got %s", - type_name(root)); - goto out; - } - next_token(s); - - while(token(s) != '}') { - const char *key; - json_t *value; - int opt = 0; - - if(strict != 0) { - set_error(s, "", "Expected '}' after '%c', got '%c'", - (strict == 1 ? '!' : '*'), token(s)); - goto out; - } - - if(!token(s)) { - set_error(s, "", "Unexpected end of format string"); - goto out; - } - - if(token(s) == '!' || token(s) == '*') { - strict = (token(s) == '!' ? 1 : -1); - next_token(s); - continue; - } - - if(token(s) != 's') { - set_error(s, "", "Expected format 's', got '%c'", token(s)); - goto out; - } - - key = va_arg(*ap, const char *); - if(!key) { - set_error(s, "", "NULL object key"); - goto out; - } - - next_token(s); - - if(token(s) == '?') { - opt = gotopt = 1; - next_token(s); - } - - if(!root) { - /* skipping */ - value = NULL; - } - else { - value = json_object_get(root, key); - if(!value && !opt) { - set_error(s, "", "Object item not found: %s", key); - goto out; - } - } - - if(unpack(s, value, ap)) - goto out; - - hashtable_set(&key_set, key, 0, json_null()); - next_token(s); - } - - if(strict == 0 && (s->flags & JSON_STRICT)) - strict = 1; - - if(root && strict == 1) { - /* We need to check that all non optional items have been parsed */ - const char *key; - int have_unrecognized_keys = 0; - strbuffer_t unrecognized_keys; - json_t *value; - long unpacked = 0; - if (gotopt) { - /* We have optional keys, we need to iter on each key */ - json_object_foreach(root, key, value) { - if(!hashtable_get(&key_set, key)) { - unpacked++; - - /* Save unrecognized keys for the error message */ - if (!have_unrecognized_keys) { - strbuffer_init(&unrecognized_keys); - have_unrecognized_keys = 1; - } else { - strbuffer_append_bytes(&unrecognized_keys, ", ", 2); - } - strbuffer_append_bytes(&unrecognized_keys, key, strlen(key)); - } - } - } else { - /* No optional keys, we can just compare the number of items */ - unpacked = (long)json_object_size(root) - (long)key_set.size; - } - if (unpacked) { - if (!gotopt) { - /* Save unrecognized keys for the error message */ - json_object_foreach(root, key, value) { - if(!hashtable_get(&key_set, key)) { - if (!have_unrecognized_keys) { - strbuffer_init(&unrecognized_keys); - have_unrecognized_keys = 1; - } else { - strbuffer_append_bytes(&unrecognized_keys, ", ", 2); - } - strbuffer_append_bytes(&unrecognized_keys, key, strlen(key)); - } - } - } - set_error(s, "", - "%li object item(s) left unpacked: %s", - unpacked, strbuffer_value(&unrecognized_keys)); - strbuffer_close(&unrecognized_keys); - goto out; - } - } - - ret = 0; - -out: - hashtable_close(&key_set); - return ret; -} - -static int unpack_array(scanner_t *s, json_t *root, va_list *ap) -{ - size_t i = 0; - int strict = 0; - - if(root && !json_is_array(root)) { - set_error(s, "", "Expected array, got %s", type_name(root)); - return -1; - } - next_token(s); - - while(token(s) != ']') { - json_t *value; - - if(strict != 0) { - set_error(s, "", "Expected ']' after '%c', got '%c'", - (strict == 1 ? '!' : '*'), - token(s)); - return -1; - } - - if(!token(s)) { - set_error(s, "", "Unexpected end of format string"); - return -1; - } - - if(token(s) == '!' || token(s) == '*') { - strict = (token(s) == '!' ? 1 : -1); - next_token(s); - continue; - } - - if(!strchr(unpack_value_starters, token(s))) { - set_error(s, "", "Unexpected format character '%c'", - token(s)); - return -1; - } - - if(!root) { - /* skipping */ - value = NULL; - } - else { - value = json_array_get(root, i); - if(!value) { - set_error(s, "", "Array index %lu out of range", - (unsigned long)i); - return -1; - } - } - - if(unpack(s, value, ap)) - return -1; - - next_token(s); - i++; - } - - if(strict == 0 && (s->flags & JSON_STRICT)) - strict = 1; - - if(root && strict == 1 && i != json_array_size(root)) { - long diff = (long)json_array_size(root) - (long)i; - set_error(s, "", "%li array item(s) left unpacked", diff); - return -1; - } - - return 0; -} - -static int unpack(scanner_t *s, json_t *root, va_list *ap) -{ - switch(token(s)) - { - case '{': - return unpack_object(s, root, ap); - - case '[': - return unpack_array(s, root, ap); - - case 's': - if(root && !json_is_string(root)) { - set_error(s, "", "Expected string, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - const char **str_target; - size_t *len_target = NULL; - - str_target = va_arg(*ap, const char **); - if(!str_target) { - set_error(s, "", "NULL string argument"); - return -1; - } - - next_token(s); - - if(token(s) == '%') { - len_target = va_arg(*ap, size_t *); - if(!len_target) { - set_error(s, "", "NULL string length argument"); - return -1; - } - } - else - prev_token(s); - - if(root) { - *str_target = json_string_value(root); - if(len_target) - *len_target = json_string_length(root); - } - } - return 0; - - case 'i': - if(root && !json_is_integer(root)) { - set_error(s, "", "Expected integer, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - int *target = va_arg(*ap, int*); - if(root) - *target = (int)json_integer_value(root); - } - - return 0; - - case 'I': - if(root && !json_is_integer(root)) { - set_error(s, "", "Expected integer, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - json_int_t *target = va_arg(*ap, json_int_t*); - if(root) - *target = json_integer_value(root); - } - - return 0; - - case 'b': - if(root && !json_is_boolean(root)) { - set_error(s, "", "Expected true or false, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - int *target = va_arg(*ap, int*); - if(root) - *target = json_is_true(root); - } - - return 0; - - case 'f': - if(root && !json_is_real(root)) { - set_error(s, "", "Expected real, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - double *target = va_arg(*ap, double*); - if(root) - *target = json_real_value(root); - } - - return 0; - - case 'F': - if(root && !json_is_number(root)) { - set_error(s, "", "Expected real or integer, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - double *target = va_arg(*ap, double*); - if(root) - *target = json_number_value(root); - } - - return 0; - - case 'O': - if(root && !(s->flags & JSON_VALIDATE_ONLY)) - json_incref(root); - /* Fall through */ - - case 'o': - if(!(s->flags & JSON_VALIDATE_ONLY)) { - json_t **target = va_arg(*ap, json_t**); - if(root) - *target = root; - } - - return 0; - - case 'n': - /* Never assign, just validate */ - if(root && !json_is_null(root)) { - set_error(s, "", "Expected null, got %s", - type_name(root)); - return -1; - } - return 0; - - default: - set_error(s, "", "Unexpected format character '%c'", - token(s)); - return -1; - } -} - -json_t *json_vpack_ex(json_error_t *error, size_t flags, - const char *fmt, va_list ap) -{ - scanner_t s; - va_list ap_copy; - json_t *value; - - if(!fmt || !*fmt) { - jsonp_error_init(error, ""); - jsonp_error_set(error, -1, -1, 0, "NULL or empty format string"); - return NULL; - } - jsonp_error_init(error, NULL); - - scanner_init(&s, error, flags, fmt); - next_token(&s); - - va_copy(ap_copy, ap); - value = pack(&s, &ap_copy); - va_end(ap_copy); - - if(!value) - return NULL; - - next_token(&s); - if(token(&s)) { - json_decref(value); - set_error(&s, "", "Garbage after format string"); - return NULL; - } - - return value; -} - -json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...) -{ - json_t *value; - va_list ap; - - va_start(ap, fmt); - value = json_vpack_ex(error, flags, fmt, ap); - va_end(ap); - - return value; -} - -json_t *json_pack(const char *fmt, ...) -{ - json_t *value; - va_list ap; - - va_start(ap, fmt); - value = json_vpack_ex(NULL, 0, fmt, ap); - va_end(ap); - - return value; -} - -int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, - const char *fmt, va_list ap) -{ - scanner_t s; - va_list ap_copy; - - if(!root) { - jsonp_error_init(error, ""); - jsonp_error_set(error, -1, -1, 0, "NULL root value"); - return -1; - } - - if(!fmt || !*fmt) { - jsonp_error_init(error, ""); - jsonp_error_set(error, -1, -1, 0, "NULL or empty format string"); - return -1; - } - jsonp_error_init(error, NULL); - - scanner_init(&s, error, flags, fmt); - next_token(&s); - - va_copy(ap_copy, ap); - if(unpack(&s, root, &ap_copy)) { - va_end(ap_copy); - return -1; - } - va_end(ap_copy); - - next_token(&s); - if(token(&s)) { - set_error(&s, "", "Garbage after format string"); - return -1; - } - - return 0; -} - -int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = json_vunpack_ex(root, error, flags, fmt, ap); - va_end(ap); - - return ret; -} - -int json_unpack(json_t *root, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = json_vunpack_ex(root, NULL, 0, fmt, ap); - va_end(ap); - - return ret; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/strbuffer.c b/tests/JSONTestSuite/parsers/test_jansson/strbuffer.c deleted file mode 100644 index 512920516..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/strbuffer.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include "jansson_private.h" -#include "strbuffer.h" - -#define STRBUFFER_MIN_SIZE 16 -#define STRBUFFER_FACTOR 2 -#define STRBUFFER_SIZE_MAX ((size_t)-1) - -int strbuffer_init(strbuffer_t *strbuff) -{ - strbuff->size = STRBUFFER_MIN_SIZE; - strbuff->length = 0; - - strbuff->value = jsonp_malloc(strbuff->size); - if(!strbuff->value) - return -1; - - /* initialize to empty */ - strbuff->value[0] = '\0'; - return 0; -} - -void strbuffer_close(strbuffer_t *strbuff) -{ - if(strbuff->value) - jsonp_free(strbuff->value); - - strbuff->size = 0; - strbuff->length = 0; - strbuff->value = NULL; -} - -void strbuffer_clear(strbuffer_t *strbuff) -{ - strbuff->length = 0; - strbuff->value[0] = '\0'; -} - -const char *strbuffer_value(const strbuffer_t *strbuff) -{ - return strbuff->value; -} - -char *strbuffer_steal_value(strbuffer_t *strbuff) -{ - char *result = strbuff->value; - strbuff->value = NULL; - return result; -} - -int strbuffer_append_byte(strbuffer_t *strbuff, char byte) -{ - return strbuffer_append_bytes(strbuff, &byte, 1); -} - -int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size) -{ - if(size >= strbuff->size - strbuff->length) - { - size_t new_size; - char *new_value; - - /* avoid integer overflow */ - if (strbuff->size > STRBUFFER_SIZE_MAX / STRBUFFER_FACTOR - || size > STRBUFFER_SIZE_MAX - 1 - || strbuff->length > STRBUFFER_SIZE_MAX - 1 - size) - return -1; - - new_size = max(strbuff->size * STRBUFFER_FACTOR, - strbuff->length + size + 1); - - new_value = jsonp_malloc(new_size); - if(!new_value) - return -1; - - memcpy(new_value, strbuff->value, strbuff->length); - - jsonp_free(strbuff->value); - strbuff->value = new_value; - strbuff->size = new_size; - } - - memcpy(strbuff->value + strbuff->length, data, size); - strbuff->length += size; - strbuff->value[strbuff->length] = '\0'; - - return 0; -} - -char strbuffer_pop(strbuffer_t *strbuff) -{ - if(strbuff->length > 0) { - char c = strbuff->value[--strbuff->length]; - strbuff->value[strbuff->length] = '\0'; - return c; - } - else - return '\0'; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/strbuffer.h b/tests/JSONTestSuite/parsers/test_jansson/strbuffer.h deleted file mode 100644 index 88b7e0532..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/strbuffer.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef STRBUFFER_H -#define STRBUFFER_H - -#include - -typedef struct { - char *value; - size_t length; /* bytes used */ - size_t size; /* bytes allocated */ -} strbuffer_t; - -int strbuffer_init(strbuffer_t *strbuff); -void strbuffer_close(strbuffer_t *strbuff); - -void strbuffer_clear(strbuffer_t *strbuff); - -const char *strbuffer_value(const strbuffer_t *strbuff); - -/* Steal the value and close the strbuffer */ -char *strbuffer_steal_value(strbuffer_t *strbuff); - -int strbuffer_append_byte(strbuffer_t *strbuff, char byte); -int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size); - -char strbuffer_pop(strbuffer_t *strbuff); - -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/strconv.c b/tests/JSONTestSuite/parsers/test_jansson/strconv.c deleted file mode 100644 index 8075481e3..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/strconv.c +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include -#include -#include -#include -#ifdef __MINGW32__ -#undef __NO_ISOCEXT /* ensure stdlib.h will declare prototypes for mingw own 'strtod' replacement, called '__strtod' */ -#endif -#include "jansson_private.h" -#include "strbuffer.h" - -/* need jansson_private_config.h to get the correct snprintf */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef __MINGW32__ -#define strtod __strtod -#endif - -#if JSON_HAVE_LOCALECONV -#include - -/* - - This code assumes that the decimal separator is exactly one - character. - - - If setlocale() is called by another thread between the call to - localeconv() and the call to sprintf() or strtod(), the result may - be wrong. setlocale() is not thread-safe and should not be used - this way. Multi-threaded programs should use uselocale() instead. -*/ - -static void to_locale(strbuffer_t *strbuffer) -{ - const char *point; - char *pos; - - point = localeconv()->decimal_point; - if(*point == '.') { - /* No conversion needed */ - return; - } - - pos = strchr(strbuffer->value, '.'); - if(pos) - *pos = *point; -} - -static void from_locale(char *buffer) -{ - const char *point; - char *pos; - - point = localeconv()->decimal_point; - if(*point == '.') { - /* No conversion needed */ - return; - } - - pos = strchr(buffer, *point); - if(pos) - *pos = '.'; -} -#endif - -int jsonp_strtod(strbuffer_t *strbuffer, double *out) -{ - double value; - char *end; - -#if JSON_HAVE_LOCALECONV - to_locale(strbuffer); -#endif - - errno = 0; - value = strtod(strbuffer->value, &end); - assert(end == strbuffer->value + strbuffer->length); - - if((value == HUGE_VAL || value == -HUGE_VAL) && errno == ERANGE) { - /* Overflow */ - return -1; - } - - *out = value; - return 0; -} - -int jsonp_dtostr(char *buffer, size_t size, double value, int precision) -{ - int ret; - char *start, *end; - size_t length; - - if (precision == 0) - precision = 17; - - ret = snprintf(buffer, size, "%.*g", precision, value); - if(ret < 0) - return -1; - - length = (size_t)ret; - if(length >= size) - return -1; - -#if JSON_HAVE_LOCALECONV - from_locale(buffer); -#endif - - /* Make sure there's a dot or 'e' in the output. Otherwise - a real is converted to an integer when decoding */ - if(strchr(buffer, '.') == NULL && - strchr(buffer, 'e') == NULL) - { - if(length + 3 >= size) { - /* No space to append ".0" */ - return -1; - } - buffer[length] = '.'; - buffer[length + 1] = '0'; - buffer[length + 2] = '\0'; - length += 2; - } - - /* Remove leading '+' from positive exponent. Also remove leading - zeros from exponents (added by some printf() implementations) */ - start = strchr(buffer, 'e'); - if(start) { - start++; - end = start + 1; - - if(*start == '-') - start++; - - while(*end == '0') - end++; - - if(end != start) { - memmove(start, end, length - (size_t)(end - buffer)); - length -= (size_t)(end - start); - } - } - - return (int)length; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.pbxproj deleted file mode 100644 index 443a79976..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.pbxproj +++ /dev/null @@ -1,309 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03B1DD541D56886E00FEDE27 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD531D56886E00FEDE27 /* main.c */; }; - 03B1DD6B1D56887A00FEDE27 /* dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD5A1D56887A00FEDE27 /* dump.c */; }; - 03B1DD6C1D56887A00FEDE27 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD5B1D56887A00FEDE27 /* error.c */; }; - 03B1DD6D1D56887A00FEDE27 /* hashtable_seed.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD5C1D56887A00FEDE27 /* hashtable_seed.c */; }; - 03B1DD6E1D56887A00FEDE27 /* hashtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD5D1D56887A00FEDE27 /* hashtable.c */; }; - 03B1DD6F1D56887A00FEDE27 /* load.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD611D56887A00FEDE27 /* load.c */; }; - 03B1DD701D56887A00FEDE27 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD631D56887A00FEDE27 /* memory.c */; }; - 03B1DD711D56887A00FEDE27 /* pack_unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD641D56887A00FEDE27 /* pack_unpack.c */; }; - 03B1DD721D56887A00FEDE27 /* strbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD651D56887A00FEDE27 /* strbuffer.c */; }; - 03B1DD731D56887A00FEDE27 /* strconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD671D56887A00FEDE27 /* strconv.c */; }; - 03B1DD741D56887A00FEDE27 /* utf.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD681D56887A00FEDE27 /* utf.c */; }; - 03B1DD751D56887A00FEDE27 /* value.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD6A1D56887A00FEDE27 /* value.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03B1DD4E1D56886E00FEDE27 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03B1DD501D56886E00FEDE27 /* test_jansson */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_jansson; sourceTree = BUILT_PRODUCTS_DIR; }; - 03B1DD531D56886E00FEDE27 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 03B1DD5A1D56887A00FEDE27 /* dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dump.c; sourceTree = ""; }; - 03B1DD5B1D56887A00FEDE27 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; - 03B1DD5C1D56887A00FEDE27 /* hashtable_seed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hashtable_seed.c; sourceTree = ""; }; - 03B1DD5D1D56887A00FEDE27 /* hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hashtable.c; sourceTree = ""; }; - 03B1DD5E1D56887A00FEDE27 /* hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hashtable.h; sourceTree = ""; }; - 03B1DD5F1D56887A00FEDE27 /* jansson_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jansson_private.h; sourceTree = ""; }; - 03B1DD601D56887A00FEDE27 /* jansson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jansson.h; sourceTree = ""; }; - 03B1DD611D56887A00FEDE27 /* load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = ""; }; - 03B1DD621D56887A00FEDE27 /* lookup3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lookup3.h; sourceTree = ""; }; - 03B1DD631D56887A00FEDE27 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = ""; }; - 03B1DD641D56887A00FEDE27 /* pack_unpack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pack_unpack.c; sourceTree = ""; }; - 03B1DD651D56887A00FEDE27 /* strbuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strbuffer.c; sourceTree = ""; }; - 03B1DD661D56887A00FEDE27 /* strbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strbuffer.h; sourceTree = ""; }; - 03B1DD671D56887A00FEDE27 /* strconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strconv.c; sourceTree = ""; }; - 03B1DD681D56887A00FEDE27 /* utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf.c; sourceTree = ""; }; - 03B1DD691D56887A00FEDE27 /* utf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf.h; sourceTree = ""; }; - 03B1DD6A1D56887A00FEDE27 /* value.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = value.c; sourceTree = ""; }; - 03B1DD761D56889200FEDE27 /* jansson_config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jansson_config.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03B1DD4D1D56886E00FEDE27 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03B1DD471D56886E00FEDE27 = { - isa = PBXGroup; - children = ( - 03B1DD761D56889200FEDE27 /* jansson_config.h */, - 03B1DD5A1D56887A00FEDE27 /* dump.c */, - 03B1DD5B1D56887A00FEDE27 /* error.c */, - 03B1DD5C1D56887A00FEDE27 /* hashtable_seed.c */, - 03B1DD5D1D56887A00FEDE27 /* hashtable.c */, - 03B1DD5E1D56887A00FEDE27 /* hashtable.h */, - 03B1DD5F1D56887A00FEDE27 /* jansson_private.h */, - 03B1DD601D56887A00FEDE27 /* jansson.h */, - 03B1DD611D56887A00FEDE27 /* load.c */, - 03B1DD621D56887A00FEDE27 /* lookup3.h */, - 03B1DD631D56887A00FEDE27 /* memory.c */, - 03B1DD641D56887A00FEDE27 /* pack_unpack.c */, - 03B1DD651D56887A00FEDE27 /* strbuffer.c */, - 03B1DD661D56887A00FEDE27 /* strbuffer.h */, - 03B1DD671D56887A00FEDE27 /* strconv.c */, - 03B1DD681D56887A00FEDE27 /* utf.c */, - 03B1DD691D56887A00FEDE27 /* utf.h */, - 03B1DD6A1D56887A00FEDE27 /* value.c */, - 03B1DD521D56886E00FEDE27 /* test_jansson */, - 03B1DD511D56886E00FEDE27 /* Products */, - ); - sourceTree = ""; - }; - 03B1DD511D56886E00FEDE27 /* Products */ = { - isa = PBXGroup; - children = ( - 03B1DD501D56886E00FEDE27 /* test_jansson */, - ); - name = Products; - sourceTree = ""; - }; - 03B1DD521D56886E00FEDE27 /* test_jansson */ = { - isa = PBXGroup; - children = ( - 03B1DD531D56886E00FEDE27 /* main.c */, - ); - path = test_jansson; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03B1DD4F1D56886E00FEDE27 /* test_jansson */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03B1DD571D56886E00FEDE27 /* Build configuration list for PBXNativeTarget "test_jansson" */; - buildPhases = ( - 03B1DD4C1D56886E00FEDE27 /* Sources */, - 03B1DD4D1D56886E00FEDE27 /* Frameworks */, - 03B1DD4E1D56886E00FEDE27 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_jansson; - productName = test_jansson; - productReference = 03B1DD501D56886E00FEDE27 /* test_jansson */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03B1DD481D56886E00FEDE27 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03B1DD4F1D56886E00FEDE27 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - DevelopmentTeamName = "Nicolas Seriot"; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03B1DD4B1D56886E00FEDE27 /* Build configuration list for PBXProject "test_jansson" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03B1DD471D56886E00FEDE27; - productRefGroup = 03B1DD511D56886E00FEDE27 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03B1DD4F1D56886E00FEDE27 /* test_jansson */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03B1DD4C1D56886E00FEDE27 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03B1DD741D56887A00FEDE27 /* utf.c in Sources */, - 03B1DD701D56887A00FEDE27 /* memory.c in Sources */, - 03B1DD6C1D56887A00FEDE27 /* error.c in Sources */, - 03B1DD6F1D56887A00FEDE27 /* load.c in Sources */, - 03B1DD721D56887A00FEDE27 /* strbuffer.c in Sources */, - 03B1DD6D1D56887A00FEDE27 /* hashtable_seed.c in Sources */, - 03B1DD6E1D56887A00FEDE27 /* hashtable.c in Sources */, - 03B1DD541D56886E00FEDE27 /* main.c in Sources */, - 03B1DD711D56887A00FEDE27 /* pack_unpack.c in Sources */, - 03B1DD751D56887A00FEDE27 /* value.c in Sources */, - 03B1DD6B1D56887A00FEDE27 /* dump.c in Sources */, - 03B1DD731D56887A00FEDE27 /* strconv.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03B1DD551D56886E00FEDE27 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03B1DD561D56886E00FEDE27 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03B1DD581D56886E00FEDE27 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03B1DD591D56886E00FEDE27 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03B1DD4B1D56886E00FEDE27 /* Build configuration list for PBXProject "test_jansson" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03B1DD551D56886E00FEDE27 /* Debug */, - 03B1DD561D56886E00FEDE27 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03B1DD571D56886E00FEDE27 /* Build configuration list for PBXNativeTarget "test_jansson" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03B1DD581D56886E00FEDE27 /* Debug */, - 03B1DD591D56886E00FEDE27 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03B1DD481D56886E00FEDE27 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index df988aa68..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index e2567feec..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b45415..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_jansson.xcscheme b/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_jansson.xcscheme deleted file mode 100644 index afd795550..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_jansson.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 276346de9..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/test_jansson.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_jansson.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03B1DD4F1D56886E00FEDE27 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jansson/test_jansson/main.c b/tests/JSONTestSuite/parsers/test_jansson/test_jansson/main.c deleted file mode 100644 index 9dc1e7a77..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/test_jansson/main.c +++ /dev/null @@ -1,208 +0,0 @@ -// -// main.c -// test_jansson -// -// Created by nst on 06/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#include -#include -#import "jansson.h" -#include -#include -#include -#include - -/* forward refs */ -void print_json(json_t *root); -void print_json_aux(json_t *element, int indent); -void print_json_indent(int indent); -const char *json_plural(int count); -void print_json_object(json_t *element, int indent); -void print_json_array(json_t *element, int indent); -void print_json_string(json_t *element, int indent); -void print_json_integer(json_t *element, int indent); -void print_json_real(json_t *element, int indent); -void print_json_true(json_t *element, int indent); -void print_json_false(json_t *element, int indent); -void print_json_null(json_t *element, int indent); - -void print_json(json_t *root) { - print_json_aux(root, 0); -} - -void print_json_aux(json_t *element, int indent) { - switch (json_typeof(element)) { - case JSON_OBJECT: - print_json_object(element, indent); - break; - case JSON_ARRAY: - print_json_array(element, indent); - break; - case JSON_STRING: - print_json_string(element, indent); - break; - case JSON_INTEGER: - print_json_integer(element, indent); - break; - case JSON_REAL: - print_json_real(element, indent); - break; - case JSON_TRUE: - print_json_true(element, indent); - break; - case JSON_FALSE: - print_json_false(element, indent); - break; - case JSON_NULL: - print_json_null(element, indent); - break; - default: - fprintf(stderr, "unrecognized JSON type %d\n", json_typeof(element)); - } -} - -void print_json_indent(int indent) { - int i; - for (i = 0; i < indent; i++) { putchar(' '); } -} - -const char *json_plural(int count) { - return count == 1 ? "" : "s"; -} - -void print_json_object(json_t *element, int indent) { - size_t size; - const char *key; - json_t *value; - - print_json_indent(indent); - size = json_object_size(element); - - printf("JSON Object of %ld pair%s:\n", size, json_plural(size)); - json_object_foreach(element, key, value) { - print_json_indent(indent + 2); - printf("JSON Key: \"%s\"\n", key); - print_json_aux(value, indent + 2); - } - -} - -void print_json_array(json_t *element, int indent) { - size_t i; - size_t size = json_array_size(element); - print_json_indent(indent); - - printf("JSON Array of %ld element%s:\n", size, json_plural(size)); - for (i = 0; i < size; i++) { - print_json_aux(json_array_get(element, i), indent + 2); - } -} - -void print_json_string(json_t *element, int indent) { - print_json_indent(indent); - printf("JSON String: \"%s\"\n", json_string_value(element)); -} - -void print_json_integer(json_t *element, int indent) { - print_json_indent(indent); - printf("JSON Integer: \"%" JSON_INTEGER_FORMAT "\"\n", json_integer_value(element)); -} - -void print_json_real(json_t *element, int indent) { - print_json_indent(indent); - printf("JSON Real: %f\n", json_real_value(element)); -} - -void print_json_true(json_t *element, int indent) { - (void)element; - print_json_indent(indent); - printf("JSON True\n"); -} - -void print_json_false(json_t *element, int indent) { - (void)element; - print_json_indent(indent); - printf("JSON False\n"); -} - -void print_json_null(json_t *element, int indent) { - (void)element; - print_json_indent(indent); - printf("JSON Null\n"); -} - -/* - * Parse text into a JSON object. If text is valid JSON, returns a - * json_t structure, otherwise prints and error and returns null. - */ -json_t *load_json(const char *text, int printParsingResults) { - json_t *root; - json_error_t error; - - root = json_loads(text, 0, &error); - - if (root) { - return root; - } else { - if(printParsingResults) { - fprintf(stderr, "json error on line %d: %s\n", error.line, error.text); - } - return (json_t *)0; - } -} - -/* - * Print a prompt and return (by reference) a null-terminated line of - * text. Returns NULL on eof or some error. - */ -char *read_line(char *line, int max_chars) { - printf("Type some JSON > "); - fflush(stdout); - return fgets(line, max_chars, stdin); -} - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -/* Read a file, parse, render back, etc. */ -TestStatus testFile(const char *filename, int printParsingResults) { - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return ERROR; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - - /* parse text into JSON structure */ - json_t *root = load_json(data, printParsingResults); - free(data); - - if (root) { - /* print and release the JSON structure */ - if(printParsingResults) { - print_json(root); - } - json_decref(root); - } - - return root != NULL ? PASS : FAIL; -} - -int main(int argc, const char * argv[]) { - - const char* path = argv[1]; - - int printParsingResults = 0; - - int result = testFile(path, printParsingResults); - - if (result == PASS) { - return 0; - } else { - return 1; - } -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/utf.c b/tests/JSONTestSuite/parsers/test_jansson/utf.c deleted file mode 100644 index b56e1250f..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/utf.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include "utf.h" - -int utf8_encode(int32_t codepoint, char *buffer, size_t *size) -{ - if(codepoint < 0) - return -1; - else if(codepoint < 0x80) - { - buffer[0] = (char)codepoint; - *size = 1; - } - else if(codepoint < 0x800) - { - buffer[0] = 0xC0 + ((codepoint & 0x7C0) >> 6); - buffer[1] = 0x80 + ((codepoint & 0x03F)); - *size = 2; - } - else if(codepoint < 0x10000) - { - buffer[0] = 0xE0 + ((codepoint & 0xF000) >> 12); - buffer[1] = 0x80 + ((codepoint & 0x0FC0) >> 6); - buffer[2] = 0x80 + ((codepoint & 0x003F)); - *size = 3; - } - else if(codepoint <= 0x10FFFF) - { - buffer[0] = 0xF0 + ((codepoint & 0x1C0000) >> 18); - buffer[1] = 0x80 + ((codepoint & 0x03F000) >> 12); - buffer[2] = 0x80 + ((codepoint & 0x000FC0) >> 6); - buffer[3] = 0x80 + ((codepoint & 0x00003F)); - *size = 4; - } - else - return -1; - - return 0; -} - -size_t utf8_check_first(char byte) -{ - unsigned char u = (unsigned char)byte; - - if(u < 0x80) - return 1; - - if(0x80 <= u && u <= 0xBF) { - /* second, third or fourth byte of a multi-byte - sequence, i.e. a "continuation byte" */ - return 0; - } - else if(u == 0xC0 || u == 0xC1) { - /* overlong encoding of an ASCII byte */ - return 0; - } - else if(0xC2 <= u && u <= 0xDF) { - /* 2-byte sequence */ - return 2; - } - - else if(0xE0 <= u && u <= 0xEF) { - /* 3-byte sequence */ - return 3; - } - else if(0xF0 <= u && u <= 0xF4) { - /* 4-byte sequence */ - return 4; - } - else { /* u >= 0xF5 */ - /* Restricted (start of 4-, 5- or 6-byte sequence) or invalid - UTF-8 */ - return 0; - } -} - -size_t utf8_check_full(const char *buffer, size_t size, int32_t *codepoint) -{ - size_t i; - int32_t value = 0; - unsigned char u = (unsigned char)buffer[0]; - - if(size == 2) - { - value = u & 0x1F; - } - else if(size == 3) - { - value = u & 0xF; - } - else if(size == 4) - { - value = u & 0x7; - } - else - return 0; - - for(i = 1; i < size; i++) - { - u = (unsigned char)buffer[i]; - - if(u < 0x80 || u > 0xBF) { - /* not a continuation byte */ - return 0; - } - - value = (value << 6) + (u & 0x3F); - } - - if(value > 0x10FFFF) { - /* not in Unicode range */ - return 0; - } - - else if(0xD800 <= value && value <= 0xDFFF) { - /* invalid code point (UTF-16 surrogate halves) */ - return 0; - } - - else if((size == 2 && value < 0x80) || - (size == 3 && value < 0x800) || - (size == 4 && value < 0x10000)) { - /* overlong encoding */ - return 0; - } - - if(codepoint) - *codepoint = value; - - return 1; -} - -const char *utf8_iterate(const char *buffer, size_t bufsize, int32_t *codepoint) -{ - size_t count; - int32_t value; - - if(!bufsize) - return buffer; - - count = utf8_check_first(buffer[0]); - if(count <= 0) - return NULL; - - if(count == 1) - value = (unsigned char)buffer[0]; - else - { - if(count > bufsize || !utf8_check_full(buffer, count, &value)) - return NULL; - } - - if(codepoint) - *codepoint = value; - - return buffer + count; -} - -int utf8_check_string(const char *string, size_t length) -{ - size_t i; - - for(i = 0; i < length; i++) - { - size_t count = utf8_check_first(string[i]); - if(count == 0) - return 0; - else if(count > 1) - { - if(count > length - i) - return 0; - - if(!utf8_check_full(&string[i], count, NULL)) - return 0; - - i += count - 1; - } - } - - return 1; -} diff --git a/tests/JSONTestSuite/parsers/test_jansson/utf.h b/tests/JSONTestSuite/parsers/test_jansson/utf.h deleted file mode 100644 index 2cebea012..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/utf.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef UTF_H -#define UTF_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -int utf8_encode(int32_t codepoint, char *buffer, size_t *size); - -size_t utf8_check_first(char byte); -size_t utf8_check_full(const char *buffer, size_t size, int32_t *codepoint); -const char *utf8_iterate(const char *buffer, size_t size, int32_t *codepoint); - -int utf8_check_string(const char *string, size_t length); - -#endif diff --git a/tests/JSONTestSuite/parsers/test_jansson/value.c b/tests/JSONTestSuite/parsers/test_jansson/value.c deleted file mode 100644 index 201060513..000000000 --- a/tests/JSONTestSuite/parsers/test_jansson/value.c +++ /dev/null @@ -1,1048 +0,0 @@ -/* - * Copyright (c) 2009-2014 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#ifdef HAVE_STDINT_H -#include -#endif - -#include "jansson.h" -#include "hashtable.h" -#include "jansson_private.h" -#include "utf.h" - -/* Work around nonstandard isnan() and isinf() implementations */ -#ifndef isnan -#ifndef __sun -static JSON_INLINE int isnan(double x) { return x != x; } -#endif -#endif -#ifndef isinf -static JSON_INLINE int isinf(double x) { return !isnan(x) && isnan(x - x); } -#endif - -static JSON_INLINE void json_init(json_t *json, json_type type) -{ - json->type = type; - json->refcount = 1; -} - - -/*** object ***/ - -extern volatile uint32_t hashtable_seed; - -json_t *json_object(void) -{ - json_object_t *object = jsonp_malloc(sizeof(json_object_t)); - if(!object) - return NULL; - - if (!hashtable_seed) { - /* Autoseed */ - json_object_seed(0); - } - - json_init(&object->json, JSON_OBJECT); - - if(hashtable_init(&object->hashtable)) - { - jsonp_free(object); - return NULL; - } - - object->serial = 0; - object->visited = 0; - - return &object->json; -} - -static void json_delete_object(json_object_t *object) -{ - hashtable_close(&object->hashtable); - jsonp_free(object); -} - -size_t json_object_size(const json_t *json) -{ - json_object_t *object; - - if(!json_is_object(json)) - return 0; - - object = json_to_object(json); - return object->hashtable.size; -} - -json_t *json_object_get(const json_t *json, const char *key) -{ - json_object_t *object; - - if(!key || !json_is_object(json)) - return NULL; - - object = json_to_object(json); - return hashtable_get(&object->hashtable, key); -} - -int json_object_set_new_nocheck(json_t *json, const char *key, json_t *value) -{ - json_object_t *object; - - if(!value) - return -1; - - if(!key || !json_is_object(json) || json == value) - { - json_decref(value); - return -1; - } - object = json_to_object(json); - - if(hashtable_set(&object->hashtable, key, object->serial++, value)) - { - json_decref(value); - return -1; - } - - return 0; -} - -int json_object_set_new(json_t *json, const char *key, json_t *value) -{ - if(!key || !utf8_check_string(key, strlen(key))) - { - json_decref(value); - return -1; - } - - return json_object_set_new_nocheck(json, key, value); -} - -int json_object_del(json_t *json, const char *key) -{ - json_object_t *object; - - if(!key || !json_is_object(json)) - return -1; - - object = json_to_object(json); - return hashtable_del(&object->hashtable, key); -} - -int json_object_clear(json_t *json) -{ - json_object_t *object; - - if(!json_is_object(json)) - return -1; - - object = json_to_object(json); - - hashtable_clear(&object->hashtable); - object->serial = 0; - - return 0; -} - -int json_object_update(json_t *object, json_t *other) -{ - const char *key; - json_t *value; - - if(!json_is_object(object) || !json_is_object(other)) - return -1; - - json_object_foreach(other, key, value) { - if(json_object_set_nocheck(object, key, value)) - return -1; - } - - return 0; -} - -int json_object_update_existing(json_t *object, json_t *other) -{ - const char *key; - json_t *value; - - if(!json_is_object(object) || !json_is_object(other)) - return -1; - - json_object_foreach(other, key, value) { - if(json_object_get(object, key)) - json_object_set_nocheck(object, key, value); - } - - return 0; -} - -int json_object_update_missing(json_t *object, json_t *other) -{ - const char *key; - json_t *value; - - if(!json_is_object(object) || !json_is_object(other)) - return -1; - - json_object_foreach(other, key, value) { - if(!json_object_get(object, key)) - json_object_set_nocheck(object, key, value); - } - - return 0; -} - -void *json_object_iter(json_t *json) -{ - json_object_t *object; - - if(!json_is_object(json)) - return NULL; - - object = json_to_object(json); - return hashtable_iter(&object->hashtable); -} - -void *json_object_iter_at(json_t *json, const char *key) -{ - json_object_t *object; - - if(!key || !json_is_object(json)) - return NULL; - - object = json_to_object(json); - return hashtable_iter_at(&object->hashtable, key); -} - -void *json_object_iter_next(json_t *json, void *iter) -{ - json_object_t *object; - - if(!json_is_object(json) || iter == NULL) - return NULL; - - object = json_to_object(json); - return hashtable_iter_next(&object->hashtable, iter); -} - -const char *json_object_iter_key(void *iter) -{ - if(!iter) - return NULL; - - return hashtable_iter_key(iter); -} - -json_t *json_object_iter_value(void *iter) -{ - if(!iter) - return NULL; - - return (json_t *)hashtable_iter_value(iter); -} - -int json_object_iter_set_new(json_t *json, void *iter, json_t *value) -{ - if(!json_is_object(json) || !iter || !value) - return -1; - - hashtable_iter_set(iter, value); - return 0; -} - -void *json_object_key_to_iter(const char *key) -{ - if(!key) - return NULL; - - return hashtable_key_to_iter(key); -} - -static int json_object_equal(json_t *object1, json_t *object2) -{ - const char *key; - json_t *value1, *value2; - - if(json_object_size(object1) != json_object_size(object2)) - return 0; - - json_object_foreach(object1, key, value1) { - value2 = json_object_get(object2, key); - - if(!json_equal(value1, value2)) - return 0; - } - - return 1; -} - -static json_t *json_object_copy(json_t *object) -{ - json_t *result; - - const char *key; - json_t *value; - - result = json_object(); - if(!result) - return NULL; - - json_object_foreach(object, key, value) - json_object_set_nocheck(result, key, value); - - return result; -} - -static json_t *json_object_deep_copy(const json_t *object) -{ - json_t *result; - void *iter; - - result = json_object(); - if(!result) - return NULL; - - /* Cannot use json_object_foreach because object has to be cast - non-const */ - iter = json_object_iter((json_t *)object); - while(iter) { - const char *key; - const json_t *value; - key = json_object_iter_key(iter); - value = json_object_iter_value(iter); - - json_object_set_new_nocheck(result, key, json_deep_copy(value)); - iter = json_object_iter_next((json_t *)object, iter); - } - - return result; -} - - -/*** array ***/ - -json_t *json_array(void) -{ - json_array_t *array = jsonp_malloc(sizeof(json_array_t)); - if(!array) - return NULL; - json_init(&array->json, JSON_ARRAY); - - array->entries = 0; - array->size = 8; - - array->table = jsonp_malloc(array->size * sizeof(json_t *)); - if(!array->table) { - jsonp_free(array); - return NULL; - } - - array->visited = 0; - - return &array->json; -} - -static void json_delete_array(json_array_t *array) -{ - size_t i; - - for(i = 0; i < array->entries; i++) - json_decref(array->table[i]); - - jsonp_free(array->table); - jsonp_free(array); -} - -size_t json_array_size(const json_t *json) -{ - if(!json_is_array(json)) - return 0; - - return json_to_array(json)->entries; -} - -json_t *json_array_get(const json_t *json, size_t index) -{ - json_array_t *array; - if(!json_is_array(json)) - return NULL; - array = json_to_array(json); - - if(index >= array->entries) - return NULL; - - return array->table[index]; -} - -int json_array_set_new(json_t *json, size_t index, json_t *value) -{ - json_array_t *array; - - if(!value) - return -1; - - if(!json_is_array(json) || json == value) - { - json_decref(value); - return -1; - } - array = json_to_array(json); - - if(index >= array->entries) - { - json_decref(value); - return -1; - } - - json_decref(array->table[index]); - array->table[index] = value; - - return 0; -} - -static void array_move(json_array_t *array, size_t dest, - size_t src, size_t count) -{ - memmove(&array->table[dest], &array->table[src], count * sizeof(json_t *)); -} - -static void array_copy(json_t **dest, size_t dpos, - json_t **src, size_t spos, - size_t count) -{ - memcpy(&dest[dpos], &src[spos], count * sizeof(json_t *)); -} - -static json_t **json_array_grow(json_array_t *array, - size_t amount, - int copy) -{ - size_t new_size; - json_t **old_table, **new_table; - - if(array->entries + amount <= array->size) - return array->table; - - old_table = array->table; - - new_size = max(array->size + amount, array->size * 2); - new_table = jsonp_malloc(new_size * sizeof(json_t *)); - if(!new_table) - return NULL; - - array->size = new_size; - array->table = new_table; - - if(copy) { - array_copy(array->table, 0, old_table, 0, array->entries); - jsonp_free(old_table); - return array->table; - } - - return old_table; -} - -int json_array_append_new(json_t *json, json_t *value) -{ - json_array_t *array; - - if(!value) - return -1; - - if(!json_is_array(json) || json == value) - { - json_decref(value); - return -1; - } - array = json_to_array(json); - - if(!json_array_grow(array, 1, 1)) { - json_decref(value); - return -1; - } - - array->table[array->entries] = value; - array->entries++; - - return 0; -} - -int json_array_insert_new(json_t *json, size_t index, json_t *value) -{ - json_array_t *array; - json_t **old_table; - - if(!value) - return -1; - - if(!json_is_array(json) || json == value) { - json_decref(value); - return -1; - } - array = json_to_array(json); - - if(index > array->entries) { - json_decref(value); - return -1; - } - - old_table = json_array_grow(array, 1, 0); - if(!old_table) { - json_decref(value); - return -1; - } - - if(old_table != array->table) { - array_copy(array->table, 0, old_table, 0, index); - array_copy(array->table, index + 1, old_table, index, - array->entries - index); - jsonp_free(old_table); - } - else - array_move(array, index + 1, index, array->entries - index); - - array->table[index] = value; - array->entries++; - - return 0; -} - -int json_array_remove(json_t *json, size_t index) -{ - json_array_t *array; - - if(!json_is_array(json)) - return -1; - array = json_to_array(json); - - if(index >= array->entries) - return -1; - - json_decref(array->table[index]); - - /* If we're removing the last element, nothing has to be moved */ - if(index < array->entries - 1) - array_move(array, index, index + 1, array->entries - index - 1); - - array->entries--; - - return 0; -} - -int json_array_clear(json_t *json) -{ - json_array_t *array; - size_t i; - - if(!json_is_array(json)) - return -1; - array = json_to_array(json); - - for(i = 0; i < array->entries; i++) - json_decref(array->table[i]); - - array->entries = 0; - return 0; -} - -int json_array_extend(json_t *json, json_t *other_json) -{ - json_array_t *array, *other; - size_t i; - - if(!json_is_array(json) || !json_is_array(other_json)) - return -1; - array = json_to_array(json); - other = json_to_array(other_json); - - if(!json_array_grow(array, other->entries, 1)) - return -1; - - for(i = 0; i < other->entries; i++) - json_incref(other->table[i]); - - array_copy(array->table, array->entries, other->table, 0, other->entries); - - array->entries += other->entries; - return 0; -} - -static int json_array_equal(json_t *array1, json_t *array2) -{ - size_t i, size; - - size = json_array_size(array1); - if(size != json_array_size(array2)) - return 0; - - for(i = 0; i < size; i++) - { - json_t *value1, *value2; - - value1 = json_array_get(array1, i); - value2 = json_array_get(array2, i); - - if(!json_equal(value1, value2)) - return 0; - } - - return 1; -} - -static json_t *json_array_copy(json_t *array) -{ - json_t *result; - size_t i; - - result = json_array(); - if(!result) - return NULL; - - for(i = 0; i < json_array_size(array); i++) - json_array_append(result, json_array_get(array, i)); - - return result; -} - -static json_t *json_array_deep_copy(const json_t *array) -{ - json_t *result; - size_t i; - - result = json_array(); - if(!result) - return NULL; - - for(i = 0; i < json_array_size(array); i++) - json_array_append_new(result, json_deep_copy(json_array_get(array, i))); - - return result; -} - -/*** string ***/ - -static json_t *string_create(const char *value, size_t len, int own) -{ - char *v; - json_string_t *string; - - if(!value) - return NULL; - - if(own) - v = (char *)value; - else { - v = jsonp_strndup(value, len); - if(!v) - return NULL; - } - - string = jsonp_malloc(sizeof(json_string_t)); - if(!string) { - if(!own) - jsonp_free(v); - return NULL; - } - json_init(&string->json, JSON_STRING); - string->value = v; - string->length = len; - - return &string->json; -} - -json_t *json_string_nocheck(const char *value) -{ - if(!value) - return NULL; - - return string_create(value, strlen(value), 0); -} - -json_t *json_stringn_nocheck(const char *value, size_t len) -{ - return string_create(value, len, 0); -} - -/* this is private; "steal" is not a public API concept */ -json_t *jsonp_stringn_nocheck_own(const char *value, size_t len) -{ - return string_create(value, len, 1); -} - -json_t *json_string(const char *value) -{ - if(!value) - return NULL; - - return json_stringn(value, strlen(value)); -} - -json_t *json_stringn(const char *value, size_t len) -{ - if(!value || !utf8_check_string(value, len)) - return NULL; - - return json_stringn_nocheck(value, len); -} - -const char *json_string_value(const json_t *json) -{ - if(!json_is_string(json)) - return NULL; - - return json_to_string(json)->value; -} - -size_t json_string_length(const json_t *json) -{ - if(!json_is_string(json)) - return 0; - - return json_to_string(json)->length; -} - -int json_string_set_nocheck(json_t *json, const char *value) -{ - if(!value) - return -1; - - return json_string_setn_nocheck(json, value, strlen(value)); -} - -int json_string_setn_nocheck(json_t *json, const char *value, size_t len) -{ - char *dup; - json_string_t *string; - - if(!json_is_string(json) || !value) - return -1; - - dup = jsonp_strndup(value, len); - if(!dup) - return -1; - - string = json_to_string(json); - jsonp_free(string->value); - string->value = dup; - string->length = len; - - return 0; -} - -int json_string_set(json_t *json, const char *value) -{ - if(!value) - return -1; - - return json_string_setn(json, value, strlen(value)); -} - -int json_string_setn(json_t *json, const char *value, size_t len) -{ - if(!value || !utf8_check_string(value, len)) - return -1; - - return json_string_setn_nocheck(json, value, len); -} - -static void json_delete_string(json_string_t *string) -{ - jsonp_free(string->value); - jsonp_free(string); -} - -static int json_string_equal(json_t *string1, json_t *string2) -{ - json_string_t *s1, *s2; - - if(!json_is_string(string1) || !json_is_string(string2)) - return 0; - - s1 = json_to_string(string1); - s2 = json_to_string(string2); - return s1->length == s2->length && !memcmp(s1->value, s2->value, s1->length); -} - -static json_t *json_string_copy(const json_t *string) -{ - json_string_t *s; - - if(!json_is_string(string)) - return NULL; - - s = json_to_string(string); - return json_stringn_nocheck(s->value, s->length); -} - - -/*** integer ***/ - -json_t *json_integer(json_int_t value) -{ - json_integer_t *integer = jsonp_malloc(sizeof(json_integer_t)); - if(!integer) - return NULL; - json_init(&integer->json, JSON_INTEGER); - - integer->value = value; - return &integer->json; -} - -json_int_t json_integer_value(const json_t *json) -{ - if(!json_is_integer(json)) - return 0; - - return json_to_integer(json)->value; -} - -int json_integer_set(json_t *json, json_int_t value) -{ - if(!json_is_integer(json)) - return -1; - - json_to_integer(json)->value = value; - - return 0; -} - -static void json_delete_integer(json_integer_t *integer) -{ - jsonp_free(integer); -} - -static int json_integer_equal(json_t *integer1, json_t *integer2) -{ - return json_integer_value(integer1) == json_integer_value(integer2); -} - -static json_t *json_integer_copy(const json_t *integer) -{ - return json_integer(json_integer_value(integer)); -} - - -/*** real ***/ - -json_t *json_real(double value) -{ - json_real_t *real; - - if(isnan(value) || isinf(value)) - return NULL; - - real = jsonp_malloc(sizeof(json_real_t)); - if(!real) - return NULL; - json_init(&real->json, JSON_REAL); - - real->value = value; - return &real->json; -} - -double json_real_value(const json_t *json) -{ - if(!json_is_real(json)) - return 0; - - return json_to_real(json)->value; -} - -int json_real_set(json_t *json, double value) -{ - if(!json_is_real(json) || isnan(value) || isinf(value)) - return -1; - - json_to_real(json)->value = value; - - return 0; -} - -static void json_delete_real(json_real_t *real) -{ - jsonp_free(real); -} - -static int json_real_equal(json_t *real1, json_t *real2) -{ - return json_real_value(real1) == json_real_value(real2); -} - -static json_t *json_real_copy(const json_t *real) -{ - return json_real(json_real_value(real)); -} - - -/*** number ***/ - -double json_number_value(const json_t *json) -{ - if(json_is_integer(json)) - return (double)json_integer_value(json); - else if(json_is_real(json)) - return json_real_value(json); - else - return 0.0; -} - - -/*** simple values ***/ - -json_t *json_true(void) -{ - static json_t the_true = {JSON_TRUE, (size_t)-1}; - return &the_true; -} - - -json_t *json_false(void) -{ - static json_t the_false = {JSON_FALSE, (size_t)-1}; - return &the_false; -} - - -json_t *json_null(void) -{ - static json_t the_null = {JSON_NULL, (size_t)-1}; - return &the_null; -} - - -/*** deletion ***/ - -void json_delete(json_t *json) -{ - if (!json) - return; - - switch(json_typeof(json)) { - case JSON_OBJECT: - json_delete_object(json_to_object(json)); - break; - case JSON_ARRAY: - json_delete_array(json_to_array(json)); - break; - case JSON_STRING: - json_delete_string(json_to_string(json)); - break; - case JSON_INTEGER: - json_delete_integer(json_to_integer(json)); - break; - case JSON_REAL: - json_delete_real(json_to_real(json)); - break; - default: - return; - } - - /* json_delete is not called for true, false or null */ -} - - -/*** equality ***/ - -int json_equal(json_t *json1, json_t *json2) -{ - if(!json1 || !json2) - return 0; - - if(json_typeof(json1) != json_typeof(json2)) - return 0; - - /* this covers true, false and null as they are singletons */ - if(json1 == json2) - return 1; - - switch(json_typeof(json1)) { - case JSON_OBJECT: - return json_object_equal(json1, json2); - case JSON_ARRAY: - return json_array_equal(json1, json2); - case JSON_STRING: - return json_string_equal(json1, json2); - case JSON_INTEGER: - return json_integer_equal(json1, json2); - case JSON_REAL: - return json_real_equal(json1, json2); - default: - return 0; - } -} - - -/*** copying ***/ - -json_t *json_copy(json_t *json) -{ - if(!json) - return NULL; - - switch(json_typeof(json)) { - case JSON_OBJECT: - return json_object_copy(json); - case JSON_ARRAY: - return json_array_copy(json); - case JSON_STRING: - return json_string_copy(json); - case JSON_INTEGER: - return json_integer_copy(json); - case JSON_REAL: - return json_real_copy(json); - case JSON_TRUE: - case JSON_FALSE: - case JSON_NULL: - return json; - default: - return NULL; - } - - return NULL; -} - -json_t *json_deep_copy(const json_t *json) -{ - if(!json) - return NULL; - - switch(json_typeof(json)) { - case JSON_OBJECT: - return json_object_deep_copy(json); - case JSON_ARRAY: - return json_array_deep_copy(json); - /* for the rest of the types, deep copying doesn't differ from - shallow copying */ - case JSON_STRING: - return json_string_copy(json); - case JSON_INTEGER: - return json_integer_copy(json); - case JSON_REAL: - return json_real_copy(json); - case JSON_TRUE: - case JSON_FALSE: - case JSON_NULL: - return (json_t *)json; - default: - return NULL; - } - - return NULL; -} diff --git a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/META-INF/MANIFEST.MF b/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/META-INF/MANIFEST.MF deleted file mode 100644 index f6539c8a8..000000000 --- a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: TestJSONParsing -Class-Path: com.leastfixedpoint.json-1.0.jar diff --git a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/README.txt b/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/README.txt deleted file mode 100644 index d3d26ee9e..000000000 --- a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -javac -cp ".:com.leastfixedpoint.json-1.0.jar" TestJSONParsing.java - -jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF com.leastfixedpoint.json-1.0.jar TestJSONParsing.class - -java -jar TestJSONParsing.jar diff --git a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.class b/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.class deleted file mode 100644 index d2ca73ee1..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.class and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jar b/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jar deleted file mode 100644 index d23edf247..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.java b/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.java deleted file mode 100644 index eecb9b1e6..000000000 --- a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.java +++ /dev/null @@ -1,40 +0,0 @@ -import java.nio.charset.StandardCharsets; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; - -import com.leastfixedpoint.json.*; - -public class TestJSONParsing { - public static boolean isValidJSON(String s) { - try { - Object obj = JSONReader.readFrom(s); - System.out.println(obj); - System.out.println(obj.getClass().getSimpleName()); - return true; - } catch (IOException e) { - System.out.println(e); - return false; - } - } - - public static void main(String[] args) { - if(args.length == 0) { - System.out.println("Usage: java TestJSONParsing file.json"); - System.exit(2); - } - - try { - String s = new String(Files.readAllBytes(Paths.get(args[0]))); - if(isValidJSON(s)) { - System.out.println("valid"); - System.exit(0); - } - System.out.println("invalid"); - System.exit(1); - } catch (IOException e) { - System.out.println("not found"); - System.exit(2); - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/com.leastfixedpoint.json-1.0.jar b/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/com.leastfixedpoint.json-1.0.jar deleted file mode 100644 index e8af84609..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_com_leastfixedpoint_json_1_0/com.leastfixedpoint.json-1.0.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_gson_2_7/META-INF/MANIFEST.MF b/tests/JSONTestSuite/parsers/test_java_gson_2_7/META-INF/MANIFEST.MF deleted file mode 100644 index 1f7a2ad77..000000000 --- a/tests/JSONTestSuite/parsers/test_java_gson_2_7/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: TestJSONParsing -Class-Path: gson-2.7.jar diff --git a/tests/JSONTestSuite/parsers/test_java_gson_2_7/README.txt b/tests/JSONTestSuite/parsers/test_java_gson_2_7/README.txt deleted file mode 100644 index b05b25f9b..000000000 --- a/tests/JSONTestSuite/parsers/test_java_gson_2_7/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -javac -cp ".:gson-2.7.jar" TestJSONParsing.java - -jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF gson-2.7.jar TestJSONParsing.class - -java -jar TestJSONParsing.jar diff --git a/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.class b/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.class deleted file mode 100644 index 7e15cc091..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.class and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.jar b/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.jar deleted file mode 100644 index 09220dd0f..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.java b/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.java deleted file mode 100644 index 4e2190020..000000000 --- a/tests/JSONTestSuite/parsers/test_java_gson_2_7/TestJSONParsing.java +++ /dev/null @@ -1,51 +0,0 @@ -// javac -cp ".:gson-2.7.jar" TestJSONParsing.java && java -classpath ".:gson-2.7.jar" TestJSONParsing x.json - -import java.nio.charset.StandardCharsets; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; - -public class TestJSONParsing { - - public static boolean isValidJSON(String s) { - try { - - //GsonBuilder builder = new GsonBuilder(); - //Object obj = builder.create().fromJson(s, Object.class); - - Gson gson = new Gson(); - Object obj = gson.fromJson(s, Object.class); - System.out.println(obj); - System.out.println(obj.getClass().getSimpleName()); - return true; - } catch (JsonParseException e) { - System.out.println(e); - return false; - } - } - - public static void main(String[] args) { - - if(args.length == 0) { - System.out.println("Usage: java TestJSONParsing file.json"); - System.exit(2); - } - - try { - String s = new String(Files.readAllBytes(Paths.get(args[0]))); - if(isValidJSON(s)) { - System.out.println("valid"); - System.exit(0); - } - System.out.println("invalid"); - System.exit(1); - } catch (IOException e) { - System.out.println("not found"); - System.exit(2); - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_java_gson_2_7/gson-2.7.jar b/tests/JSONTestSuite/parsers/test_java_gson_2_7/gson-2.7.jar deleted file mode 100644 index be5b59b76..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_gson_2_7/gson-2.7.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/META-INF/MANIFEST.MF b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/META-INF/MANIFEST.MF deleted file mode 100644 index 0e802be7f..000000000 --- a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: TestJSONParsing -Class-Path: jackson-core-2.8.4.jar jackson-databind-2.3.1.jar jackson-annotations-2.2.3.jar diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/README.txt b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/README.txt deleted file mode 100644 index 5bb6beeae..000000000 --- a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -javac -cp ".:jackson-core-2.8.4.jar:jackson-databind-2.3.1.jar:jackson-annotations-2.2.3.jar" TestJSONParsing.java - -jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF jackson-core-2.8.4.jar jackson-databind-2.3.1.jar jackson-annotations-2.2.3.jar TestJSONParsing.class - -java -jar TestJSONParsing.jar diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.class b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.class deleted file mode 100644 index a9885b5c6..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.class and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.jar b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.jar deleted file mode 100644 index b6f340d67..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.java b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.java deleted file mode 100644 index 95e49a105..000000000 --- a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/TestJSONParsing.java +++ /dev/null @@ -1,48 +0,0 @@ -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; - -import java.io.File; -import java.util.Map; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.annotation.JsonAutoDetect; - -public class TestJSONParsing { - - public static boolean isValidJSON(String s) { - try { - JsonFactory factory = new JsonFactory(); - ObjectMapper mapper = new ObjectMapper(factory); - JsonNode rootNode = mapper.readTree(s); - return rootNode != null; - } catch (Exception e) { - System.out.println(e); - return false; - } - } - - public static void main(String[] args) { - - if(args.length == 0) { - System.out.println("Usage: java TestJSONParsing file.json"); - System.exit(2); - } - - try { - String s = new String(Files.readAllBytes(Paths.get(args[0]))); - if(isValidJSON(s)) { - System.out.println("valid"); - System.exit(0); - } - System.out.println("invalid"); - System.exit(1); - } catch (IOException e) { - System.out.println("not found"); - System.exit(2); - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-annotations-2.2.3.jar b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-annotations-2.2.3.jar deleted file mode 100755 index b62c87d7e..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-annotations-2.2.3.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-core-2.8.4.jar b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-core-2.8.4.jar deleted file mode 100644 index 352bd5dbf..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-core-2.8.4.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-databind-2.3.1.jar b/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-databind-2.3.1.jar deleted file mode 100644 index a8d35c06a..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_jackson_2_8_4/jackson-databind-2.3.1.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/META-INF/MANIFEST.MF b/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/META-INF/MANIFEST.MF deleted file mode 100644 index d7a40b9fc..000000000 --- a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: TestJSONParsing -Class-Path: nanojson-1.0.jar diff --git a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/README.txt b/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/README.txt deleted file mode 100644 index 3719d2cf0..000000000 --- a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -javac -cp ".:nanojson-1.0.jar" TestJSONParsing.java - -jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF nanojson-1.0.jar TestJSONParsing.class - -java -jar TestJSONParsing.jar diff --git a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.class b/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.class deleted file mode 100644 index 8c9beb625..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.class and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.jar b/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.jar deleted file mode 100644 index bc495a7a8..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.java b/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.java deleted file mode 100644 index 34b8cf378..000000000 --- a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/TestJSONParsing.java +++ /dev/null @@ -1,45 +0,0 @@ -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; - -import java.io.File; -import java.util.Map; - -import com.grack.nanojson.JsonParser; - -public class TestJSONParsing { - - public static boolean isValidJSON(byte[] b) { - try { - Object o = JsonParser.any().from(new ByteArrayInputStream(b)); - if (new String(b).trim().equals("null")) - return o == null; - return o != null; - } catch (Exception e) { - System.out.println(e); - return false; - } - } - - public static void main(String[] args) { - - if (args.length == 0) { - System.out.println("Usage: java TestJSONParsing file.json"); - System.exit(2); - } - - try { - byte[] b = Files.readAllBytes(Paths.get(args[0])); - if(isValidJSON(b)) { - System.out.println("valid"); - System.exit(0); - } - System.out.println("invalid"); - System.exit(1); - } catch (IOException e) { - System.out.println("not found"); - System.exit(2); - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/nanojson-1.0.jar b/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/nanojson-1.0.jar deleted file mode 100644 index d745a49aa..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_nanojson_1_0/nanojson-1.0.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/META-INF/MANIFEST.MF b/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/META-INF/MANIFEST.MF deleted file mode 100644 index 5dee98d72..000000000 --- a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: TestJSONParsing -Class-Path: json-simple-1.1.1.jar diff --git a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/README.txt b/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/README.txt deleted file mode 100644 index e82d6face..000000000 --- a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF json-simple-1.1.1.jar TestJSONParsing.class - -java -jar TestJSONParsing.jar diff --git a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.class b/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.class deleted file mode 100644 index 8890cfbfd..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.class and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.jar b/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.jar deleted file mode 100644 index 3642212e6..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.java b/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.java deleted file mode 100644 index 662a33d89..000000000 --- a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/TestJSONParsing.java +++ /dev/null @@ -1,43 +0,0 @@ -// javac -cp ".:json-simple-1.1.1.jar" TestJSONParsing.java && java -classpath ".:json-simple-1.1.1.jar" TestJSONParsing x.json - -import org.json.simple.parser.ParseException; -import org.json.simple.parser.JSONParser; -import java.nio.charset.StandardCharsets; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; - -public class TestJSONParsing { - - public static boolean isValidJSON(String s) { - try { - JSONParser parser = new JSONParser(); - Object obj = parser.parse(s); - } catch (ParseException pe) { - System.out.println(pe); - return false; - } - return true; - } - - public static void main(String[] args) { - - if(args.length == 0) { - System.out.println("Usage: java TestJSONParsing file.json"); - System.exit(2); - } - - try { - String s = new String(Files.readAllBytes(Paths.get(args[0]))); - if(isValidJSON(s)) { - System.out.println("valid"); - System.exit(0); - } - System.out.println("invalid"); - System.exit(1); - } catch (IOException e) { - System.out.println("not found"); - System.exit(2); - } - } -} diff --git a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/json-simple-1.1.1.jar b/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/json-simple-1.1.1.jar deleted file mode 100644 index 66347a6c8..000000000 Binary files a/tests/JSONTestSuite/parsers/test_java_simple_json_1_1_1/json-simple-1.1.1.jar and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsmn/bin/test_jsmn b/tests/JSONTestSuite/parsers/test_jsmn/bin/test_jsmn deleted file mode 100755 index a4d692886..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jsmn/bin/test_jsmn and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsmn/jsmn.c b/tests/JSONTestSuite/parsers/test_jsmn/jsmn.c deleted file mode 100644 index e7765eb1d..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/jsmn.c +++ /dev/null @@ -1,311 +0,0 @@ -#include "jsmn.h" - -/** - * Allocates a fresh unused token from the token pull. - */ -static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser, - jsmntok_t *tokens, size_t num_tokens) { - jsmntok_t *tok; - if (parser->toknext >= num_tokens) { - return NULL; - } - tok = &tokens[parser->toknext++]; - tok->start = tok->end = -1; - tok->size = 0; -#ifdef JSMN_PARENT_LINKS - tok->parent = -1; -#endif - return tok; -} - -/** - * Fills token type and boundaries. - */ -static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, - int start, int end) { - token->type = type; - token->start = start; - token->end = end; - token->size = 0; -} - -/** - * Fills next available token with JSON primitive. - */ -static int jsmn_parse_primitive(jsmn_parser *parser, const char *js, - size_t len, jsmntok_t *tokens, size_t num_tokens) { - jsmntok_t *token; - int start; - - start = parser->pos; - - for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) { - switch (js[parser->pos]) { -#ifndef JSMN_STRICT - /* In strict mode primitive must be followed by "," or "}" or "]" */ - case ':': -#endif - case '\t' : case '\r' : case '\n' : case ' ' : - case ',' : case ']' : case '}' : - goto found; - } - if (js[parser->pos] < 32 || js[parser->pos] >= 127) { - parser->pos = start; - return JSMN_ERROR_INVAL; - } - } -#ifdef JSMN_STRICT - /* In strict mode primitive must be followed by a comma/object/array */ - parser->pos = start; - return JSMN_ERROR_PART; -#endif - -found: - if (tokens == NULL) { - parser->pos--; - return 0; - } - token = jsmn_alloc_token(parser, tokens, num_tokens); - if (token == NULL) { - parser->pos = start; - return JSMN_ERROR_NOMEM; - } - jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos); -#ifdef JSMN_PARENT_LINKS - token->parent = parser->toksuper; -#endif - parser->pos--; - return 0; -} - -/** - * Fills next token with JSON string. - */ -static int jsmn_parse_string(jsmn_parser *parser, const char *js, - size_t len, jsmntok_t *tokens, size_t num_tokens) { - jsmntok_t *token; - - int start = parser->pos; - - parser->pos++; - - /* Skip starting quote */ - for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) { - char c = js[parser->pos]; - - /* Quote: end of string */ - if (c == '\"') { - if (tokens == NULL) { - return 0; - } - token = jsmn_alloc_token(parser, tokens, num_tokens); - if (token == NULL) { - parser->pos = start; - return JSMN_ERROR_NOMEM; - } - jsmn_fill_token(token, JSMN_STRING, start+1, parser->pos); -#ifdef JSMN_PARENT_LINKS - token->parent = parser->toksuper; -#endif - return 0; - } - - /* Backslash: Quoted symbol expected */ - if (c == '\\' && parser->pos + 1 < len) { - int i; - parser->pos++; - switch (js[parser->pos]) { - /* Allowed escaped symbols */ - case '\"': case '/' : case '\\' : case 'b' : - case 'f' : case 'r' : case 'n' : case 't' : - break; - /* Allows escaped symbol \uXXXX */ - case 'u': - parser->pos++; - for(i = 0; i < 4 && parser->pos < len && js[parser->pos] != '\0'; i++) { - /* If it isn't a hex character we have an error */ - if(!((js[parser->pos] >= 48 && js[parser->pos] <= 57) || /* 0-9 */ - (js[parser->pos] >= 65 && js[parser->pos] <= 70) || /* A-F */ - (js[parser->pos] >= 97 && js[parser->pos] <= 102))) { /* a-f */ - parser->pos = start; - return JSMN_ERROR_INVAL; - } - parser->pos++; - } - parser->pos--; - break; - /* Unexpected symbol */ - default: - parser->pos = start; - return JSMN_ERROR_INVAL; - } - } - } - parser->pos = start; - return JSMN_ERROR_PART; -} - -/** - * Parse JSON string and fill tokens. - */ -int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, - jsmntok_t *tokens, unsigned int num_tokens) { - int r; - int i; - jsmntok_t *token; - int count = parser->toknext; - - for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) { - char c; - jsmntype_t type; - - c = js[parser->pos]; - switch (c) { - case '{': case '[': - count++; - if (tokens == NULL) { - break; - } - token = jsmn_alloc_token(parser, tokens, num_tokens); - if (token == NULL) - return JSMN_ERROR_NOMEM; - if (parser->toksuper != -1) { - tokens[parser->toksuper].size++; -#ifdef JSMN_PARENT_LINKS - token->parent = parser->toksuper; -#endif - } - token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY); - token->start = parser->pos; - parser->toksuper = parser->toknext - 1; - break; - case '}': case ']': - if (tokens == NULL) - break; - type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY); -#ifdef JSMN_PARENT_LINKS - if (parser->toknext < 1) { - return JSMN_ERROR_INVAL; - } - token = &tokens[parser->toknext - 1]; - for (;;) { - if (token->start != -1 && token->end == -1) { - if (token->type != type) { - return JSMN_ERROR_INVAL; - } - token->end = parser->pos + 1; - parser->toksuper = token->parent; - break; - } - if (token->parent == -1) { - break; - } - token = &tokens[token->parent]; - } -#else - for (i = parser->toknext - 1; i >= 0; i--) { - token = &tokens[i]; - if (token->start != -1 && token->end == -1) { - if (token->type != type) { - return JSMN_ERROR_INVAL; - } - parser->toksuper = -1; - token->end = parser->pos + 1; - break; - } - } - /* Error if unmatched closing bracket */ - if (i == -1) return JSMN_ERROR_INVAL; - for (; i >= 0; i--) { - token = &tokens[i]; - if (token->start != -1 && token->end == -1) { - parser->toksuper = i; - break; - } - } -#endif - break; - case '\"': - r = jsmn_parse_string(parser, js, len, tokens, num_tokens); - if (r < 0) return r; - count++; - if (parser->toksuper != -1 && tokens != NULL) - tokens[parser->toksuper].size++; - break; - case '\t' : case '\r' : case '\n' : case ' ': - break; - case ':': - parser->toksuper = parser->toknext - 1; - break; - case ',': - if (tokens != NULL && parser->toksuper != -1 && - tokens[parser->toksuper].type != JSMN_ARRAY && - tokens[parser->toksuper].type != JSMN_OBJECT) { -#ifdef JSMN_PARENT_LINKS - parser->toksuper = tokens[parser->toksuper].parent; -#else - for (i = parser->toknext - 1; i >= 0; i--) { - if (tokens[i].type == JSMN_ARRAY || tokens[i].type == JSMN_OBJECT) { - if (tokens[i].start != -1 && tokens[i].end == -1) { - parser->toksuper = i; - break; - } - } - } -#endif - } - break; -#ifdef JSMN_STRICT - /* In strict mode primitives are: numbers and booleans */ - case '-': case '0': case '1' : case '2': case '3' : case '4': - case '5': case '6': case '7' : case '8': case '9': - case 't': case 'f': case 'n' : - /* And they must not be keys of the object */ - if (tokens != NULL && parser->toksuper != -1) { - jsmntok_t *t = &tokens[parser->toksuper]; - if (t->type == JSMN_OBJECT || - (t->type == JSMN_STRING && t->size != 0)) { - return JSMN_ERROR_INVAL; - } - } -#else - /* In non-strict mode every unquoted value is a primitive */ - default: -#endif - r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens); - if (r < 0) return r; - count++; - if (parser->toksuper != -1 && tokens != NULL) - tokens[parser->toksuper].size++; - break; - -#ifdef JSMN_STRICT - /* Unexpected char in strict mode */ - default: - return JSMN_ERROR_INVAL; -#endif - } - } - - if (tokens != NULL) { - for (i = parser->toknext - 1; i >= 0; i--) { - /* Unmatched opened object or array */ - if (tokens[i].start != -1 && tokens[i].end == -1) { - return JSMN_ERROR_PART; - } - } - } - - return count; -} - -/** - * Creates a new parser based over a given buffer with an array of tokens - * available. - */ -void jsmn_init(jsmn_parser *parser) { - parser->pos = 0; - parser->toknext = 0; - parser->toksuper = -1; -} - diff --git a/tests/JSONTestSuite/parsers/test_jsmn/jsmn.h b/tests/JSONTestSuite/parsers/test_jsmn/jsmn.h deleted file mode 100644 index 1a952fd36..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/jsmn.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __JSMN_H_ -#define __JSMN_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * JSON type identifier. Basic types are: - * o Object - * o Array - * o String - * o Other primitive: number, boolean (true/false) or null - */ -typedef enum { - JSMN_UNDEFINED = 0, - JSMN_OBJECT = 1, - JSMN_ARRAY = 2, - JSMN_STRING = 3, - JSMN_PRIMITIVE = 4 -} jsmntype_t; - -enum jsmnerr { - /* Not enough tokens were provided */ - JSMN_ERROR_NOMEM = -1, - /* Invalid character inside JSON string */ - JSMN_ERROR_INVAL = -2, - /* The string is not a full JSON packet, more bytes expected */ - JSMN_ERROR_PART = -3 -}; - -/** - * JSON token description. - * @param type type (object, array, string etc.) - * @param start start position in JSON data string - * @param end end position in JSON data string - */ -typedef struct { - jsmntype_t type; - int start; - int end; - int size; -#ifdef JSMN_PARENT_LINKS - int parent; -#endif -} jsmntok_t; - -/** - * JSON parser. Contains an array of token blocks available. Also stores - * the string being parsed now and current position in that string - */ -typedef struct { - unsigned int pos; /* offset in the JSON string */ - unsigned int toknext; /* next token to allocate */ - int toksuper; /* superior token node, e.g parent object or array */ -} jsmn_parser; - -/** - * Create JSON parser over an array of tokens - */ -void jsmn_init(jsmn_parser *parser); - -/** - * Run JSON parser. It parses a JSON data string into and array of tokens, each describing - * a single JSON object. - */ -int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, - jsmntok_t *tokens, unsigned int num_tokens); - -#ifdef __cplusplus -} -#endif - -#endif /* __JSMN_H_ */ diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.pbxproj deleted file mode 100644 index 7717a4477..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.pbxproj +++ /dev/null @@ -1,253 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0334F6B81D761B8F00A98A0A /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 0334F6B71D761B8F00A98A0A /* main.c */; }; - 034CE4211D761BAD00AD9F7B /* jsmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 034CE41F1D761BAD00AD9F7B /* jsmn.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 0334F6B21D761B8F00A98A0A /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0334F6B41D761B8F00A98A0A /* test_jsmn */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_jsmn; sourceTree = BUILT_PRODUCTS_DIR; }; - 0334F6B71D761B8F00A98A0A /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 034CE41F1D761BAD00AD9F7B /* jsmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = jsmn.c; path = ../jsmn.c; sourceTree = ""; }; - 034CE4201D761BAD00AD9F7B /* jsmn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsmn.h; path = ../jsmn.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0334F6B11D761B8F00A98A0A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0334F6AB1D761B8F00A98A0A = { - isa = PBXGroup; - children = ( - 034CE4201D761BAD00AD9F7B /* jsmn.h */, - 034CE41F1D761BAD00AD9F7B /* jsmn.c */, - 0334F6B61D761B8F00A98A0A /* test_jsmn */, - 0334F6B51D761B8F00A98A0A /* Products */, - ); - sourceTree = ""; - }; - 0334F6B51D761B8F00A98A0A /* Products */ = { - isa = PBXGroup; - children = ( - 0334F6B41D761B8F00A98A0A /* test_jsmn */, - ); - name = Products; - sourceTree = ""; - }; - 0334F6B61D761B8F00A98A0A /* test_jsmn */ = { - isa = PBXGroup; - children = ( - 0334F6B71D761B8F00A98A0A /* main.c */, - ); - path = test_jsmn; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 0334F6B31D761B8F00A98A0A /* test_jsmn */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0334F6BB1D761B8F00A98A0A /* Build configuration list for PBXNativeTarget "test_jsmn" */; - buildPhases = ( - 0334F6B01D761B8F00A98A0A /* Sources */, - 0334F6B11D761B8F00A98A0A /* Frameworks */, - 0334F6B21D761B8F00A98A0A /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = test_jsmn; - productName = test_jsmn; - productReference = 0334F6B41D761B8F00A98A0A /* test_jsmn */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0334F6AC1D761B8F00A98A0A /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 0334F6B31D761B8F00A98A0A = { - CreatedOnToolsVersion = 7.3; - }; - }; - }; - buildConfigurationList = 0334F6AF1D761B8F00A98A0A /* Build configuration list for PBXProject "test_jsmn" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 0334F6AB1D761B8F00A98A0A; - productRefGroup = 0334F6B51D761B8F00A98A0A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 0334F6B31D761B8F00A98A0A /* test_jsmn */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 0334F6B01D761B8F00A98A0A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0334F6B81D761B8F00A98A0A /* main.c in Sources */, - 034CE4211D761BAD00AD9F7B /* jsmn.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 0334F6B91D761B8F00A98A0A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 0334F6BA1D761B8F00A98A0A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 0334F6BC1D761B8F00A98A0A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 0334F6BD1D761B8F00A98A0A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0334F6AF1D761B8F00A98A0A /* Build configuration list for PBXProject "test_jsmn" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0334F6B91D761B8F00A98A0A /* Debug */, - 0334F6BA1D761B8F00A98A0A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0334F6BB1D761B8F00A98A0A /* Build configuration list for PBXNativeTarget "test_jsmn" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0334F6BC1D761B8F00A98A0A /* Debug */, - 0334F6BD1D761B8F00A98A0A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0334F6AC1D761B8F00A98A0A /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 657d1a2be..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 98c7cec4c..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index 1ffbdb090..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_jsmn.xcscheme b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_jsmn.xcscheme deleted file mode 100644 index caebf4424..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_jsmn.xcscheme +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index eda200366..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_jsmn.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 0334F6B31D761B8F00A98A0A - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn/main.c b/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn/main.c deleted file mode 100644 index 0152649a7..000000000 --- a/tests/JSONTestSuite/parsers/test_jsmn/test_jsmn/test_jsmn/main.c +++ /dev/null @@ -1,50 +0,0 @@ -// -// main.c -// test_jsmn -// -// Created by nst on 30/08/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#include -#include -#include -#include -#include -#include -#include "jsmn.h" - -#define JSMN_STRICT 1 - -int testFile(const char *filename) { - - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return -1; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - - jsmn_parser p; - jsmntok_t tokens[128]; // a number >= total number of tokens - - jsmn_init(&p); - int resultCode = jsmn_parse(&p, data, 100, tokens, 50); - //printf("-- %d\n", resultCode); - - free(data); - - return resultCode; -} - -int main(int argc, const char * argv[]) { - - int resultCode = testFile(argv[1]); - - if (resultCode > 0) return 0; - if (resultCode <= 0) return 1; // error - return resultCode; -} diff --git a/tests/JSONTestSuite/parsers/test_json-jq.py b/tests/JSONTestSuite/parsers/test_json-jq.py deleted file mode 100644 index 109873f32..000000000 --- a/tests/JSONTestSuite/parsers/test_json-jq.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -import os -import subprocess -import sys - -jq_paths = ["/usr/local/bin/jq", "/Users/nst/bin/jq"] -dir_path = "/Users/nst/Projects/dropbox/JSON/test_cases/" - -existing_jq_paths = [p for p in jq_paths if os.path.exists(p)] - -if len(existing_jq_paths) == 0: - print "-- cannot find jq" - sys.exit(1) -jq = existing_jq_paths[0] - -for root, dirs, files in os.walk(dir_path): - json_files = (f for f in files if f.endswith(".json")) - for filename in json_files: - path = os.path.join(root, filename) - - print "*"*80 - print path - - parsing_success = subprocess.call([jq, ".", path]) == 0 - - if filename.startswith("y_") and parsing_success == False: - print "jq\tSHOULD_HAVE_PASSED\t%s" % (filename) - elif filename.startswith("n_") and parsing_success == True: - print "jq\tSHOULD_HAVE_FAILED\t%s" % (filename) - elif filename.startswith("i_") and parsing_success == True: - print "jq\tIMPLEMENTATION_PASS\t%s" % (filename) - elif filename.startswith("i_") and parsing_success == False: - print "jq\tIMPLEMENTATION_FAIL\t%s" % (filename) diff --git a/tests/JSONTestSuite/parsers/test_json-parser/bin/test_json-parser b/tests/JSONTestSuite/parsers/test_json-parser/bin/test_json-parser deleted file mode 100755 index b36bee683..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-parser/bin/test_json-parser and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.pbxproj deleted file mode 100644 index 9814c663a..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.pbxproj +++ /dev/null @@ -1,258 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03B1DD251D566DF600FEDE27 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD241D566DF600FEDE27 /* main.c */; }; - 03B1DD301D567B1400FEDE27 /* json.c in Sources */ = {isa = PBXBuildFile; fileRef = 03B1DD2E1D567B1400FEDE27 /* json.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03B1DD1F1D566DF600FEDE27 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03B1DD211D566DF600FEDE27 /* test_json-parser */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "test_json-parser"; sourceTree = BUILT_PRODUCTS_DIR; }; - 03B1DD241D566DF600FEDE27 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 03B1DD2E1D567B1400FEDE27 /* json.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = json.c; path = "test_json-parser/json.c"; sourceTree = ""; }; - 03B1DD2F1D567B1400FEDE27 /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json.h; path = "test_json-parser/json.h"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03B1DD1E1D566DF600FEDE27 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03B1DD181D566DF600FEDE27 = { - isa = PBXGroup; - children = ( - 03B1DD2F1D567B1400FEDE27 /* json.h */, - 03B1DD2E1D567B1400FEDE27 /* json.c */, - 03B1DD231D566DF600FEDE27 /* test_json-parser */, - 03B1DD221D566DF600FEDE27 /* Products */, - ); - sourceTree = ""; - }; - 03B1DD221D566DF600FEDE27 /* Products */ = { - isa = PBXGroup; - children = ( - 03B1DD211D566DF600FEDE27 /* test_json-parser */, - ); - name = Products; - sourceTree = ""; - }; - 03B1DD231D566DF600FEDE27 /* test_json-parser */ = { - isa = PBXGroup; - children = ( - 03B1DD241D566DF600FEDE27 /* main.c */, - ); - path = "test_json-parser"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03B1DD201D566DF600FEDE27 /* test_json-parser */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03B1DD281D566DF600FEDE27 /* Build configuration list for PBXNativeTarget "test_json-parser" */; - buildPhases = ( - 03B1DD1D1D566DF600FEDE27 /* Sources */, - 03B1DD1E1D566DF600FEDE27 /* Frameworks */, - 03B1DD1F1D566DF600FEDE27 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "test_json-parser"; - productName = "test_json-parser"; - productReference = 03B1DD211D566DF600FEDE27 /* test_json-parser */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03B1DD191D566DF600FEDE27 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03B1DD201D566DF600FEDE27 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = VBYRKYS73S; - DevelopmentTeamName = "Nicolas Seriot"; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 03B1DD1C1D566DF600FEDE27 /* Build configuration list for PBXProject "test_json-parser" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03B1DD181D566DF600FEDE27; - productRefGroup = 03B1DD221D566DF600FEDE27 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03B1DD201D566DF600FEDE27 /* test_json-parser */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03B1DD1D1D566DF600FEDE27 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03B1DD251D566DF600FEDE27 /* main.c in Sources */, - 03B1DD301D567B1400FEDE27 /* json.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03B1DD261D566DF600FEDE27 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03B1DD271D566DF600FEDE27 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03B1DD291D566DF600FEDE27 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03B1DD2A1D566DF600FEDE27 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03B1DD1C1D566DF600FEDE27 /* Build configuration list for PBXProject "test_json-parser" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03B1DD261D566DF600FEDE27 /* Debug */, - 03B1DD271D566DF600FEDE27 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03B1DD281D566DF600FEDE27 /* Build configuration list for PBXNativeTarget "test_json-parser" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03B1DD291D566DF600FEDE27 /* Debug */, - 03B1DD2A1D566DF600FEDE27 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03B1DD191D566DF600FEDE27 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3fce9f80e..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index da0a9d009..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_json-parser.xcscheme b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_json-parser.xcscheme deleted file mode 100644 index b956d4cc0..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/test_json-parser.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 5d0388918..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - test_json-parser.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03B1DD201D566DF600FEDE27 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/json.c b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/json.c deleted file mode 100644 index 6012bad7d..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/json.c +++ /dev/null @@ -1,1011 +0,0 @@ -/* vim: set et ts=3 sw=3 sts=3 ft=c: - * - * Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "json.h" - -#ifdef _MSC_VER - #ifndef _CRT_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_WARNINGS - #endif -#endif - -const struct _json_value json_value_none; - -#include -#include -#include -#include - -typedef unsigned int json_uchar; - -static unsigned char hex_value (json_char c) -{ - if (isdigit(c)) - return c - '0'; - - switch (c) { - case 'a': case 'A': return 0x0A; - case 'b': case 'B': return 0x0B; - case 'c': case 'C': return 0x0C; - case 'd': case 'D': return 0x0D; - case 'e': case 'E': return 0x0E; - case 'f': case 'F': return 0x0F; - default: return 0xFF; - } -} - -typedef struct -{ - unsigned long used_memory; - - unsigned int uint_max; - unsigned long ulong_max; - - json_settings settings; - int first_pass; - - const json_char * ptr; - unsigned int cur_line, cur_col; - -} json_state; - -static void * default_alloc (size_t size, int zero, void * user_data) -{ - return zero ? calloc (1, size) : malloc (size); -} - -static void default_free (void * ptr, void * user_data) -{ - free (ptr); -} - -static void * json_alloc (json_state * state, unsigned long size, int zero) -{ - if ((state->ulong_max - state->used_memory) < size) - return 0; - - if (state->settings.max_memory - && (state->used_memory += size) > state->settings.max_memory) - { - return 0; - } - - return state->settings.mem_alloc (size, zero, state->settings.user_data); -} - -static int new_value (json_state * state, - json_value ** top, json_value ** root, json_value ** alloc, - json_type type) -{ - json_value * value; - int values_size; - - if (!state->first_pass) - { - value = *top = *alloc; - *alloc = (*alloc)->_reserved.next_alloc; - - if (!*root) - *root = value; - - switch (value->type) - { - case json_array: - - if (value->u.array.length == 0) - break; - - if (! (value->u.array.values = (json_value **) json_alloc - (state, value->u.array.length * sizeof (json_value *), 0)) ) - { - return 0; - } - - value->u.array.length = 0; - break; - - case json_object: - - if (value->u.object.length == 0) - break; - - values_size = sizeof (*value->u.object.values) * value->u.object.length; - - if (! (value->u.object.values = (json_object_entry *) json_alloc - (state, values_size + ((unsigned long) value->u.object.values), 0)) ) - { - return 0; - } - - value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size; - - value->u.object.length = 0; - break; - - case json_string: - - if (! (value->u.string.ptr = (json_char *) json_alloc - (state, (value->u.string.length + 1) * sizeof (json_char), 0)) ) - { - return 0; - } - - value->u.string.length = 0; - break; - - default: - break; - }; - - return 1; - } - - if (! (value = (json_value *) json_alloc - (state, sizeof (json_value) + state->settings.value_extra, 1))) - { - return 0; - } - - if (!*root) - *root = value; - - value->type = type; - value->parent = *top; - - #ifdef JSON_TRACK_SOURCE - value->line = state->cur_line; - value->col = state->cur_col; - #endif - - if (*alloc) - (*alloc)->_reserved.next_alloc = value; - - *alloc = *top = value; - - return 1; -} - -#define whitespace \ - case '\n': ++ state.cur_line; state.cur_col = 0; \ - case ' ': case '\t': case '\r' - -#define string_add(b) \ - do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0); - -#define line_and_col \ - state.cur_line, state.cur_col - -static const long - flag_next = 1 << 0, - flag_reproc = 1 << 1, - flag_need_comma = 1 << 2, - flag_seek_value = 1 << 3, - flag_escaped = 1 << 4, - flag_string = 1 << 5, - flag_need_colon = 1 << 6, - flag_done = 1 << 7, - flag_num_negative = 1 << 8, - flag_num_zero = 1 << 9, - flag_num_e = 1 << 10, - flag_num_e_got_sign = 1 << 11, - flag_num_e_negative = 1 << 12, - flag_line_comment = 1 << 13, - flag_block_comment = 1 << 14; - -json_value * json_parse_ex (json_settings * settings, - const json_char * json, - size_t length, - char * error_buf) -{ - json_char error [json_error_max]; - const json_char * end; - json_value * top, * root, * alloc = 0; - json_state state = { 0 }; - long flags; - long num_digits = 0, num_e = 0; - json_int_t num_fraction = 0; - - /* Skip UTF-8 BOM - */ - if (length >= 3 && ((unsigned char) json [0]) == 0xEF - && ((unsigned char) json [1]) == 0xBB - && ((unsigned char) json [2]) == 0xBF) - { - json += 3; - length -= 3; - } - - error[0] = '\0'; - end = (json + length); - - memcpy (&state.settings, settings, sizeof (json_settings)); - - if (!state.settings.mem_alloc) - state.settings.mem_alloc = default_alloc; - - if (!state.settings.mem_free) - state.settings.mem_free = default_free; - - memset (&state.uint_max, 0xFF, sizeof (state.uint_max)); - memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max)); - - state.uint_max -= 8; /* limit of how much can be added before next check */ - state.ulong_max -= 8; - - for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass) - { - json_uchar uchar; - unsigned char uc_b1, uc_b2, uc_b3, uc_b4; - json_char * string = 0; - unsigned int string_length = 0; - - top = root = 0; - flags = flag_seek_value; - - state.cur_line = 1; - - for (state.ptr = json ;; ++ state.ptr) - { - json_char b = (state.ptr == end ? 0 : *state.ptr); - - if (flags & flag_string) - { - if (!b) - { sprintf (error, "Unexpected EOF in string (at %d:%d)", line_and_col); - goto e_failed; - } - - if (string_length > state.uint_max) - goto e_overflow; - - if (flags & flag_escaped) - { - flags &= ~ flag_escaped; - - switch (b) - { - case 'b': string_add ('\b'); break; - case 'f': string_add ('\f'); break; - case 'n': string_add ('\n'); break; - case 'r': string_add ('\r'); break; - case 't': string_add ('\t'); break; - case 'u': - - if (end - state.ptr < 4 || - (uc_b1 = hex_value (*++ state.ptr)) == 0xFF || - (uc_b2 = hex_value (*++ state.ptr)) == 0xFF || - (uc_b3 = hex_value (*++ state.ptr)) == 0xFF || - (uc_b4 = hex_value (*++ state.ptr)) == 0xFF) - { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col); - goto e_failed; - } - - uc_b1 = (uc_b1 << 4) | uc_b2; - uc_b2 = (uc_b3 << 4) | uc_b4; - uchar = (uc_b1 << 8) | uc_b2; - - if ((uchar & 0xF800) == 0xD800) { - json_uchar uchar2; - - if (end - state.ptr < 6 || (*++ state.ptr) != '\\' || (*++ state.ptr) != 'u' || - (uc_b1 = hex_value (*++ state.ptr)) == 0xFF || - (uc_b2 = hex_value (*++ state.ptr)) == 0xFF || - (uc_b3 = hex_value (*++ state.ptr)) == 0xFF || - (uc_b4 = hex_value (*++ state.ptr)) == 0xFF) - { - sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col); - goto e_failed; - } - - uc_b1 = (uc_b1 << 4) | uc_b2; - uc_b2 = (uc_b3 << 4) | uc_b4; - uchar2 = (uc_b1 << 8) | uc_b2; - - uchar = 0x010000 | ((uchar & 0x3FF) << 10) | (uchar2 & 0x3FF); - } - - if (sizeof (json_char) >= sizeof (json_uchar) || (uchar <= 0x7F)) - { - string_add ((json_char) uchar); - break; - } - - if (uchar <= 0x7FF) - { - if (state.first_pass) - string_length += 2; - else - { string [string_length ++] = 0xC0 | (uchar >> 6); - string [string_length ++] = 0x80 | (uchar & 0x3F); - } - - break; - } - - if (uchar <= 0xFFFF) { - if (state.first_pass) - string_length += 3; - else - { string [string_length ++] = 0xE0 | (uchar >> 12); - string [string_length ++] = 0x80 | ((uchar >> 6) & 0x3F); - string [string_length ++] = 0x80 | (uchar & 0x3F); - } - - break; - } - - if (state.first_pass) - string_length += 4; - else - { string [string_length ++] = 0xF0 | (uchar >> 18); - string [string_length ++] = 0x80 | ((uchar >> 12) & 0x3F); - string [string_length ++] = 0x80 | ((uchar >> 6) & 0x3F); - string [string_length ++] = 0x80 | (uchar & 0x3F); - } - - break; - - default: - string_add (b); - }; - - continue; - } - - if (b == '\\') - { - flags |= flag_escaped; - continue; - } - - if (b == '"') - { - if (!state.first_pass) - string [string_length] = 0; - - flags &= ~ flag_string; - string = 0; - - switch (top->type) - { - case json_string: - - top->u.string.length = string_length; - flags |= flag_next; - - break; - - case json_object: - - if (state.first_pass) - (*(json_char **) &top->u.object.values) += string_length + 1; - else - { - top->u.object.values [top->u.object.length].name - = (json_char *) top->_reserved.object_mem; - - top->u.object.values [top->u.object.length].name_length - = string_length; - - (*(json_char **) &top->_reserved.object_mem) += string_length + 1; - } - - flags |= flag_seek_value | flag_need_colon; - continue; - - default: - break; - }; - } - else - { - string_add (b); - continue; - } - } - - if (state.settings.settings & json_enable_comments) - { - if (flags & (flag_line_comment | flag_block_comment)) - { - if (flags & flag_line_comment) - { - if (b == '\r' || b == '\n' || !b) - { - flags &= ~ flag_line_comment; - -- state.ptr; /* so null can be reproc'd */ - } - - continue; - } - - if (flags & flag_block_comment) - { - if (!b) - { sprintf (error, "%d:%d: Unexpected EOF in block comment", line_and_col); - goto e_failed; - } - - if (b == '*' && state.ptr < (end - 1) && state.ptr [1] == '/') - { - flags &= ~ flag_block_comment; - ++ state.ptr; /* skip closing sequence */ - } - - continue; - } - } - else if (b == '/') - { - if (! (flags & (flag_seek_value | flag_done)) && top->type != json_object) - { sprintf (error, "%d:%d: Comment not allowed here", line_and_col); - goto e_failed; - } - - if (++ state.ptr == end) - { sprintf (error, "%d:%d: EOF unexpected", line_and_col); - goto e_failed; - } - - switch (b = *state.ptr) - { - case '/': - flags |= flag_line_comment; - continue; - - case '*': - flags |= flag_block_comment; - continue; - - default: - sprintf (error, "%d:%d: Unexpected `%c` in comment opening sequence", line_and_col, b); - goto e_failed; - }; - } - } - - if (flags & flag_done) - { - if (!b) - break; - - switch (b) - { - whitespace: - continue; - - default: - - sprintf (error, "%d:%d: Trailing garbage: `%c`", - state.cur_line, state.cur_col, b); - - goto e_failed; - }; - } - - if (flags & flag_seek_value) - { - switch (b) - { - whitespace: - continue; - - case ']': - - if (top && top->type == json_array) - flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next; - else - { sprintf (error, "%d:%d: Unexpected ]", line_and_col); - goto e_failed; - } - - break; - - default: - - if (flags & flag_need_comma) - { - if (b == ',') - { flags &= ~ flag_need_comma; - continue; - } - else - { - sprintf (error, "%d:%d: Expected , before %c", - state.cur_line, state.cur_col, b); - - goto e_failed; - } - } - - if (flags & flag_need_colon) - { - if (b == ':') - { flags &= ~ flag_need_colon; - continue; - } - else - { - sprintf (error, "%d:%d: Expected : before %c", - state.cur_line, state.cur_col, b); - - goto e_failed; - } - } - - flags &= ~ flag_seek_value; - - switch (b) - { - case '{': - - if (!new_value (&state, &top, &root, &alloc, json_object)) - goto e_alloc_failure; - - continue; - - case '[': - - if (!new_value (&state, &top, &root, &alloc, json_array)) - goto e_alloc_failure; - - flags |= flag_seek_value; - continue; - - case '"': - - if (!new_value (&state, &top, &root, &alloc, json_string)) - goto e_alloc_failure; - - flags |= flag_string; - - string = top->u.string.ptr; - string_length = 0; - - continue; - - case 't': - - if ((end - state.ptr) < 3 || *(++ state.ptr) != 'r' || - *(++ state.ptr) != 'u' || *(++ state.ptr) != 'e') - { - goto e_unknown_value; - } - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - top->u.boolean = 1; - - flags |= flag_next; - break; - - case 'f': - - if ((end - state.ptr) < 4 || *(++ state.ptr) != 'a' || - *(++ state.ptr) != 'l' || *(++ state.ptr) != 's' || - *(++ state.ptr) != 'e') - { - goto e_unknown_value; - } - - if (!new_value (&state, &top, &root, &alloc, json_boolean)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - case 'n': - - if ((end - state.ptr) < 3 || *(++ state.ptr) != 'u' || - *(++ state.ptr) != 'l' || *(++ state.ptr) != 'l') - { - goto e_unknown_value; - } - - if (!new_value (&state, &top, &root, &alloc, json_null)) - goto e_alloc_failure; - - flags |= flag_next; - break; - - default: - - if (isdigit (b) || b == '-') - { - if (!new_value (&state, &top, &root, &alloc, json_integer)) - goto e_alloc_failure; - - if (!state.first_pass) - { - while (isdigit (b) || b == '+' || b == '-' - || b == 'e' || b == 'E' || b == '.') - { - if ( (++ state.ptr) == end) - { - b = 0; - break; - } - - b = *state.ptr; - } - - flags |= flag_next | flag_reproc; - break; - } - - flags &= ~ (flag_num_negative | flag_num_e | - flag_num_e_got_sign | flag_num_e_negative | - flag_num_zero); - - num_digits = 0; - num_fraction = 0; - num_e = 0; - - if (b != '-') - { - flags |= flag_reproc; - break; - } - - flags |= flag_num_negative; - continue; - } - else - { sprintf (error, "%d:%d: Unexpected %c when seeking value", line_and_col, b); - goto e_failed; - } - }; - }; - } - else - { - switch (top->type) - { - case json_object: - - switch (b) - { - whitespace: - continue; - - case '"': - - if (flags & flag_need_comma) - { sprintf (error, "%d:%d: Expected , before \"", line_and_col); - goto e_failed; - } - - flags |= flag_string; - - string = (json_char *) top->_reserved.object_mem; - string_length = 0; - - break; - - case '}': - - flags = (flags & ~ flag_need_comma) | flag_next; - break; - - case ',': - - if (flags & flag_need_comma) - { - flags &= ~ flag_need_comma; - break; - } - - default: - sprintf (error, "%d:%d: Unexpected `%c` in object", line_and_col, b); - goto e_failed; - }; - - break; - - case json_integer: - case json_double: - - if (isdigit (b)) - { - ++ num_digits; - - if (top->type == json_integer || flags & flag_num_e) - { - if (! (flags & flag_num_e)) - { - if (flags & flag_num_zero) - { sprintf (error, "%d:%d: Unexpected `0` before `%c`", line_and_col, b); - goto e_failed; - } - - if (num_digits == 1 && b == '0') - flags |= flag_num_zero; - } - else - { - flags |= flag_num_e_got_sign; - num_e = (num_e * 10) + (b - '0'); - continue; - } - - top->u.integer = (top->u.integer * 10) + (b - '0'); - continue; - } - - num_fraction = (num_fraction * 10) + (b - '0'); - continue; - } - - if (b == '+' || b == '-') - { - if ( (flags & flag_num_e) && !(flags & flag_num_e_got_sign)) - { - flags |= flag_num_e_got_sign; - - if (b == '-') - flags |= flag_num_e_negative; - - continue; - } - } - else if (b == '.' && top->type == json_integer) - { - if (!num_digits) - { sprintf (error, "%d:%d: Expected digit before `.`", line_and_col); - goto e_failed; - } - - top->type = json_double; - top->u.dbl = (double) top->u.integer; - - num_digits = 0; - continue; - } - - if (! (flags & flag_num_e)) - { - if (top->type == json_double) - { - if (!num_digits) - { sprintf (error, "%d:%d: Expected digit after `.`", line_and_col); - goto e_failed; - } - - top->u.dbl += ((double) num_fraction) / (pow (10.0, (double) num_digits)); - } - - if (b == 'e' || b == 'E') - { - flags |= flag_num_e; - - if (top->type == json_integer) - { - top->type = json_double; - top->u.dbl = (double) top->u.integer; - } - - num_digits = 0; - flags &= ~ flag_num_zero; - - continue; - } - } - else - { - if (!num_digits) - { sprintf (error, "%d:%d: Expected digit after `e`", line_and_col); - goto e_failed; - } - - top->u.dbl *= pow (10.0, (double) - (flags & flag_num_e_negative ? - num_e : num_e)); - } - - if (flags & flag_num_negative) - { - if (top->type == json_integer) - top->u.integer = - top->u.integer; - else - top->u.dbl = - top->u.dbl; - } - - flags |= flag_next | flag_reproc; - break; - - default: - break; - }; - } - - if (flags & flag_reproc) - { - flags &= ~ flag_reproc; - -- state.ptr; - } - - if (flags & flag_next) - { - flags = (flags & ~ flag_next) | flag_need_comma; - - if (!top->parent) - { - /* root value done */ - - flags |= flag_done; - continue; - } - - if (top->parent->type == json_array) - flags |= flag_seek_value; - - if (!state.first_pass) - { - json_value * parent = top->parent; - - switch (parent->type) - { - case json_object: - - parent->u.object.values - [parent->u.object.length].value = top; - - break; - - case json_array: - - parent->u.array.values - [parent->u.array.length] = top; - - break; - - default: - break; - }; - } - - if ( (++ top->parent->u.array.length) > state.uint_max) - goto e_overflow; - - top = top->parent; - - continue; - } - } - - alloc = root; - } - - return root; - -e_unknown_value: - - sprintf (error, "%d:%d: Unknown value", line_and_col); - goto e_failed; - -e_alloc_failure: - - strcpy (error, "Memory allocation failure"); - goto e_failed; - -e_overflow: - - sprintf (error, "%d:%d: Too long (caught overflow)", line_and_col); - goto e_failed; - -e_failed: - - if (error_buf) - { - if (*error) - strcpy (error_buf, error); - else - strcpy (error_buf, "Unknown error"); - } - - if (state.first_pass) - alloc = root; - - while (alloc) - { - top = alloc->_reserved.next_alloc; - state.settings.mem_free (alloc, state.settings.user_data); - alloc = top; - } - - if (!state.first_pass) - json_value_free_ex (&state.settings, root); - - return 0; -} - -json_value * json_parse (const json_char * json, size_t length) -{ - json_settings settings = { 0 }; - return json_parse_ex (&settings, json, length, 0); -} - -void json_value_free_ex (json_settings * settings, json_value * value) -{ - json_value * cur_value; - - if (!value) - return; - - value->parent = 0; - - while (value) - { - switch (value->type) - { - case json_array: - - if (!value->u.array.length) - { - settings->mem_free (value->u.array.values, settings->user_data); - break; - } - - value = value->u.array.values [-- value->u.array.length]; - continue; - - case json_object: - - if (!value->u.object.length) - { - settings->mem_free (value->u.object.values, settings->user_data); - break; - } - - value = value->u.object.values [-- value->u.object.length].value; - continue; - - case json_string: - - settings->mem_free (value->u.string.ptr, settings->user_data); - break; - - default: - break; - }; - - cur_value = value; - value = value->parent; - settings->mem_free (cur_value, settings->user_data); - } -} - -void json_value_free (json_value * value) -{ - json_settings settings = { 0 }; - settings.mem_free = default_free; - json_value_free_ex (&settings, value); -} - diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/json.h b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/json.h deleted file mode 100644 index f6549ec4e..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/json.h +++ /dev/null @@ -1,283 +0,0 @@ - -/* vim: set et ts=3 sw=3 sts=3 ft=c: - * - * Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved. - * https://github.com/udp/json-parser - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _JSON_H -#define _JSON_H - -#ifndef json_char - #define json_char char -#endif - -#ifndef json_int_t - #ifndef _MSC_VER - #include - #define json_int_t int64_t - #else - #define json_int_t __int64 - #endif -#endif - -#include - -#ifdef __cplusplus - - #include - - extern "C" - { - -#endif - -typedef struct -{ - unsigned long max_memory; - int settings; - - /* Custom allocator support (leave null to use malloc/free) - */ - - void * (* mem_alloc) (size_t, int zero, void * user_data); - void (* mem_free) (void *, void * user_data); - - void * user_data; /* will be passed to mem_alloc and mem_free */ - - size_t value_extra; /* how much extra space to allocate for values? */ - -} json_settings; - -#define json_enable_comments 0x01 - -typedef enum -{ - json_none, - json_object, - json_array, - json_integer, - json_double, - json_string, - json_boolean, - json_null - -} json_type; - -extern const struct _json_value json_value_none; - -typedef struct _json_object_entry -{ - json_char * name; - unsigned int name_length; - - struct _json_value * value; - -} json_object_entry; - -typedef struct _json_value -{ - struct _json_value * parent; - - json_type type; - - union - { - int boolean; - json_int_t integer; - double dbl; - - struct - { - unsigned int length; - json_char * ptr; /* null terminated */ - - } string; - - struct - { - unsigned int length; - - json_object_entry * values; - - #if defined(__cplusplus) && __cplusplus >= 201103L - decltype(values) begin () const - { return values; - } - decltype(values) end () const - { return values + length; - } - #endif - - } object; - - struct - { - unsigned int length; - struct _json_value ** values; - - #if defined(__cplusplus) && __cplusplus >= 201103L - decltype(values) begin () const - { return values; - } - decltype(values) end () const - { return values + length; - } - #endif - - } array; - - } u; - - union - { - struct _json_value * next_alloc; - void * object_mem; - - } _reserved; - - #ifdef JSON_TRACK_SOURCE - - /* Location of the value in the source JSON - */ - unsigned int line, col; - - #endif - - - /* Some C++ operator sugar */ - - #ifdef __cplusplus - - public: - - inline _json_value () - { memset (this, 0, sizeof (_json_value)); - } - - inline const struct _json_value &operator [] (int index) const - { - if (type != json_array || index < 0 - || ((unsigned int) index) >= u.array.length) - { - return json_value_none; - } - - return *u.array.values [index]; - } - - inline const struct _json_value &operator [] (const char * index) const - { - if (type != json_object) - return json_value_none; - - for (unsigned int i = 0; i < u.object.length; ++ i) - if (!strcmp (u.object.values [i].name, index)) - return *u.object.values [i].value; - - return json_value_none; - } - - inline operator const char * () const - { - switch (type) - { - case json_string: - return u.string.ptr; - - default: - return ""; - }; - } - - inline operator json_int_t () const - { - switch (type) - { - case json_integer: - return u.integer; - - case json_double: - return (json_int_t) u.dbl; - - default: - return 0; - }; - } - - inline operator bool () const - { - if (type != json_boolean) - return false; - - return u.boolean != 0; - } - - inline operator double () const - { - switch (type) - { - case json_integer: - return (double) u.integer; - - case json_double: - return u.dbl; - - default: - return 0; - }; - } - - #endif - -} json_value; - -json_value * json_parse (const json_char * json, - size_t length); - -#define json_error_max 128 -json_value * json_parse_ex (json_settings * settings, - const json_char * json, - size_t length, - char * error); - -void json_value_free (json_value *); - - -/* Not usually necessary, unless you used a custom mem_alloc and now want to - * use a custom mem_free. - */ -void json_value_free_ex (json_settings * settings, - json_value *); - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - -#endif - - diff --git a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/main.c b/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/main.c deleted file mode 100644 index b37a2e566..000000000 --- a/tests/JSONTestSuite/parsers/test_json-parser/test_json-parser/main.c +++ /dev/null @@ -1,66 +0,0 @@ -// -// main.c -// test_json_parser -// -// Created by nst on 13/09/16. -// Copyright © 2016 Nicolas Seriot. All rights reserved. -// - -#include -#include -#include "json.h" - -#include -#include -#include - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -TestStatus testFile(const char *filename) { - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return ERROR; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - - json_char* json = (json_char*)data; - - json_value* value = json_parse(json,len); - - if (value == NULL) { - fprintf(stderr, "Unable to parse data\n"); - free(data); - return FAIL; - } - - json_value_free(value); - - return PASS; -} - -int main(int argc, char* argv[]) { - - if (argc != 2) { - printf("Usage: %s test.json\n", argv[0]); - return 1; - } - - const char* path = argv[1]; - - int result = testFile(path); - - if (result == PASS) { - // printf("-- PASS\n"); - return 0; - } else if (result == FAIL) { - // printf("-- FAIL\n"); - return 1; - } else if (result == ERROR) { - // printf("-- ERROR\n"); - return 1; - } -} diff --git a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/.gitignore b/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/.gitignore deleted file mode 100644 index 1e7caa9ea..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Cargo.lock -target/ diff --git a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/Cargo.toml b/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/Cargo.toml deleted file mode 100644 index c9ba20349..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "rj" -version = "0.1.0" -authors = ["Nicolas Seriot "] - -[dependencies] -serde_json = "*" diff --git a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/README b/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/README deleted file mode 100644 index b662ae2d6..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/README +++ /dev/null @@ -1,2 +0,0 @@ -cd /Users/nst/Projects/dropbox/JSON/test_json-rustc_serialize/rj; cargo build ;/Users/nst/Projects/dropbox/JSON/test_json-rustc_serialize/rj/target/debug/rj /Users/nst/Projects/dropbox/JSON/test_cases/n_177.json - diff --git a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/src/main.rs b/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/src/main.rs deleted file mode 100644 index 7cba2f854..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust-serde_json/rj/src/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -extern crate serde_json; -use std::fs::File; -use std::io::Read; -use std::env; - -fn main() { - println!("Hello, world!"); - - let args: Vec<_> = env::args().collect(); - if args.len() != 2 { - println!("Usage: {} file.json", args[0]); - std::process::exit(1); - } - - let ref path = args[1]; - let mut s = String::new(); - let mut f = File::open(path).expect("Unable to open file"); - //f.read_to_string(&mut s).expect("Unable to read string"); - //println!("{}", s); - - match f.read_to_string(&mut s) { - Err(_) => std::process::exit(1), - Ok(_) => println!("{}", s), - } - - match serde_json::from_str::(&s) { - Ok(_) => std::process::exit(0), - Err(_) => std::process::exit(1) - }; -} diff --git a/tests/JSONTestSuite/parsers/test_json-rust/Cargo.lock b/tests/JSONTestSuite/parsers/test_json-rust/Cargo.lock deleted file mode 100644 index 854790fb9..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/Cargo.lock +++ /dev/null @@ -1,14 +0,0 @@ -[root] -name = "tj" -version = "0.1.0" -dependencies = [ - "json 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "json" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum json 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "772d39b38286c6ebeb2c0412a8d03afd81c3c3ba0046571b9ce9c2ef64475698" diff --git a/tests/JSONTestSuite/parsers/test_json-rust/Cargo.toml b/tests/JSONTestSuite/parsers/test_json-rust/Cargo.toml deleted file mode 100644 index 4c936d1f7..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "tj" -version = "0.1.0" -authors = ["Nicolas Seriot "] - -[dependencies] -json = "*" diff --git a/tests/JSONTestSuite/parsers/test_json-rust/README b/tests/JSONTestSuite/parsers/test_json-rust/README deleted file mode 100644 index 6945e69e2..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/README +++ /dev/null @@ -1,2 +0,0 @@ -cargo build && ./target/debug/tj /Users/nst/Desktop/in.json - diff --git a/tests/JSONTestSuite/parsers/test_json-rust/src/main.rs b/tests/JSONTestSuite/parsers/test_json-rust/src/main.rs deleted file mode 100644 index 5bfc565cf..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/src/main.rs +++ /dev/null @@ -1,42 +0,0 @@ -use std::fs::File; -use std::io::Read; -use std::env; -//use std::process; - -#[macro_use] -extern crate json; - -fn main() { - println!("Hello, world!"); - - let args: Vec<_> = env::args().collect(); - if args.len() != 2 { - println!("Usage: {} file.json", args[0]); - std::process::exit(1); - } - - let ref path = args[1]; - let mut s = String::new(); - let mut f = File::open(path).expect("Unable to open file"); - //f.read_to_string(&mut s).expect("Unable to read string"); - - match f.read_to_string(&mut s) { - Err(_) => std::process::exit(1), - Ok(_) => println!("{}", s), - } - - // println!("{}", s); - // println!("{:?}", t!(s)); - // let bytes: &[u8] = owned_hello.as_bytes(); - - //let o = json::parse(&s); - //println!("{:?}", o); - - match json::parse(&s) { - Err(_) => std::process::exit(1), - _ => std::process::exit(0), - } - - //println!("{}", s); - -} diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.cargo-lock b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.cargo-lock deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/dep-lib-json b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/dep-lib-json deleted file mode 100644 index 59f63fa22..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/dep-lib-json and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/lib-json b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/lib-json deleted file mode 100644 index d9de13b7e..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/lib-json +++ /dev/null @@ -1 +0,0 @@ -7e505dc88b248d1e \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/lib-json.json b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/lib-json.json deleted file mode 100644 index 3c919f4af..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/json-74a82b4ec4439e90/lib-json.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":7859408035877959587,"target":4828698267517893457,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.10.2"]},"features":"None","deps":[],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/bin-tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/bin-tj deleted file mode 100644 index 9f3812247..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/bin-tj +++ /dev/null @@ -1 +0,0 @@ -a61609c8b266cd90 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/bin-tj.json b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/bin-tj.json deleted file mode 100644 index bd116b141..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/bin-tj.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":5191092557147237921,"target":14837433948137983109,"profile":15288148974678605576,"local":{"variant":"MtimeBased","fields":[[1474319948,0],[47,85,115,101,114,115,47,110,115,116,47,80,114,111,106,101,99,116,115,47,100,114,111,112,98,111,120,47,74,83,79,78,47,116,101,115,116,95,106,115,111,110,45,114,117,115,116,47,116,106,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,116,106,45,98,53,100,54,51,97,57,100,56,100,97,50,57,54,56,101,47,100,101,112,45,98,105,110,45,116,106]]},"features":"None","deps":[["json v0.10.2",7439718051229571795]],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/dep-bin-tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/dep-bin-tj deleted file mode 100644 index fce31324e..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-b5d63a9d8da2968e/dep-bin-tj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/bin-tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/bin-tj deleted file mode 100644 index 4bf0f719a..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/bin-tj +++ /dev/null @@ -1 +0,0 @@ -abd8fa96c6861d03 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/bin-tj.json b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/bin-tj.json deleted file mode 100644 index 841d04e67..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/bin-tj.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":7859408035877959587,"target":15551623846446356538,"profile":11154289914177168617,"local":{"variant":"MtimeBased","fields":[[1476880338,0],[47,85,115,101,114,115,47,110,115,116,47,80,114,111,106,101,99,116,115,47,100,114,111,112,98,111,120,47,74,83,79,78,47,112,97,114,115,101,114,115,47,116,101,115,116,95,106,115,111,110,45,114,117,115,116,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,116,106,45,98,98,56,57,48,97,101,54,102,49,48,49,98,98,50,53,47,100,101,112,45,98,105,110,45,116,106]]},"features":"None","deps":[["json v0.10.2",2201455975634653310]],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/dep-bin-tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/dep-bin-tj deleted file mode 100644 index e3ba36df1..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bb890ae6f101bb25/dep-bin-tj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/bin-tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/bin-tj deleted file mode 100644 index dc356ab3b..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/bin-tj +++ /dev/null @@ -1 +0,0 @@ -77e925575f2e3132 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/bin-tj.json b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/bin-tj.json deleted file mode 100644 index d5598b10b..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/bin-tj.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":7859408035877959587,"target":5865571357086859834,"profile":11154289914177168617,"local":{"variant":"MtimeBased","fields":[[1476355490,0],[47,85,115,101,114,115,47,110,115,116,47,80,114,111,106,101,99,116,115,47,100,114,111,112,98,111,120,47,74,83,79,78,47,116,101,115,116,95,106,115,111,110,45,114,117,115,116,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,116,106,45,98,102,50,52,100,48,98,100,99,56,100,48,102,52,100,54,47,100,101,112,45,98,105,110,45,116,106]]},"features":"None","deps":[["json v0.10.2",2201455975634653310]],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/dep-bin-tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/dep-bin-tj deleted file mode 100644 index 600f3b0e5..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/.fingerprint/tj-bf24d0bdc8d0f4d6/dep-bin-tj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/deps/libjson-6bbf4c11dd6d7c25.rlib b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/deps/libjson-6bbf4c11dd6d7c25.rlib deleted file mode 100644 index 557b26932..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/deps/libjson-6bbf4c11dd6d7c25.rlib and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj deleted file mode 100755 index 9c5666253..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj.dSYM/Contents/Info.plist b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj.dSYM/Contents/Info.plist deleted file mode 100644 index 375f8a3d0..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.tj - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj.dSYM/Contents/Resources/DWARF/tj b/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj.dSYM/Contents/Resources/DWARF/tj deleted file mode 100644 index 26e83b8da..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rust/target/debug/tj.dSYM/Contents/Resources/DWARF/tj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/Cargo.lock b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/Cargo.lock deleted file mode 100644 index 39cb21fdb..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/Cargo.lock +++ /dev/null @@ -1,14 +0,0 @@ -[root] -name = "rj" -version = "0.1.0" -dependencies = [ - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-serialize" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b" diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/Cargo.toml b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/Cargo.toml deleted file mode 100644 index 1252b5fa8..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "rj" -version = "0.1.0" -authors = ["Nicolas Seriot "] - -[dependencies] -rustc-serialize = "*" diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/README b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/README deleted file mode 100644 index b662ae2d6..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/README +++ /dev/null @@ -1,2 +0,0 @@ -cd /Users/nst/Projects/dropbox/JSON/test_json-rustc_serialize/rj; cargo build ;/Users/nst/Projects/dropbox/JSON/test_json-rustc_serialize/rj/target/debug/rj /Users/nst/Projects/dropbox/JSON/test_cases/n_177.json - diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/src/main.rs b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/src/main.rs deleted file mode 100644 index e7bfaf4f4..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/src/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -extern crate rustc_serialize; -use rustc_serialize::json::{Json}; -use std::fs::File; -use std::io::Read; -use std::env; - -fn main() { - println!("Hello, world!"); - - let args: Vec<_> = env::args().collect(); - if args.len() != 2 { - println!("Usage: {} file.json", args[0]); - std::process::exit(1); - } - - let ref path = args[1]; - let mut s = String::new(); - let mut f = File::open(path).expect("Unable to open file"); - //f.read_to_string(&mut s).expect("Unable to read string"); - //println!("{}", s); - - match f.read_to_string(&mut s) { - Err(_) => std::process::exit(1), - Ok(_) => println!("{}", s), - } - - match Json::from_str(&s) { - Ok(_) => std::process::exit(0), - Err(_) => std::process::exit(1) - }; - -} diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.cargo-lock b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.cargo-lock deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/bin-rj b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/bin-rj deleted file mode 100644 index b4fe28a41..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/bin-rj +++ /dev/null @@ -1 +0,0 @@ -dceb1c284557768d \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/bin-rj.json b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/bin-rj.json deleted file mode 100644 index cb109e6d4..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/bin-rj.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":7859408035877959587,"target":10766102054036524891,"profile":11154289914177168617,"local":{"variant":"MtimeBased","fields":[[1476880312,0],[47,85,115,101,114,115,47,110,115,116,47,80,114,111,106,101,99,116,115,47,100,114,111,112,98,111,120,47,74,83,79,78,47,112,97,114,115,101,114,115,47,116,101,115,116,95,106,115,111,110,45,114,117,115,116,99,95,115,101,114,105,97,108,105,122,101,47,114,106,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,114,106,45,56,102,56,98,55,53,48,100,50,48,102,51,98,102,49,48,47,100,101,112,45,98,105,110,45,114,106]]},"features":"None","deps":[["rustc-serialize v0.3.19",111722912817965924]],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/dep-bin-rj b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/dep-bin-rj deleted file mode 100644 index cc6676fc7..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-8f8b750d20f3bf10/dep-bin-rj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/bin-rj b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/bin-rj deleted file mode 100644 index cbfe7e9a7..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/bin-rj +++ /dev/null @@ -1 +0,0 @@ -4e360d1c29d40a3a \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/bin-rj.json b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/bin-rj.json deleted file mode 100644 index 132ba1b79..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/bin-rj.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":7859408035877959587,"target":10743941033649540137,"profile":11154289914177168617,"local":{"variant":"MtimeBased","fields":[[1476355341,0],[47,85,115,101,114,115,47,110,115,116,47,80,114,111,106,101,99,116,115,47,100,114,111,112,98,111,120,47,74,83,79,78,47,116,101,115,116,95,106,115,111,110,45,114,117,115,116,99,95,115,101,114,105,97,108,105,122,101,47,114,106,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,114,106,45,100,97,48,102,56,102,54,51,98,56,55,99,102,53,51,49,47,100,101,112,45,98,105,110,45,114,106]]},"features":"None","deps":[["rustc-serialize v0.3.19",111722912817965924]],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/dep-bin-rj b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/dep-bin-rj deleted file mode 100644 index a487a20f8..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rj-da0f8f63b87cf531/dep-bin-rj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/dep-lib-rustc-serialize b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/dep-lib-rustc-serialize deleted file mode 100644 index fb9aabe1e..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/dep-lib-rustc-serialize and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/lib-rustc-serialize b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/lib-rustc-serialize deleted file mode 100644 index 9346e65e5..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/lib-rustc-serialize +++ /dev/null @@ -1 +0,0 @@ -646bc9b365eb8c01 \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/lib-rustc-serialize.json b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/lib-rustc-serialize.json deleted file mode 100644 index d3ea7d77d..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/.fingerprint/rustc-serialize-80c565222c5ccdbb/lib-rustc-serialize.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":7859408035877959587,"target":12509747639738875829,"profile":11154289914177168617,"local":{"variant":"Precalculated","fields":["0.3.19"]},"features":"None","deps":[],"rustflags":[]} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/deps/librustc_serialize-3561541d79c18212.rlib b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/deps/librustc_serialize-3561541d79c18212.rlib deleted file mode 100644 index df2775012..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/deps/librustc_serialize-3561541d79c18212.rlib and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj deleted file mode 100755 index 755744a7a..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Info.plist b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Info.plist deleted file mode 100644 index fae662e0d..000000000 --- a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.rj - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Resources/DWARF/rj b/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Resources/DWARF/rj deleted file mode 100644 index 170b3a2a4..000000000 Binary files a/tests/JSONTestSuite/parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Resources/DWARF/rj and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_json.cr b/tests/JSONTestSuite/parsers/test_json.cr deleted file mode 100755 index 52237676e..000000000 --- a/tests/JSONTestSuite/parsers/test_json.cr +++ /dev/null @@ -1,19 +0,0 @@ -require "json" - -file = ARGV[0] - -begin - puts(file) - json = File.read(file) - result = JSON.parse_raw(json) - p result - - if result.nil? - exit 1 - else - exit 0 - end -rescue ex : JSON::Error - puts(ex) - exit 1 -end diff --git a/tests/JSONTestSuite/parsers/test_json.js b/tests/JSONTestSuite/parsers/test_json.js deleted file mode 100644 index 50cf9d7ea..000000000 --- a/tests/JSONTestSuite/parsers/test_json.js +++ /dev/null @@ -1,13 +0,0 @@ -var fs = require('fs'); -var path = process.argv[2]; - -try { - var data = fs.readFileSync(path); - var json = JSON.parse(data); - //console.log(json) -} catch (e) { - console.log("--", e.message) - process.exit(1); -} - -process.exit(0); diff --git a/tests/JSONTestSuite/parsers/test_json.php b/tests/JSONTestSuite/parsers/test_json.php deleted file mode 100755 index fc9bbc714..000000000 --- a/tests/JSONTestSuite/parsers/test_json.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/tests/JSONTestSuite/parsers/test_json.pl b/tests/JSONTestSuite/parsers/test_json.pl deleted file mode 100644 index 2e33b1fe6..000000000 --- a/tests/JSONTestSuite/parsers/test_json.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl - -#use strict; -use warnings; -use JSON; - -my $path = $ARGV[0]; - -open( my $fh, '<', $path ) or die "Can't open $path: $!"; - -my $jsonWasDecoded = 0; - -while ( my $data = <$fh> ) { - - my $text = ""; - - eval { - $text = from_json( $data, { allow_nonref => 1, utf8 => 1, relaxed => 1 } ); -# $text = JSON->new->utf8->allow_nonref->decode($data); # TODO: should use decode_json - }; - - $jsonWasDecoded = $text ne ""; - -} - -close $fh; - -if ($jsonWasDecoded) { - exit 0; -} - -exit 1; diff --git a/tests/JSONTestSuite/parsers/test_json.py b/tests/JSONTestSuite/parsers/test_json.py deleted file mode 100755 index ec9224138..000000000 --- a/tests/JSONTestSuite/parsers/test_json.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python - -import json -import sys - -#def f_parse_constant(o): -# raise BaseException - -def parse_file(path): - - with open(path, 'r') as f: - - data = f.read() - - try: - o = json.loads(data) - #o = json.loads(data, parse_constant=f_parse_constant) - #print(o) - #if o == None: - # sys.exit(1) - - except Exception as e: - #print("--1") - #print(e) - #print("--2") - sys.exit(1) - - """ - s = o.encode('utf-8') - with open('/Users/nst/Desktop/p.txt', 'wb') as f: - f.write(s) - """ - -if __name__ == "__main__": - - path = sys.argv[1] - parse_file(path) - - sys.exit(0) diff --git a/tests/JSONTestSuite/parsers/test_json.rb b/tests/JSONTestSuite/parsers/test_json.rb deleted file mode 100755 index 560e7bc3f..000000000 --- a/tests/JSONTestSuite/parsers/test_json.rb +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/ruby - -require 'json' - -f = ARGV[0] - -o = nil - -begin - puts(f) - json = File.read(f) - o = JSON.parse(json, {:quirks_mode => true}) - p o - - if o == nil - exit 1 - else - exit 0 - end -rescue JSON::ParserError => e - puts(e) - exit 1 -end diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/bin/jsonChecker b/tests/JSONTestSuite/parsers/test_jsonChecker/bin/jsonChecker deleted file mode 100755 index 10b017d72..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jsonChecker/bin/jsonChecker and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/JSON_checker.c b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/JSON_checker.c deleted file mode 100644 index 50f054fc8..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/JSON_checker.c +++ /dev/null @@ -1,400 +0,0 @@ -/* JSON_checker.c */ - -/* 2007-08-24 */ - -/* -Copyright (c) 2005 JSON.org - -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 shall be used for Good, not Evil. - -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. -*/ - -#include -#include "JSON_checker.h" - -#define true 1 -#define false 0 -#define __ -1 /* the universal error code */ - -/* - Characters are mapped into these 31 character classes. This allows for - a significant reduction in the size of the state transition table. -*/ - -enum classes { - C_SPACE, /* space */ - C_WHITE, /* other whitespace */ - C_LCURB, /* { */ - C_RCURB, /* } */ - C_LSQRB, /* [ */ - C_RSQRB, /* ] */ - C_COLON, /* : */ - C_COMMA, /* , */ - C_QUOTE, /* " */ - C_BACKS, /* \ */ - C_SLASH, /* / */ - C_PLUS, /* + */ - C_MINUS, /* - */ - C_POINT, /* . */ - C_ZERO , /* 0 */ - C_DIGIT, /* 123456789 */ - C_LOW_A, /* a */ - C_LOW_B, /* b */ - C_LOW_C, /* c */ - C_LOW_D, /* d */ - C_LOW_E, /* e */ - C_LOW_F, /* f */ - C_LOW_L, /* l */ - C_LOW_N, /* n */ - C_LOW_R, /* r */ - C_LOW_S, /* s */ - C_LOW_T, /* t */ - C_LOW_U, /* u */ - C_ABCDF, /* ABCDF */ - C_E, /* E */ - C_ETC, /* everything else */ - NR_CLASSES -}; - -static int ascii_class[128] = { -/* - This array maps the 128 ASCII characters into character classes. - The remaining Unicode characters should be mapped to C_ETC. - Non-whitespace control characters are errors. -*/ - __, __, __, __, __, __, __, __, - __, C_WHITE, C_WHITE, __, __, C_WHITE, __, __, - __, __, __, __, __, __, __, __, - __, __, __, __, __, __, __, __, - - C_SPACE, C_ETC, C_QUOTE, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_PLUS, C_COMMA, C_MINUS, C_POINT, C_SLASH, - C_ZERO, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, - C_DIGIT, C_DIGIT, C_COLON, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - - C_ETC, C_ABCDF, C_ABCDF, C_ABCDF, C_ABCDF, C_E, C_ABCDF, C_ETC, - C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_LSQRB, C_BACKS, C_RSQRB, C_ETC, C_ETC, - - C_ETC, C_LOW_A, C_LOW_B, C_LOW_C, C_LOW_D, C_LOW_E, C_LOW_F, C_ETC, - C_ETC, C_ETC, C_ETC, C_ETC, C_LOW_L, C_ETC, C_LOW_N, C_ETC, - C_ETC, C_ETC, C_LOW_R, C_LOW_S, C_LOW_T, C_LOW_U, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_LCURB, C_ETC, C_RCURB, C_ETC, C_ETC -}; - - -/* - The state codes. -*/ -enum states { - GO, /* start */ - OK, /* ok */ - OB, /* object */ - KE, /* key */ - CO, /* colon */ - VA, /* value */ - AR, /* array */ - ST, /* string */ - ES, /* escape */ - U1, /* u1 */ - U2, /* u2 */ - U3, /* u3 */ - U4, /* u4 */ - MI, /* minus */ - ZE, /* zero */ - IN, /* integer */ - FR, /* fraction */ - E1, /* e */ - E2, /* ex */ - E3, /* exp */ - T1, /* tr */ - T2, /* tru */ - T3, /* true */ - F1, /* fa */ - F2, /* fal */ - F3, /* fals */ - F4, /* false */ - N1, /* nu */ - N2, /* nul */ - N3, /* null */ - NR_STATES -}; - - -static int state_transition_table[NR_STATES][NR_CLASSES] = { -/* - The state transition table takes the current state and the current symbol, - and returns either a new state or an action. An action is represented as a - negative number. A JSON text is accepted if at the end of the text the - state is OK and if the mode is MODE_DONE. - - white 1-9 ABCDF etc - space | { } [ ] : , " \ / + - . 0 | a b c d e f l n r s t u | E |*/ -/*start GO*/ {GO,GO,-6,__,-5,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*ok OK*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*object OB*/ {OB,OB,__,-9,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*key KE*/ {KE,KE,__,__,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*colon CO*/ {CO,CO,__,__,__,__,-2,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*value VA*/ {VA,VA,-6,__,-5,__,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__}, -/*array AR*/ {AR,AR,-6,__,-5,-7,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__}, -/*string ST*/ {ST,__,ST,ST,ST,ST,ST,ST,-4,ES,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST}, -/*escape ES*/ {__,__,__,__,__,__,__,__,ST,ST,ST,__,__,__,__,__,__,ST,__,__,__,ST,__,ST,ST,__,ST,U1,__,__,__}, -/*u1 U1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U2,U2,U2,U2,U2,U2,U2,U2,__,__,__,__,__,__,U2,U2,__}, -/*u2 U2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U3,U3,U3,U3,U3,U3,U3,U3,__,__,__,__,__,__,U3,U3,__}, -/*u3 U3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U4,U4,U4,U4,U4,U4,U4,U4,__,__,__,__,__,__,U4,U4,__}, -/*u4 U4*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,ST,ST,ST,ST,ST,ST,ST,ST,__,__,__,__,__,__,ST,ST,__}, -/*minus MI*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,ZE,IN,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*zero ZE*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*int IN*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,IN,IN,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__}, -/*frac FR*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,FR,FR,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__}, -/*e E1*/ {__,__,__,__,__,__,__,__,__,__,__,E2,E2,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*ex E2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*exp E3*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*tr T1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T2,__,__,__,__,__,__}, -/*tru T2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T3,__,__,__}, -/*true T3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__}, -/*fa F1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F2,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*fal F2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F3,__,__,__,__,__,__,__,__}, -/*fals F3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F4,__,__,__,__,__}, -/*false F4*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__}, -/*nu N1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N2,__,__,__}, -/*nul N2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N3,__,__,__,__,__,__,__,__}, -/*null N3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__}, -}; - - -/* - These modes can be pushed on the stack. -*/ -enum modes { - MODE_ARRAY, - MODE_DONE, - MODE_KEY, - MODE_OBJECT -}; - -static int -reject(JSON_checker jc) -{ -/* - Delete the JSON_checker object. -*/ - free((void*)jc->stack); - free((void*)jc); - return false; -} - - -static int -push(JSON_checker jc, int mode) -{ -/* - Push a mode onto the stack. Return false if there is overflow. -*/ - jc->top += 1; - if (jc->top >= jc->depth) { - return false; - } - jc->stack[jc->top] = mode; - return true; -} - - -static int -pop(JSON_checker jc, int mode) -{ -/* - Pop the stack, assuring that the current mode matches the expectation. - Return false if there is underflow or if the modes mismatch. -*/ - if (jc->top < 0 || jc->stack[jc->top] != mode) { - return false; - } - jc->top -= 1; - return true; -} - - -JSON_checker -new_JSON_checker(int depth) -{ -/* - new_JSON_checker starts the checking process by constructing a JSON_checker - object. It takes a depth parameter that restricts the level of maximum - nesting. - - To continue the process, call JSON_checker_char for each character in the - JSON text, and then call JSON_checker_done to obtain the final result. - These functions are fully reentrant. - - The JSON_checker object will be deleted by JSON_checker_done. - JSON_checker_char will delete the JSON_checker object if it sees an error. -*/ - JSON_checker jc = (JSON_checker)malloc(sizeof(struct JSON_checker_struct)); - jc->state = GO; - jc->depth = depth; - jc->top = -1; - jc->stack = (int*)calloc(depth, sizeof(int)); - push(jc, MODE_DONE); - return jc; -} - - -int -JSON_checker_char(JSON_checker jc, int next_char) -{ -/* - After calling new_JSON_checker, call this function for each character (or - partial character) in your JSON text. It can accept UTF-8, UTF-16, or - UTF-32. It returns true if things are looking ok so far. If it rejects the - text, it deletes the JSON_checker object and returns false. -*/ - int next_class, next_state; -/* - Determine the character's class. -*/ - if (next_char < 0) { - return reject(jc); - } - if (next_char >= 128) { - next_class = C_ETC; - } else { - next_class = ascii_class[next_char]; - if (next_class <= __) { - return reject(jc); - } - } -/* - Get the next state from the state transition table. -*/ - next_state = state_transition_table[jc->state][next_class]; - if (next_state >= 0) { -/* - Change the state. -*/ - jc->state = next_state; - } else { -/* - Or perform one of the actions. -*/ - switch (next_state) { -/* empty } */ - case -9: - if (!pop(jc, MODE_KEY)) { - return reject(jc); - } - jc->state = OK; - break; - -/* } */ case -8: - if (!pop(jc, MODE_OBJECT)) { - return reject(jc); - } - jc->state = OK; - break; - -/* ] */ case -7: - if (!pop(jc, MODE_ARRAY)) { - return reject(jc); - } - jc->state = OK; - break; - -/* { */ case -6: - if (!push(jc, MODE_KEY)) { - return reject(jc); - } - jc->state = OB; - break; - -/* [ */ case -5: - if (!push(jc, MODE_ARRAY)) { - return reject(jc); - } - jc->state = AR; - break; - -/* " */ case -4: - switch (jc->stack[jc->top]) { - case MODE_KEY: - jc->state = CO; - break; - case MODE_ARRAY: - case MODE_OBJECT: - jc->state = OK; - break; - default: - return reject(jc); - } - break; - -/* , */ case -3: - switch (jc->stack[jc->top]) { - case MODE_OBJECT: -/* - A comma causes a flip from object mode to key mode. -*/ - if (!pop(jc, MODE_OBJECT) || !push(jc, MODE_KEY)) { - return reject(jc); - } - jc->state = KE; - break; - case MODE_ARRAY: - jc->state = VA; - break; - default: - return reject(jc); - } - break; - -/* : */ case -2: -/* - A colon causes a flip from key mode to object mode. -*/ - if (!pop(jc, MODE_KEY) || !push(jc, MODE_OBJECT)) { - return reject(jc); - } - jc->state = VA; - break; -/* - Bad action. -*/ - default: - return reject(jc); - } - } - return true; -} - - -int -JSON_checker_done(JSON_checker jc) -{ -/* - The JSON_checker_done function should be called after all of the characters - have been processed, but only if every call to JSON_checker_char returned - true. This function deletes the JSON_checker and returns true if the JSON - text was accepted. -*/ - int result = jc->state == OK && pop(jc, MODE_DONE); - reject(jc); - return result; -} diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/JSON_checker.h b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/JSON_checker.h deleted file mode 100644 index 47c229970..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/JSON_checker.h +++ /dev/null @@ -1,13 +0,0 @@ -/* JSON_checker.h */ - -typedef struct JSON_checker_struct { - int state; - int depth; - int top; - int* stack; -} * JSON_checker; - - -extern JSON_checker new_JSON_checker(int depth); -extern int JSON_checker_char(JSON_checker jc, int next_char); -extern int JSON_checker_done(JSON_checker jc); diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.pbxproj deleted file mode 100644 index 53791717c..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.pbxproj +++ /dev/null @@ -1,253 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03C3CB1B1D665D2500254A85 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 03C3CB1A1D665D2500254A85 /* main.c */; }; - 03C3CB231D665D2F00254A85 /* JSON_checker.c in Sources */ = {isa = PBXBuildFile; fileRef = 03C3CB211D665D2F00254A85 /* JSON_checker.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03C3CB151D665D2500254A85 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03C3CB171D665D2500254A85 /* jsonChecker */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jsonChecker; sourceTree = BUILT_PRODUCTS_DIR; }; - 03C3CB1A1D665D2500254A85 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 03C3CB211D665D2F00254A85 /* JSON_checker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = JSON_checker.c; sourceTree = ""; }; - 03C3CB221D665D2F00254A85 /* JSON_checker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSON_checker.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03C3CB141D665D2500254A85 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03C3CB0E1D665D2500254A85 = { - isa = PBXGroup; - children = ( - 03C3CB221D665D2F00254A85 /* JSON_checker.h */, - 03C3CB211D665D2F00254A85 /* JSON_checker.c */, - 03C3CB191D665D2500254A85 /* jsonChecker */, - 03C3CB181D665D2500254A85 /* Products */, - ); - sourceTree = ""; - }; - 03C3CB181D665D2500254A85 /* Products */ = { - isa = PBXGroup; - children = ( - 03C3CB171D665D2500254A85 /* jsonChecker */, - ); - name = Products; - sourceTree = ""; - }; - 03C3CB191D665D2500254A85 /* jsonChecker */ = { - isa = PBXGroup; - children = ( - 03C3CB1A1D665D2500254A85 /* main.c */, - ); - path = jsonChecker; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03C3CB161D665D2500254A85 /* jsonChecker */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03C3CB1E1D665D2500254A85 /* Build configuration list for PBXNativeTarget "jsonChecker" */; - buildPhases = ( - 03C3CB131D665D2500254A85 /* Sources */, - 03C3CB141D665D2500254A85 /* Frameworks */, - 03C3CB151D665D2500254A85 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = jsonChecker; - productName = jsonChecker; - productReference = 03C3CB171D665D2500254A85 /* jsonChecker */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03C3CB0F1D665D2500254A85 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03C3CB161D665D2500254A85 = { - CreatedOnToolsVersion = 7.3; - }; - }; - }; - buildConfigurationList = 03C3CB121D665D2500254A85 /* Build configuration list for PBXProject "jsonChecker" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03C3CB0E1D665D2500254A85; - productRefGroup = 03C3CB181D665D2500254A85 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03C3CB161D665D2500254A85 /* jsonChecker */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03C3CB131D665D2500254A85 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03C3CB1B1D665D2500254A85 /* main.c in Sources */, - 03C3CB231D665D2F00254A85 /* JSON_checker.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03C3CB1C1D665D2500254A85 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03C3CB1D1D665D2500254A85 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03C3CB1F1D665D2500254A85 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03C3CB201D665D2500254A85 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03C3CB121D665D2500254A85 /* Build configuration list for PBXProject "jsonChecker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03C3CB1C1D665D2500254A85 /* Debug */, - 03C3CB1D1D665D2500254A85 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03C3CB1E1D665D2500254A85 /* Build configuration list for PBXNativeTarget "jsonChecker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03C3CB1F1D665D2500254A85 /* Debug */, - 03C3CB201D665D2500254A85 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03C3CB0F1D665D2500254A85 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index d45a28186..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 3a2cb1cb3..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/jsonChecker.xcscheme b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/jsonChecker.xcscheme deleted file mode 100644 index 138c193a4..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/jsonChecker.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 8051ed617..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - jsonChecker.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03C3CB161D665D2500254A85 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker/main.c b/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker/main.c deleted file mode 100644 index b1f4c87a3..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker/jsonChecker/jsonChecker/main.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include "JSON_checker.h" - -#include -#include -#include - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -TestStatus testFile(const char *filename) { - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return ERROR; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - - JSON_checker jc = new_JSON_checker(20); // max depth - for (int i = 0; i < len; i++) { - char c = data[i]; - if (JSON_checker_char(jc, c) == 0) { - return FAIL; - } - } - return JSON_checker_done(jc) ? PASS : FAIL; -} - -int main(int argc, char* argv[]) { - - if (argc != 2) { - printf("Usage: %s test.json\n", argv[0]); - return 1; - } - - const char* path = argv[1]; - - int result = testFile(path); - - if (result == PASS) { - printf("-- PASS\n"); - return 0; - } else if (result == FAIL) { - printf("-- FAIL\n"); - return 1; - } else if (result == ERROR) { - printf("-- ERROR\n"); - return 1; - } -} diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/FSM.rtf b/tests/JSONTestSuite/parsers/test_jsonChecker2/FSM.rtf deleted file mode 100644 index 1c8efcce6..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/FSM.rtf +++ /dev/null @@ -1,103 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1504 -{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;} -{\colortbl;\red255\green255\blue255;\red255\green164\blue159;\red255\green255\blue255;\red194\green229\blue166; -\red134\green205\blue77;\red255\green164\blue159;\red194\green229\blue166;\red134\green205\blue77;} -{\*\expandedcolortbl;\csgray\c100000;\csgenericrgb\c100000\c64314\c62353;\csgray\c100000;\csgenericrgb\c76078\c89804\c65098; -\csgenericrgb\c52549\c80392\c30196;\csgenericrgb\c100000\c64314\c62353;\csgenericrgb\c76078\c89804\c65098;\csgenericrgb\c52549\c80392\c30196;} -\paperw11900\paperh16840\margl1440\margr1440\vieww19400\viewh13040\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\fs24 \cf0 bug 1: rejection of 0e1\ --> add missing transition ZE -> eE -> E1\ -\ -\ -\ -\ - white 1-9 ABCDF etc\ - space | \{ \} [ ] : , " \\ / + - . 0 | a b c d e f l n r s t u | E |*/\ - /*start GO*/ \{GO,GO,-6,__,-5,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*ok OK*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*object OB*/ \{OB,OB,__,-9,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*key KE*/ \{KE,KE,__,__,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*colon CO*/ \{CO,CO,__,__,__,__,-2,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*value VA*/ \{VA,VA,-6,__,-5,__,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__\},\ - /*array AR*/ \{AR,AR,-6,__,-5,-7,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__\},\ - /*string ST*/ \{ST,__,ST,ST,ST,ST,ST,ST,-4,ES,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST\},\ - /*escape ES*/ \{__,__,__,__,__,__,__,__,ST,ST,ST,__,__,__,__,__,__,ST,__,__,__,ST,__,ST,ST,__,ST,U1,__,__,__\},\ - /*u1 U1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,U2,U2,U2,U2,U2,U2,U2,U2,__,__,__,__,__,__,U2,U2,__\},\ - /*u2 U2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,U3,U3,U3,U3,U3,U3,U3,U3,__,__,__,__,__,__,U3,U3,__\},\ - /*u3 U3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,U4,U4,U4,U4,U4,U4,U4,U4,__,__,__,__,__,__,U4,U4,__\},\ - /*u4 U4*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,ST,ST,ST,ST,ST,ST,ST,ST,__,__,__,__,__,__,ST,ST,__\},\ - /*minus MI*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,ZE,IN,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \cb2 -/*zero ZE*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\cb3 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \cb4 +/*zero ZE*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,__,__,__,__,__,__,\cb5 E1\cb4 ,__,__,__,__,__,__,__,__,\cb5 E1\cb4 ,__\},\cb3 \ - /*int IN*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,IN,IN,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__\},\ - /*frac FR*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,FR,FR,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__\},\ - /*e E1*/ \{__,__,__,__,__,__,__,__,__,__,__,E2,E2,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*ex E2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*exp E3*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*tr T1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T2,__,__,__,__,__,__\},\ - /*tru T2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T3,__,__,__\},\ - /*true T3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__\},\ - /*fa F1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F2,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*fal F2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F3,__,__,__,__,__,__,__,__\},\ - /*fals F3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F4,__,__,__,__,__\},\ - /*false F4*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__\},\ - /*nu N1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N2,__,__,__\},\ - /*nul N2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N3,__,__,__,__,__,__,__,__\},\ - /*null N3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__\},\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \cb1 \ -\ -\ -\ -bug 2: acceptance of [1.]\ --> require digit after dot\ --> add missing state F0\ --> update transition IN -> . -> F0\ -\ -\ -\ - white 1-9 ABCDF etc\ - space | \{ \} [ ] : , " \\ / + - . 0 | a b c d e f l n r s t u | E |*/\ - /*start GO*/ \{GO,GO,-6,__,-5,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*ok OK*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*object OB*/ \{OB,OB,__,-9,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*key KE*/ \{KE,KE,__,__,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*colon CO*/ \{CO,CO,__,__,__,__,-2,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*value VA*/ \{VA,VA,-6,__,-5,__,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__\},\ - /*array AR*/ \{AR,AR,-6,__,-5,-7,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__\},\ - /*string ST*/ \{ST,__,ST,ST,ST,ST,ST,ST,-4,ES,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST\},\ - /*escape ES*/ \{__,__,__,__,__,__,__,__,ST,ST,ST,__,__,__,__,__,__,ST,__,__,__,ST,__,ST,ST,__,ST,U1,__,__,__\},\ - /*u1 U1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,U2,U2,U2,U2,U2,U2,U2,U2,__,__,__,__,__,__,U2,U2,__\},\ - /*u2 U2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,U3,U3,U3,U3,U3,U3,U3,U3,__,__,__,__,__,__,U3,U3,__\},\ - /*u3 U3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,U4,U4,U4,U4,U4,U4,U4,U4,__,__,__,__,__,__,U4,U4,__\},\ - /*u4 U4*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,ST,ST,ST,ST,ST,ST,ST,ST,__,__,__,__,__,__,ST,ST,__\},\ - /*minus MI*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,ZE,IN,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ -\cb6 -/*zero ZE*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,__,__,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__\},\cb1 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \cb7 +/*zero ZE*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,\cb8 F0\cb7 ,__,__,__,__,__,__,\cb4 E1\cb7 ,__,__,__,__,__,__,__,__,\cb4 E1\cb7 ,__\},\cb1 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \cb6 -/*int IN*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,FR,IN,IN,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__\},\cb1 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \cb7 +/*int IN*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,\cb8 F0\cb7 ,IN,IN,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__\},\cb1 \ -\cb7 +/*frac0 F0*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,FR,FR,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\cb1 \ - /*frac FR*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,FR,FR,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__\},\ - /*e E1*/ \{__,__,__,__,__,__,__,__,__,__,__,E2,E2,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*ex E2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*exp E3*/ \{OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*tr T1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T2,__,__,__,__,__,__\},\ - /*tru T2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T3,__,__,__\},\ - /*true T3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__\},\ - /*fa F1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F2,__,__,__,__,__,__,__,__,__,__,__,__,__,__\},\ - /*fal F2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F3,__,__,__,__,__,__,__,__\},\ - /*fals F3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F4,__,__,__,__,__\},\ - /*false F4*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__\},\ - /*nu N1*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N2,__,__,__\},\ - /*nul N2*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N3,__,__,__,__,__,__,__,__\},\ - /*null N3*/ \{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__\},\ -\ -\ -} \ No newline at end of file diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/bin/jsonChecker2 b/tests/JSONTestSuite/parsers/test_jsonChecker2/bin/jsonChecker2 deleted file mode 100755 index 35958254f..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jsonChecker2/bin/jsonChecker2 and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/JSON_checker.c b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/JSON_checker.c deleted file mode 100644 index d79a2a1d0..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/JSON_checker.c +++ /dev/null @@ -1,402 +0,0 @@ -/* JSON_checker.c */ - -/* 2007-08-24 */ - -/* -Copyright (c) 2005 JSON.org - -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 shall be used for Good, not Evil. - -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. -*/ - -#include -#include "JSON_checker.h" - -#define true 1 -#define false 0 -#define __ -1 /* the universal error code */ - -/* - Characters are mapped into these 31 character classes. This allows for - a significant reduction in the size of the state transition table. -*/ - -enum classes { - C_SPACE, /* space */ - C_WHITE, /* other whitespace */ - C_LCURB, /* { */ - C_RCURB, /* } */ - C_LSQRB, /* [ */ - C_RSQRB, /* ] */ - C_COLON, /* : */ - C_COMMA, /* , */ - C_QUOTE, /* " */ - C_BACKS, /* \ */ - C_SLASH, /* / */ - C_PLUS, /* + */ - C_MINUS, /* - */ - C_POINT, /* . */ - C_ZERO , /* 0 */ - C_DIGIT, /* 123456789 */ - C_LOW_A, /* a */ - C_LOW_B, /* b */ - C_LOW_C, /* c */ - C_LOW_D, /* d */ - C_LOW_E, /* e */ - C_LOW_F, /* f */ - C_LOW_L, /* l */ - C_LOW_N, /* n */ - C_LOW_R, /* r */ - C_LOW_S, /* s */ - C_LOW_T, /* t */ - C_LOW_U, /* u */ - C_ABCDF, /* ABCDF */ - C_E, /* E */ - C_ETC, /* everything else */ - NR_CLASSES -}; - -static int ascii_class[128] = { -/* - This array maps the 128 ASCII characters into character classes. - The remaining Unicode characters should be mapped to C_ETC. - Non-whitespace control characters are errors. -*/ - __, __, __, __, __, __, __, __, - __, C_WHITE, C_WHITE, __, __, C_WHITE, __, __, - __, __, __, __, __, __, __, __, - __, __, __, __, __, __, __, __, - - C_SPACE, C_ETC, C_QUOTE, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_PLUS, C_COMMA, C_MINUS, C_POINT, C_SLASH, - C_ZERO, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, - C_DIGIT, C_DIGIT, C_COLON, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - - C_ETC, C_ABCDF, C_ABCDF, C_ABCDF, C_ABCDF, C_E, C_ABCDF, C_ETC, - C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_LSQRB, C_BACKS, C_RSQRB, C_ETC, C_ETC, - - C_ETC, C_LOW_A, C_LOW_B, C_LOW_C, C_LOW_D, C_LOW_E, C_LOW_F, C_ETC, - C_ETC, C_ETC, C_ETC, C_ETC, C_LOW_L, C_ETC, C_LOW_N, C_ETC, - C_ETC, C_ETC, C_LOW_R, C_LOW_S, C_LOW_T, C_LOW_U, C_ETC, C_ETC, - C_ETC, C_ETC, C_ETC, C_LCURB, C_ETC, C_RCURB, C_ETC, C_ETC -}; - - -/* - The state codes. -*/ -enum states { - GO, /* start */ - OK, /* ok */ - OB, /* object */ - KE, /* key */ - CO, /* colon */ - VA, /* value */ - AR, /* array */ - ST, /* string */ - ES, /* escape */ - U1, /* u1 */ - U2, /* u2 */ - U3, /* u3 */ - U4, /* u4 */ - MI, /* minus */ - ZE, /* zero */ - IN, /* integer */ - F0, /* frac0 */ /* NEW */ - FR, /* fraction */ - E1, /* e */ - E2, /* ex */ - E3, /* exp */ - T1, /* tr */ - T2, /* tru */ - T3, /* true */ - F1, /* fa */ - F2, /* fal */ - F3, /* fals */ - F4, /* false */ - N1, /* nu */ - N2, /* nul */ - N3, /* null */ - NR_STATES -}; - - -static int state_transition_table[NR_STATES][NR_CLASSES] = { -/* - The state transition table takes the current state and the current symbol, - and returns either a new state or an action. An action is represented as a - negative number. A JSON text is accepted if at the end of the text the - state is OK and if the mode is MODE_DONE. - - white 1-9 ABCDF etc - space | { } [ ] : , " \ / + - . 0 | a b c d e f l n r s t u | E |*/ -/*start GO*/ {GO,GO,-6,__,-5,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*ok OK*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*object OB*/ {OB,OB,__,-9,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*key KE*/ {KE,KE,__,__,__,__,__,__,ST,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*colon CO*/ {CO,CO,__,__,__,__,-2,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*value VA*/ {VA,VA,-6,__,-5,__,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__}, -/*array AR*/ {AR,AR,-6,__,-5,-7,__,__,ST,__,__,__,MI,__,ZE,IN,__,__,__,__,__,F1,__,N1,__,__,T1,__,__,__,__}, -/*string ST*/ {ST,__,ST,ST,ST,ST,ST,ST,-4,ES,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST}, -/*escape ES*/ {__,__,__,__,__,__,__,__,ST,ST,ST,__,__,__,__,__,__,ST,__,__,__,ST,__,ST,ST,__,ST,U1,__,__,__}, -/*u1 U1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U2,U2,U2,U2,U2,U2,U2,U2,__,__,__,__,__,__,U2,U2,__}, -/*u2 U2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U3,U3,U3,U3,U3,U3,U3,U3,__,__,__,__,__,__,U3,U3,__}, -/*u3 U3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U4,U4,U4,U4,U4,U4,U4,U4,__,__,__,__,__,__,U4,U4,__}, -/*u4 U4*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,ST,ST,ST,ST,ST,ST,ST,ST,__,__,__,__,__,__,ST,ST,__}, -/*minus MI*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,ZE,IN,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*zero ZE*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,F0,__,__,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__}, -/*int IN*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,F0,IN,IN,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__}, -/*frac0 F0*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,FR,FR,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*frac FR*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,FR,FR,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__}, -/*e E1*/ {__,__,__,__,__,__,__,__,__,__,__,E2,E2,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*ex E2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*exp E3*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,E3,E3,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*tr T1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T2,__,__,__,__,__,__}, -/*tru T2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,T3,__,__,__}, -/*true T3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__}, -/*fa F1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F2,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, -/*fal F2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F3,__,__,__,__,__,__,__,__}, -/*fals F3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,F4,__,__,__,__,__}, -/*false F4*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__}, -/*nu N1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N2,__,__,__}, -/*nul N2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N3,__,__,__,__,__,__,__,__}, -/*null N3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__}, -}; - - -/* - These modes can be pushed on the stack. -*/ -enum modes { - MODE_ARRAY, - MODE_DONE, - MODE_KEY, - MODE_OBJECT -}; - -static int -reject(JSON_checker jc) -{ -/* - Delete the JSON_checker object. -*/ - free((void*)jc->stack); - free((void*)jc); - return false; -} - - -static int -push(JSON_checker jc, int mode) -{ -/* - Push a mode onto the stack. Return false if there is overflow. -*/ - jc->top += 1; - if (jc->top >= jc->depth) { - return false; - } - jc->stack[jc->top] = mode; - return true; -} - - -static int -pop(JSON_checker jc, int mode) -{ -/* - Pop the stack, assuring that the current mode matches the expectation. - Return false if there is underflow or if the modes mismatch. -*/ - if (jc->top < 0 || jc->stack[jc->top] != mode) { - return false; - } - jc->top -= 1; - return true; -} - - -JSON_checker -new_JSON_checker(int depth) -{ -/* - new_JSON_checker starts the checking process by constructing a JSON_checker - object. It takes a depth parameter that restricts the level of maximum - nesting. - - To continue the process, call JSON_checker_char for each character in the - JSON text, and then call JSON_checker_done to obtain the final result. - These functions are fully reentrant. - - The JSON_checker object will be deleted by JSON_checker_done. - JSON_checker_char will delete the JSON_checker object if it sees an error. -*/ - JSON_checker jc = (JSON_checker)malloc(sizeof(struct JSON_checker_struct)); - jc->state = GO; - jc->depth = depth; - jc->top = -1; - jc->stack = (int*)calloc(depth, sizeof(int)); - push(jc, MODE_DONE); - return jc; -} - - -int -JSON_checker_char(JSON_checker jc, int next_char) -{ -/* - After calling new_JSON_checker, call this function for each character (or - partial character) in your JSON text. It can accept UTF-8, UTF-16, or - UTF-32. It returns true if things are looking ok so far. If it rejects the - text, it deletes the JSON_checker object and returns false. -*/ - int next_class, next_state; -/* - Determine the character's class. -*/ - if (next_char < 0) { - return reject(jc); - } - if (next_char >= 128) { - next_class = C_ETC; - } else { - next_class = ascii_class[next_char]; - if (next_class <= __) { - return reject(jc); - } - } -/* - Get the next state from the state transition table. -*/ - next_state = state_transition_table[jc->state][next_class]; - if (next_state >= 0) { -/* - Change the state. -*/ - jc->state = next_state; - } else { -/* - Or perform one of the actions. -*/ - switch (next_state) { -/* empty } */ - case -9: - if (!pop(jc, MODE_KEY)) { - return reject(jc); - } - jc->state = OK; - break; - -/* } */ case -8: - if (!pop(jc, MODE_OBJECT)) { - return reject(jc); - } - jc->state = OK; - break; - -/* ] */ case -7: - if (!pop(jc, MODE_ARRAY)) { - return reject(jc); - } - jc->state = OK; - break; - -/* { */ case -6: - if (!push(jc, MODE_KEY)) { - return reject(jc); - } - jc->state = OB; - break; - -/* [ */ case -5: - if (!push(jc, MODE_ARRAY)) { - return reject(jc); - } - jc->state = AR; - break; - -/* " */ case -4: - switch (jc->stack[jc->top]) { - case MODE_KEY: - jc->state = CO; - break; - case MODE_ARRAY: - case MODE_OBJECT: - jc->state = OK; - break; - default: - return reject(jc); - } - break; - -/* , */ case -3: - switch (jc->stack[jc->top]) { - case MODE_OBJECT: -/* - A comma causes a flip from object mode to key mode. -*/ - if (!pop(jc, MODE_OBJECT) || !push(jc, MODE_KEY)) { - return reject(jc); - } - jc->state = KE; - break; - case MODE_ARRAY: - jc->state = VA; - break; - default: - return reject(jc); - } - break; - -/* : */ case -2: -/* - A colon causes a flip from key mode to object mode. -*/ - if (!pop(jc, MODE_KEY) || !push(jc, MODE_OBJECT)) { - return reject(jc); - } - jc->state = VA; - break; -/* - Bad action. -*/ - default: - return reject(jc); - } - } - return true; -} - - -int -JSON_checker_done(JSON_checker jc) -{ -/* - The JSON_checker_done function should be called after all of the characters - have been processed, but only if every call to JSON_checker_char returned - true. This function deletes the JSON_checker and returns true if the JSON - text was accepted. -*/ - int result = jc->state == OK && pop(jc, MODE_DONE); - reject(jc); - return result; -} diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/JSON_checker.h b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/JSON_checker.h deleted file mode 100644 index 47c229970..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/JSON_checker.h +++ /dev/null @@ -1,13 +0,0 @@ -/* JSON_checker.h */ - -typedef struct JSON_checker_struct { - int state; - int depth; - int top; - int* stack; -} * JSON_checker; - - -extern JSON_checker new_JSON_checker(int depth); -extern int JSON_checker_char(JSON_checker jc, int next_char); -extern int JSON_checker_done(JSON_checker jc); diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker/main.c b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker/main.c deleted file mode 100644 index b1f4c87a3..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker/main.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include "JSON_checker.h" - -#include -#include -#include - -typedef enum testStatus {ERROR, PASS, FAIL} TestStatus; - -TestStatus testFile(const char *filename) { - FILE *f=fopen(filename,"rb"); - if(f == NULL) { return ERROR; }; - fseek(f,0,SEEK_END); - long len=ftell(f); - fseek(f,0,SEEK_SET); - char *data=(char*)malloc(len+1); - fread(data,1,len,f); - data[len]='\0'; - fclose(f); - - JSON_checker jc = new_JSON_checker(20); // max depth - for (int i = 0; i < len; i++) { - char c = data[i]; - if (JSON_checker_char(jc, c) == 0) { - return FAIL; - } - } - return JSON_checker_done(jc) ? PASS : FAIL; -} - -int main(int argc, char* argv[]) { - - if (argc != 2) { - printf("Usage: %s test.json\n", argv[0]); - return 1; - } - - const char* path = argv[1]; - - int result = testFile(path); - - if (result == PASS) { - printf("-- PASS\n"); - return 0; - } else if (result == FAIL) { - printf("-- FAIL\n"); - return 1; - } else if (result == ERROR) { - printf("-- ERROR\n"); - return 1; - } -} diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.pbxproj b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.pbxproj deleted file mode 100644 index a8aa3d31d..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.pbxproj +++ /dev/null @@ -1,253 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 03C3CB1B1D665D2500254A85 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 03C3CB1A1D665D2500254A85 /* main.c */; }; - 03C3CB231D665D2F00254A85 /* JSON_checker.c in Sources */ = {isa = PBXBuildFile; fileRef = 03C3CB211D665D2F00254A85 /* JSON_checker.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 03C3CB151D665D2500254A85 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 03C3CB171D665D2500254A85 /* jsonChecker2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jsonChecker2; sourceTree = BUILT_PRODUCTS_DIR; }; - 03C3CB1A1D665D2500254A85 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 03C3CB211D665D2F00254A85 /* JSON_checker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = JSON_checker.c; sourceTree = ""; }; - 03C3CB221D665D2F00254A85 /* JSON_checker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSON_checker.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 03C3CB141D665D2500254A85 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 03C3CB0E1D665D2500254A85 = { - isa = PBXGroup; - children = ( - 03C3CB211D665D2F00254A85 /* JSON_checker.c */, - 03C3CB221D665D2F00254A85 /* JSON_checker.h */, - 03C3CB191D665D2500254A85 /* jsonChecker */, - 03C3CB181D665D2500254A85 /* Products */, - ); - sourceTree = ""; - }; - 03C3CB181D665D2500254A85 /* Products */ = { - isa = PBXGroup; - children = ( - 03C3CB171D665D2500254A85 /* jsonChecker2 */, - ); - name = Products; - sourceTree = ""; - }; - 03C3CB191D665D2500254A85 /* jsonChecker */ = { - isa = PBXGroup; - children = ( - 03C3CB1A1D665D2500254A85 /* main.c */, - ); - path = jsonChecker; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 03C3CB161D665D2500254A85 /* jsonChecker2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03C3CB1E1D665D2500254A85 /* Build configuration list for PBXNativeTarget "jsonChecker2" */; - buildPhases = ( - 03C3CB131D665D2500254A85 /* Sources */, - 03C3CB141D665D2500254A85 /* Frameworks */, - 03C3CB151D665D2500254A85 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = jsonChecker2; - productName = jsonChecker; - productReference = 03C3CB171D665D2500254A85 /* jsonChecker2 */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 03C3CB0F1D665D2500254A85 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Nicolas Seriot"; - TargetAttributes = { - 03C3CB161D665D2500254A85 = { - CreatedOnToolsVersion = 7.3; - }; - }; - }; - buildConfigurationList = 03C3CB121D665D2500254A85 /* Build configuration list for PBXProject "jsonChecker2" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 03C3CB0E1D665D2500254A85; - productRefGroup = 03C3CB181D665D2500254A85 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 03C3CB161D665D2500254A85 /* jsonChecker2 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 03C3CB131D665D2500254A85 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03C3CB1B1D665D2500254A85 /* main.c in Sources */, - 03C3CB231D665D2F00254A85 /* JSON_checker.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 03C3CB1C1D665D2500254A85 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 03C3CB1D1D665D2500254A85 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 03C3CB1F1D665D2500254A85 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 03C3CB201D665D2500254A85 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 03C3CB121D665D2500254A85 /* Build configuration list for PBXProject "jsonChecker2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03C3CB1C1D665D2500254A85 /* Debug */, - 03C3CB1D1D665D2500254A85 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03C3CB1E1D665D2500254A85 /* Build configuration list for PBXNativeTarget "jsonChecker2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03C3CB1F1D665D2500254A85 /* Debug */, - 03C3CB201D665D2500254A85 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 03C3CB0F1D665D2500254A85 /* Project object */; -} diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index c1f0fef52..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index c16ce228f..000000000 Binary files a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/jsonChecker.xcscheme b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/jsonChecker.xcscheme deleted file mode 100644 index 8a1d7dc50..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/jsonChecker.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist b/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 8051ed617..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonChecker2/jsonChecker2/jsonChecker2.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - jsonChecker.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 03C3CB161D665D2500254A85 - - primary - - - - - diff --git a/tests/JSONTestSuite/parsers/test_json_re.rb b/tests/JSONTestSuite/parsers/test_json_re.rb deleted file mode 100755 index 94ec27216..000000000 --- a/tests/JSONTestSuite/parsers/test_json_re.rb +++ /dev/null @@ -1,33 +0,0 @@ -# encoding: utf-8 - -f = ARGV[0] - -if f.end_with? "n_structure_open_array_object.json" # would hang the regex - exit 2 -end - -# http://stackoverflow.com/questions/2583472/regex-to-validate-json -JSON_VALIDATOR_RE = /( - # define subtypes and build up the json syntax, BNF-grammar-style - # The {0} is a hack to simply define them as named groups here but not match on them yet - # I added some atomic grouping to prevent catastrophic backtracking on invalid inputs - (? -?(?=[1-9]|0(?!\d))\d+(\.\d+)?([eE][+-]?\d+)?){0} - (? true | false | null ){0} - (? " (?>[^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " ){0} - (? \[ (?> \g (?: , \g )* )? \s* \] ){0} - (? \s* \g \s* : \g ){0} - (? \{ (?> \g (?: , \g )* )? \s* \} ){0} - (? \s* (?> \g | \g | \g | \g | \g ) \s* ){0} - ) - \A \g \Z - /uix - -begin - data = File.read(f) - puts(data) - if data.match(JSON_VALIDATOR_RE) - exit 0 - else - exit 1 - end -end diff --git a/tests/JSONTestSuite/parsers/test_json_xs.pl b/tests/JSONTestSuite/parsers/test_json_xs.pl deleted file mode 100644 index 512c52877..000000000 --- a/tests/JSONTestSuite/parsers/test_json_xs.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl - -# cpan install Test::JSON - -use JSON::XS; -use warnings; - -my $path = $ARGV[0]; - -open( my $fh, '<', $path ) or die "Can't open $path: $!"; - -my $output = 0; - -my $json = JSON::XS->new->utf8->allow_nonref; # RFC 7159 // TODO: try with utf8 enabled, means you get an UTF-8 encoded octet/binary - -while ( my $data = <$fh> ) { - eval { - $output = $json->decode ($data); - }; -} - -close $fh; - -if ($output != 0) { - exit 0; -} - -exit 1; diff --git a/tests/JSONTestSuite/parsers/test_jsonlite.r b/tests/JSONTestSuite/parsers/test_jsonlite.r deleted file mode 100644 index 1cca3c109..000000000 --- a/tests/JSONTestSuite/parsers/test_jsonlite.r +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env Rscript - -args<-commandArgs(TRUE) - -library(jsonlite) - -jsonData <- fromJSON(args[1]) diff --git a/tests/JSONTestSuite/parsers/test_oj_compat.rb b/tests/JSONTestSuite/parsers/test_oj_compat.rb deleted file mode 100644 index dd9b5d152..000000000 --- a/tests/JSONTestSuite/parsers/test_oj_compat.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby - -require 'oj' - -f = ARGV[0] - -o = nil - -Oj.default_options = { :mode => :compat } - -begin - puts(f) - json = File.read(f) - o = Oj.load( json ) - p o - - if o == nil - exit 1 - else - exit 0 - end -rescue JSON::ParserError => e - puts(e) - exit 1 -end diff --git a/tests/JSONTestSuite/parsers/test_oj_strict.rb b/tests/JSONTestSuite/parsers/test_oj_strict.rb deleted file mode 100644 index 0767663b4..000000000 --- a/tests/JSONTestSuite/parsers/test_oj_strict.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby - -require 'oj' - -f = ARGV[0] - -o = nil - -Oj.default_options = { :mode => :strict } - -begin - puts(f) - json = File.read(f) - o = Oj.load( json ) - p o - - if o == nil - exit 1 - else - exit 0 - end -rescue JSON::ParserError => e - puts(e) - exit 1 -end diff --git a/tests/JSONTestSuite/parsers/test_qt/build.sh b/tests/JSONTestSuite/parsers/test_qt/build.sh deleted file mode 100755 index aa01ffda6..000000000 --- a/tests/JSONTestSuite/parsers/test_qt/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -qmake . -make diff --git a/tests/JSONTestSuite/parsers/test_qt/main.cpp b/tests/JSONTestSuite/parsers/test_qt/main.cpp deleted file mode 100644 index a228db56b..000000000 --- a/tests/JSONTestSuite/parsers/test_qt/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#include -#include - -int main(int argc, char *argv[]) { - if (argc < 1) { - return 1; - } - - QFile file(argv[1]); - if (! file.open(QIODevice::ReadOnly)) { - return 1; - } - - auto bytes = file.readAll(); - QJsonParseError parseError; - QJsonDocument::fromJson(bytes, &parseError); - - if (parseError.error != QJsonParseError::NoError) { - return 1; - } - - return 0; -} diff --git a/tests/JSONTestSuite/parsers/test_qt/test_qt.pro b/tests/JSONTestSuite/parsers/test_qt/test_qt.pro deleted file mode 100644 index 3b14dac3d..000000000 --- a/tests/JSONTestSuite/parsers/test_qt/test_qt.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += core -QT -= gui - -CONFIG += c++11 - -TARGET = test_qt -CONFIG += console -CONFIG -= app_bundle - -TEMPLATE = app - -SOURCES += main.cpp diff --git a/tests/JSONTestSuite/parsers/test_rjson.r b/tests/JSONTestSuite/parsers/test_rjson.r deleted file mode 100644 index d9353cf34..000000000 --- a/tests/JSONTestSuite/parsers/test_rjson.r +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env Rscript - -args<-commandArgs(TRUE) - -library(rjson) # > install.packages("rjson") - -json_data <- fromJSON(file=args[1]) diff --git a/tests/JSONTestSuite/parsers/test_yajl.rb b/tests/JSONTestSuite/parsers/test_yajl.rb deleted file mode 100644 index c01289511..000000000 --- a/tests/JSONTestSuite/parsers/test_yajl.rb +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env ruby - -require 'yajl' - -f = ARGV[0] - -o = nil - -begin - puts(f) - json = File.read(f) - parser = Yajl::Parser.new - o = parser.parse( json ) - p o - - if o == nil - exit 1 - else - exit 0 - end -rescue JSON::ParserError => e - puts(e) - exit 1 -end diff --git a/tests/JSONTestSuite/results/logs.txt b/tests/JSONTestSuite/results/logs.txt deleted file mode 100644 index 3159c09ea..000000000 --- a/tests/JSONTestSuite/results/logs.txt +++ /dev/null @@ -1,2048 +0,0 @@ -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Bash JSON.sh 2016-08-12 CRASH i_structure_500_nested_arrays.json -Bash JSON.sh 2016-08-12 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_-2..json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0.3e+.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0.3e.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0.e1.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0_capital_E+.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0_capital_E.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0e+.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_0e.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_1.0e+.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_1.0e-.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_1.0e.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_2.e+3.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_2.e-3.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_2.e3.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_9.e+.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_number_then_00.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_backslash_00.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_escape_x.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_escaped_emoji.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -Bash JSON.sh 2016-08-12 CRASH n_structure_100000_opening_arrays.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_structure_null-byte-outside-string.json -Bash JSON.sh 2016-08-12 CRASH n_structure_open_array_object.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_PASSED y_string_unescaped_char_delete.json -Bash JSON.sh 2016-08-12 SHOULD_HAVE_PASSED y_string_with_del_character.json -C JSON Checker IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -C JSON Checker IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -C JSON Checker IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -C JSON Checker IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -C JSON Checker IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -C JSON Checker IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -C JSON Checker IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -C JSON Checker IMPLEMENTATION_PASS i_string_invalid_surrogate.json -C JSON Checker IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -C JSON Checker IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -C JSON Checker IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -C JSON Checker IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -C JSON Checker IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C JSON Checker IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C JSON Checker IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C JSON Checker IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C JSON Checker IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C JSON Checker IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -C JSON Checker IMPLEMENTATION_FAIL i_structure_500_nested_arrays.json -C JSON Checker IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -C JSON Checker SHOULD_HAVE_FAILED n_number_-2..json -C JSON Checker SHOULD_HAVE_FAILED n_number_0.e1.json -C JSON Checker SHOULD_HAVE_FAILED n_number_2.e+3.json -C JSON Checker SHOULD_HAVE_FAILED n_number_2.e-3.json -C JSON Checker SHOULD_HAVE_FAILED n_number_2.e3.json -C JSON Checker SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -C JSON Checker SHOULD_HAVE_PASSED y_number_0e+1.json -C JSON Checker SHOULD_HAVE_PASSED y_number_0e1.json -C JSON Checker SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+10FFFF.json -C JSON Checker SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+1FFFF.json -C JSON Checker SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+FFFF.json -C JSON Checker SHOULD_HAVE_PASSED y_string_pi.json -C JSON Checker SHOULD_HAVE_PASSED y_string_space.json -C JSON Checker SHOULD_HAVE_PASSED y_string_u+2028_line_sep.json -C JSON Checker SHOULD_HAVE_PASSED y_string_u+2029_par_sep.json -C JSON Checker SHOULD_HAVE_PASSED y_string_unicode_2.json -C JSON Checker SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C JSON Checker SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -C JSON Checker SHOULD_HAVE_PASSED y_string_utf8.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_lonely_false.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_lonely_int.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_lonely_negative_real.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_lonely_null.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_lonely_string.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_lonely_true.json -C JSON Checker SHOULD_HAVE_PASSED y_structure_string_empty.json -C JSON Checker 2 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -C JSON Checker 2 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -C JSON Checker 2 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C JSON Checker 2 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C JSON Checker 2 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C JSON Checker 2 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -C JSON Checker 2 IMPLEMENTATION_FAIL i_structure_500_nested_arrays.json -C JSON Checker 2 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+10FFFF.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+1FFFF.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+FFFF.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_pi.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_space.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_u+2028_line_sep.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_u+2029_par_sep.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_unicode_2.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_string_utf8.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_lonely_false.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_lonely_int.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_lonely_negative_real.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_lonely_null.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_lonely_string.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_lonely_true.json -C JSON Checker 2 SHOULD_HAVE_PASSED y_structure_string_empty.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_truncated-utf-8.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C JSON Parser by udp IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C JSON Parser by udp IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -C JSON Parser by udp IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -C JSON Parser by udp IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_array_extra_comma.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_array_just_minus.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_array_number_and_comma.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_number_then_00.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_object_pi_in_key_and_trailing_comma.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_object_trailing_comma.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_escape_x.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_escaped_ctrl_char_tab.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_escaped_emoji.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_invalid_utf8_after_escape.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_iso_latin_1.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_unescaped_newline.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_unescaped_tab.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -C JSON Parser by udp SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -C JSON Parser by udp SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C JSON Parser by udp SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -C cJSON IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -C cJSON IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -C cJSON IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -C cJSON IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -C cJSON IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -C cJSON IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -C cJSON IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -C cJSON IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -C cJSON IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -C cJSON IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -C cJSON IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -C cJSON IMPLEMENTATION_PASS i_string_truncated-utf-8.json -C cJSON IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C cJSON IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C cJSON IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C cJSON IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C cJSON IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C cJSON IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -C cJSON IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -C cJSON IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -C cJSON SHOULD_HAVE_FAILED n_array_comma_after_close.json -C cJSON SHOULD_HAVE_FAILED n_array_extra_close.json -C cJSON SHOULD_HAVE_FAILED n_array_just_minus.json -C cJSON SHOULD_HAVE_FAILED n_number_-01.json -C cJSON SHOULD_HAVE_FAILED n_number_0.3e+.json -C cJSON SHOULD_HAVE_FAILED n_number_0.3e.json -C cJSON SHOULD_HAVE_FAILED n_number_0_capital_E+.json -C cJSON SHOULD_HAVE_FAILED n_number_0_capital_E.json -C cJSON SHOULD_HAVE_FAILED n_number_0e+.json -C cJSON SHOULD_HAVE_FAILED n_number_0e.json -C cJSON SHOULD_HAVE_FAILED n_number_1.0e+.json -C cJSON SHOULD_HAVE_FAILED n_number_1.0e-.json -C cJSON SHOULD_HAVE_FAILED n_number_1.0e.json -C cJSON SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -C cJSON SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -C cJSON SHOULD_HAVE_FAILED n_number_then_00.json -C cJSON SHOULD_HAVE_FAILED n_number_with_leading_zero.json -C cJSON SHOULD_HAVE_FAILED n_object_trailing_comment.json -C cJSON SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -C cJSON SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -C cJSON SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -C cJSON SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -C cJSON SHOULD_HAVE_FAILED n_string_backslash_00.json -C cJSON SHOULD_HAVE_FAILED n_string_escape_x.json -C cJSON SHOULD_HAVE_FAILED n_string_escaped_ctrl_char_tab.json -C cJSON SHOULD_HAVE_FAILED n_string_escaped_emoji.json -C cJSON SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -C cJSON SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -C cJSON SHOULD_HAVE_FAILED n_string_invalid_utf8_after_escape.json -C cJSON SHOULD_HAVE_FAILED n_string_iso_latin_1.json -C cJSON SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -C cJSON SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -C cJSON SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -C cJSON SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -C cJSON SHOULD_HAVE_FAILED n_string_single_doublequote.json -C cJSON SHOULD_HAVE_FAILED n_string_unescaped_newline.json -C cJSON SHOULD_HAVE_FAILED n_string_unescaped_tab.json -C cJSON SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -C cJSON SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -C cJSON SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -C cJSON CRASH n_structure_100000_opening_arrays.json -C cJSON SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -C cJSON SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -C cJSON SHOULD_HAVE_FAILED n_structure_close_unopened_array.json -C cJSON SHOULD_HAVE_FAILED n_structure_double_array.json -C cJSON SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -C cJSON SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -C cJSON SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -C cJSON CRASH n_structure_open_array_object.json -C cJSON SHOULD_HAVE_FAILED n_structure_trailing_#.json -C cJSON SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -C cJSON SHOULD_HAVE_PASSED y_object_escaped_null_in_key.json -C cJSON SHOULD_HAVE_PASSED y_string_null_escape.json -C cJSON SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C cJSON SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -C ccan IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -C ccan IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -C ccan IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -C ccan IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -C ccan IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -C ccan IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -C ccan IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -C ccan IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -C ccan IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -C ccan IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -C ccan IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -C ccan IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -C ccan IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C ccan IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C ccan IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C ccan IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C ccan IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C ccan IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -C ccan IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -C ccan IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -C ccan SHOULD_HAVE_FAILED n_number_then_00.json -C ccan CRASH n_structure_100000_opening_arrays.json -C ccan CRASH n_structure_open_array_object.json -C ccan SHOULD_HAVE_PASSED y_object_escaped_null_in_key.json -C ccan SHOULD_HAVE_PASSED y_string_null_escape.json -C ccan SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C ccan SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -C jansson IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -C jansson IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -C jansson IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -C jansson IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -C jansson IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -C jansson IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -C jansson IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -C jansson IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -C jansson IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -C jansson IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -C jansson IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -C jansson IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -C jansson IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C jansson IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C jansson IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C jansson IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C jansson IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C jansson IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -C jansson IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -C jansson IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -C jansson SHOULD_HAVE_PASSED y_number_huge_exp.json -C jansson SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -C jansson SHOULD_HAVE_PASSED y_number_pos_double_huge_exp.json -C jansson SHOULD_HAVE_PASSED y_number_real_neg_overflow.json -C jansson SHOULD_HAVE_PASSED y_number_real_pos_overflow.json -C jansson SHOULD_HAVE_PASSED y_number_too_big_neg_int.json -C jansson SHOULD_HAVE_PASSED y_number_too_big_pos_int.json -C jansson SHOULD_HAVE_PASSED y_number_very_big_negative_int.json -C jansson SHOULD_HAVE_PASSED y_object_escaped_null_in_key.json -C jansson SHOULD_HAVE_PASSED y_string_null_escape.json -C jansson SHOULD_HAVE_PASSED y_string_space.json -C jansson SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C jansson SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -C jansson SHOULD_HAVE_PASSED y_structure_lonely_false.json -C jansson SHOULD_HAVE_PASSED y_structure_lonely_int.json -C jansson SHOULD_HAVE_PASSED y_structure_lonely_negative_real.json -C jansson SHOULD_HAVE_PASSED y_structure_lonely_null.json -C jansson SHOULD_HAVE_PASSED y_structure_lonely_string.json -C jansson SHOULD_HAVE_PASSED y_structure_lonely_true.json -C jansson SHOULD_HAVE_PASSED y_structure_string_empty.json -C jsmn IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -C jsmn IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -C jsmn IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -C jsmn IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -C jsmn IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -C jsmn IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -C jsmn IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -C jsmn IMPLEMENTATION_PASS i_string_invalid_surrogate.json -C jsmn IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -C jsmn IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -C jsmn IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -C jsmn IMPLEMENTATION_PASS i_string_truncated-utf-8.json -C jsmn IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -C jsmn IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -C jsmn IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -C jsmn IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -C jsmn IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -C jsmn IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -C jsmn IMPLEMENTATION_FAIL i_structure_500_nested_arrays.json -C jsmn IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -C jsmn SHOULD_HAVE_FAILED n_array_1_true_without_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_colon_instead_of_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_comma_after_close.json -C jsmn SHOULD_HAVE_FAILED n_array_comma_and_number.json -C jsmn SHOULD_HAVE_FAILED n_array_double_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_double_extra_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_extra_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_items_separated_by_semicolon.json -C jsmn SHOULD_HAVE_FAILED n_array_just_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_just_minus.json -C jsmn SHOULD_HAVE_FAILED n_array_missing_value.json -C jsmn SHOULD_HAVE_FAILED n_array_number_and_comma.json -C jsmn SHOULD_HAVE_FAILED n_array_number_and_several_commas.json -C jsmn SHOULD_HAVE_FAILED n_array_spaces_vertical_tab_formfeed.json -C jsmn SHOULD_HAVE_FAILED n_array_star_inside.json -C jsmn SHOULD_HAVE_FAILED n_incomplete_false.json -C jsmn SHOULD_HAVE_FAILED n_incomplete_null.json -C jsmn SHOULD_HAVE_FAILED n_incomplete_true.json -C jsmn SHOULD_HAVE_FAILED n_number_++.json -C jsmn SHOULD_HAVE_FAILED n_number_+1.json -C jsmn SHOULD_HAVE_FAILED n_number_+Inf.json -C jsmn SHOULD_HAVE_FAILED n_number_-01.json -C jsmn SHOULD_HAVE_FAILED n_number_-1.0..json -C jsmn SHOULD_HAVE_FAILED n_number_-2..json -C jsmn SHOULD_HAVE_FAILED n_number_-NaN.json -C jsmn SHOULD_HAVE_FAILED n_number_.-1.json -C jsmn SHOULD_HAVE_FAILED n_number_.2e-3.json -C jsmn SHOULD_HAVE_FAILED n_number_0.1.2.json -C jsmn SHOULD_HAVE_FAILED n_number_0.3e+.json -C jsmn SHOULD_HAVE_FAILED n_number_0.3e.json -C jsmn SHOULD_HAVE_FAILED n_number_0.e1.json -C jsmn SHOULD_HAVE_FAILED n_number_0_capital_E+.json -C jsmn SHOULD_HAVE_FAILED n_number_0_capital_E.json -C jsmn SHOULD_HAVE_FAILED n_number_0e+.json -C jsmn SHOULD_HAVE_FAILED n_number_0e.json -C jsmn SHOULD_HAVE_FAILED n_number_1.0e+.json -C jsmn SHOULD_HAVE_FAILED n_number_1.0e-.json -C jsmn SHOULD_HAVE_FAILED n_number_1.0e.json -C jsmn SHOULD_HAVE_FAILED n_number_1_000.json -C jsmn SHOULD_HAVE_FAILED n_number_1eE2.json -C jsmn SHOULD_HAVE_FAILED n_number_2.e+3.json -C jsmn SHOULD_HAVE_FAILED n_number_2.e-3.json -C jsmn SHOULD_HAVE_FAILED n_number_2.e3.json -C jsmn SHOULD_HAVE_FAILED n_number_9.e+.json -C jsmn SHOULD_HAVE_FAILED n_number_expression.json -C jsmn SHOULD_HAVE_FAILED n_number_hex_1_digit.json -C jsmn SHOULD_HAVE_FAILED n_number_hex_2_digits.json -C jsmn SHOULD_HAVE_FAILED n_number_Inf.json -C jsmn SHOULD_HAVE_FAILED n_number_infinity.json -C jsmn SHOULD_HAVE_FAILED n_number_invalid+-.json -C jsmn SHOULD_HAVE_FAILED n_number_invalid-negative-real.json -C jsmn SHOULD_HAVE_FAILED n_number_minus_infinity.json -C jsmn SHOULD_HAVE_FAILED n_number_minus_sign_with_trailing_garbage.json -C jsmn SHOULD_HAVE_FAILED n_number_minus_space_1.json -C jsmn SHOULD_HAVE_FAILED n_number_NaN.json -C jsmn SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -C jsmn SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -C jsmn SHOULD_HAVE_FAILED n_number_neg_with_garbage_at_end.json -C jsmn SHOULD_HAVE_FAILED n_number_real_garbage_after_e.json -C jsmn SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -C jsmn SHOULD_HAVE_FAILED n_number_starting_with_dot.json -C jsmn SHOULD_HAVE_FAILED n_number_then_00.json -C jsmn SHOULD_HAVE_FAILED n_number_with_alpha.json -C jsmn SHOULD_HAVE_FAILED n_number_with_alpha_char.json -C jsmn SHOULD_HAVE_FAILED n_number_with_leading_zero.json -C jsmn SHOULD_HAVE_FAILED n_object_bad_value.json -C jsmn SHOULD_HAVE_FAILED n_object_comma_instead_of_colon.json -C jsmn SHOULD_HAVE_FAILED n_object_double_colon.json -C jsmn SHOULD_HAVE_FAILED n_object_garbage_at_end.json -C jsmn SHOULD_HAVE_FAILED n_object_key_with_single_quotes.json -C jsmn SHOULD_HAVE_FAILED n_object_missing_colon.json -C jsmn SHOULD_HAVE_FAILED n_object_missing_key.json -C jsmn SHOULD_HAVE_FAILED n_object_missing_semicolon.json -C jsmn SHOULD_HAVE_FAILED n_object_non_string_key.json -C jsmn SHOULD_HAVE_FAILED n_object_non_string_key_but_huge_number_instead.json -C jsmn SHOULD_HAVE_FAILED n_object_pi_in_key_and_trailing_comma.json -C jsmn SHOULD_HAVE_FAILED n_object_repeated_null_null.json -C jsmn SHOULD_HAVE_FAILED n_object_several_trailing_commas.json -C jsmn SHOULD_HAVE_FAILED n_object_single_quote.json -C jsmn SHOULD_HAVE_FAILED n_object_trailing_comma.json -C jsmn SHOULD_HAVE_FAILED n_object_trailing_comment.json -C jsmn SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -C jsmn SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -C jsmn SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -C jsmn SHOULD_HAVE_FAILED n_object_two_commas_in_a_row.json -C jsmn SHOULD_HAVE_FAILED n_object_unquoted_key.json -C jsmn SHOULD_HAVE_FAILED n_object_with_single_string.json -C jsmn SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -C jsmn SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -C jsmn SHOULD_HAVE_FAILED n_string_iso_latin_1.json -C jsmn SHOULD_HAVE_FAILED n_string_leading_uescaped_thinspace.json -C jsmn SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -C jsmn SHOULD_HAVE_FAILED n_string_no_quotes_with_bad_escape.json -C jsmn SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -C jsmn SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -C jsmn SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -C jsmn SHOULD_HAVE_FAILED n_string_single_quote.json -C jsmn SHOULD_HAVE_FAILED n_string_single_string_no_double_quotes.json -C jsmn SHOULD_HAVE_FAILED n_string_unescaped_newline.json -C jsmn SHOULD_HAVE_FAILED n_string_unescaped_tab.json -C jsmn SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -C jsmn SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -C jsmn SHOULD_HAVE_FAILED n_structure_<.>.json -C jsmn SHOULD_HAVE_FAILED n_structure_.json -C jsmn SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -C jsmn SHOULD_HAVE_FAILED n_structure_capitalized_True.json -C jsmn SHOULD_HAVE_FAILED n_structure_double_array.json -C jsmn SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -C jsmn SHOULD_HAVE_FAILED n_structure_object_with_comment.json -C jsmn SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -C jsmn SHOULD_HAVE_FAILED n_structure_single_star.json -C jsmn SHOULD_HAVE_FAILED n_structure_uescaped_LF_before_string.json -C jsmn SHOULD_HAVE_PASSED y_number_huge_exp.json -C jsmn SHOULD_HAVE_PASSED y_object_long_strings.json -C jsmn SHOULD_HAVE_PASSED y_object_string_unicode.json -C jsmn SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -C jsmn SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Go 1.7.1 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Go 1.7.1 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Go 1.7.1 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Go 1.7.1 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Go 1.7.1 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Go 1.7.1 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Go 1.7.1 SHOULD_HAVE_PASSED y_number_huge_exp.json -Go 1.7.1 SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -Go 1.7.1 SHOULD_HAVE_PASSED y_number_pos_double_huge_exp.json -Go 1.7.1 SHOULD_HAVE_PASSED y_number_real_neg_overflow.json -Go 1.7.1 SHOULD_HAVE_PASSED y_number_real_pos_overflow.json -Go 1.7.1 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Go 1.7.1 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Java Jackson 2.8.4 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Java Jackson 2.8.4 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Java Jackson 2.8.4 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_array_comma_after_close.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_array_extra_close.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_object_trailing_comment.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_structure_double_array.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -Java Jackson 2.8.4 SHOULD_HAVE_FAILED n_structure_trailing_#.json -Java Jackson 2.8.4 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Java Jackson 2.8.4 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Java com.leastfixedpoint.json 1.0 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_-01.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_-2..json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_0.e1.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_2.e+3.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_2.e-3.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_2.e3.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_U+FF11_fullwidth_digit_one.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_object_single_quote.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_invalid_unicode_escape.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_single_quote.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_PASSED y_number_huge_exp.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Java com.leastfixedpoint.json 1.0 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Java gson 2.7 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Java gson 2.7 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Java gson 2.7 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Java gson 2.7 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Java gson 2.7 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_a_invalid_utf8.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_comma_and_number.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_double_comma.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_double_extra_comma.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_extra_comma.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_invalid_utf8.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_just_comma.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_just_minus.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_missing_value.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_number_and_comma.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_number_and_several_commas.json -Java gson 2.7 SHOULD_HAVE_FAILED n_array_star_inside.json -Java gson 2.7 SHOULD_HAVE_FAILED n_incomplete_false.json -Java gson 2.7 SHOULD_HAVE_FAILED n_incomplete_null.json -Java gson 2.7 SHOULD_HAVE_FAILED n_incomplete_true.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_++.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_+1.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_+Inf.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_-01.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_-1.0..json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_-2..json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_-NaN.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_.-1.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_.2e-3.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0.1.2.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0.3e+.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0.3e.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0.e1.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0_capital_E+.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0_capital_E.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0e+.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_0e.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_1.0e+.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_1.0e-.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_1.0e.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_1eE2.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_2.e+3.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_2.e-3.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_2.e3.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_9.e+.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_expression.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_hex_1_digit.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_hex_2_digits.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_Inf.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_infinity.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_invalid+-.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_invalid-negative-real.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_invalid-utf-8-in-bigger-int.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_invalid-utf-8-in-exponent.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_invalid-utf-8-in-int.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_minus_infinity.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_minus_sign_with_trailing_garbage.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_NaN.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_neg_with_garbage_at_end.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_real_garbage_after_e.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_real_with_invalid_utf8_after_e.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_starting_with_dot.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_then_00.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_U+FF11_fullwidth_digit_one.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_with_alpha.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_with_alpha_char.json -Java gson 2.7 SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_bad_value.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_key_with_single_quotes.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_non_string_key.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_non_string_key_but_huge_number_instead.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_repeated_null_null.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_single_quote.json -Java gson 2.7 SHOULD_HAVE_FAILED n_object_unquoted_key.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_accentuated_char_no_quotes.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_single_quote.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_single_string_no_double_quotes.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Java gson 2.7 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_<.>.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_ascii-unicode-identifier.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_capitalized_True.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_lone-invalid-utf-8.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_null-byte-outside-string.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_object_with_comment.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_single_point.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_single_star.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_U+2060_word_joined.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_unicode-identifier.json -Java gson 2.7 SHOULD_HAVE_FAILED n_structure_whitespace_U+2060_word_joiner.json -Java gson 2.7 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Java gson 2.7 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Java gson 2.7 SHOULD_HAVE_PASSED y_structure_lonely_null.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Java json-simple 1.1.1 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Java json-simple 1.1.1 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Java json-simple 1.1.1 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_1_true_without_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_comma_and_number.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_double_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_double_extra_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_extra_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_inner_array_no_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_just_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_missing_value.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_number_and_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_array_number_and_several_commas.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_number_-01.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_number_1_000.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_object_double_colon.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_object_missing_semicolon.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_object_pi_in_key_and_trailing_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_object_several_trailing_commas.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_object_trailing_comma.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_object_two_commas_in_a_row.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u1.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u1x.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_backslash_00.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_escape_x.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_escaped_ctrl_char_tab.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_escaped_emoji.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_incomplete_escaped_character.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_incomplete_surrogate.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_invalid-utf-8-in-escape.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_invalid_unicode_escape.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_invalid_utf8_after_escape.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -Java json-simple 1.1.1 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Java json-simple 1.1.1 SHOULD_HAVE_PASSED y_number_too_big_neg_int.json -Java json-simple 1.1.1 SHOULD_HAVE_PASSED y_number_too_big_pos_int.json -Java json-simple 1.1.1 SHOULD_HAVE_PASSED y_number_very_big_negative_int.json -Java json-simple 1.1.1 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Java json-simple 1.1.1 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Java nanojson 1.0 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Java nanojson 1.0 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_string_UTF-16LE_with_BOM.json -Java nanojson 1.0 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Java nanojson 1.0 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_number_-2..json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_number_0.e1.json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_number_2.e+3.json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_number_2.e-3.json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_number_2.e3.json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Java nanojson 1.0 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -JavaScript IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -JavaScript IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -JavaScript IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -JavaScript IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -JavaScript IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -JavaScript IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -JavaScript IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -JavaScript IMPLEMENTATION_PASS i_string_invalid_surrogate.json -JavaScript IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -JavaScript IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -JavaScript IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -JavaScript IMPLEMENTATION_PASS i_string_truncated-utf-8.json -JavaScript IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -JavaScript IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -JavaScript IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -JavaScript IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -JavaScript IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -JavaScript IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -JavaScript IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -JavaScript IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -JavaScript SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -JavaScript SHOULD_HAVE_FAILED n_string_iso_latin_1.json -JavaScript SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -JavaScript SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -JavaScript SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -JavaScript SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -JavaScript SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -JavaScript SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -JavaScript SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Lua JSON 20160916.19 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Lua JSON 20160916.19 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Lua JSON 20160916.19 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_array_comma_after_close.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_array_extra_close.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_object_trailing_comment.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u1.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u1x.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_backslash_00.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_escape_x.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_escaped_ctrl_char_tab.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_escaped_emoji.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_incomplete_escaped_character.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_incomplete_surrogate.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_invalid-utf-8-in-escape.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_invalid_unicode_escape.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_invalid_utf8_after_escape.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_close_unopened_array.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_double_array.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -Lua JSON 20160916.19 SHOULD_HAVE_FAILED n_structure_trailing_#.json -Lua JSON 20160916.19 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Lua JSON 20160916.19 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Lua JSON 20160916.19 SHOULD_HAVE_PASSED y_structure_lonely_null.json -Lua dkjson IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Lua dkjson IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Lua dkjson IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Lua dkjson IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Lua dkjson IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Lua dkjson IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Lua dkjson IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Lua dkjson IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Lua dkjson IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Lua dkjson IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Lua dkjson IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Lua dkjson IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Lua dkjson IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Lua dkjson IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Lua dkjson IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Lua dkjson IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Lua dkjson IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Lua dkjson IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Lua dkjson IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Lua dkjson IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Lua dkjson SHOULD_HAVE_FAILED n_array_1_true_without_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_array_colon_instead_of_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_array_comma_after_close.json -Lua dkjson SHOULD_HAVE_FAILED n_array_extra_close.json -Lua dkjson SHOULD_HAVE_FAILED n_array_extra_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_array_inner_array_no_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_array_items_separated_by_semicolon.json -Lua dkjson SHOULD_HAVE_FAILED n_array_number_and_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_number_-01.json -Lua dkjson SHOULD_HAVE_FAILED n_number_-2..json -Lua dkjson SHOULD_HAVE_FAILED n_number_.2e-3.json -Lua dkjson SHOULD_HAVE_FAILED n_number_0.e1.json -Lua dkjson SHOULD_HAVE_FAILED n_number_1_000.json -Lua dkjson SHOULD_HAVE_FAILED n_number_2.e+3.json -Lua dkjson SHOULD_HAVE_FAILED n_number_2.e-3.json -Lua dkjson SHOULD_HAVE_FAILED n_number_2.e3.json -Lua dkjson SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Lua dkjson SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Lua dkjson SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Lua dkjson SHOULD_HAVE_FAILED n_number_starting_with_dot.json -Lua dkjson SHOULD_HAVE_FAILED n_number_then_00.json -Lua dkjson SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Lua dkjson SHOULD_HAVE_FAILED n_object_comma_instead_of_colon.json -Lua dkjson SHOULD_HAVE_FAILED n_object_garbage_at_end.json -Lua dkjson SHOULD_HAVE_FAILED n_object_missing_semicolon.json -Lua dkjson SHOULD_HAVE_FAILED n_object_non_string_key.json -Lua dkjson SHOULD_HAVE_FAILED n_object_non_string_key_but_huge_number_instead.json -Lua dkjson SHOULD_HAVE_FAILED n_object_pi_in_key_and_trailing_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_object_trailing_comma.json -Lua dkjson SHOULD_HAVE_FAILED n_object_trailing_comment.json -Lua dkjson SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -Lua dkjson SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Lua dkjson SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -Lua dkjson SHOULD_HAVE_FAILED n_object_with_single_string.json -Lua dkjson SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Lua dkjson SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u.json -Lua dkjson SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u1.json -Lua dkjson SHOULD_HAVE_FAILED n_string_1_surrogate_then_escape u1x.json -Lua dkjson SHOULD_HAVE_FAILED n_string_backslash_00.json -Lua dkjson SHOULD_HAVE_FAILED n_string_escape_x.json -Lua dkjson SHOULD_HAVE_FAILED n_string_escaped_ctrl_char_tab.json -Lua dkjson SHOULD_HAVE_FAILED n_string_escaped_emoji.json -Lua dkjson SHOULD_HAVE_FAILED n_string_incomplete_escaped_character.json -Lua dkjson SHOULD_HAVE_FAILED n_string_incomplete_surrogate.json -Lua dkjson SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -Lua dkjson SHOULD_HAVE_FAILED n_string_invalid-utf-8-in-escape.json -Lua dkjson SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -Lua dkjson SHOULD_HAVE_FAILED n_string_invalid_unicode_escape.json -Lua dkjson SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Lua dkjson SHOULD_HAVE_FAILED n_string_invalid_utf8_after_escape.json -Lua dkjson SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Lua dkjson SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Lua dkjson SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Lua dkjson SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Lua dkjson SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Lua dkjson SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Lua dkjson SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Lua dkjson SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Lua dkjson SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -Lua dkjson SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Lua dkjson SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_close_unopened_array.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_double_array.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_object_with_comment.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_trailing_#.json -Lua dkjson SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Lua dkjson SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Lua dkjson SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_string_UTF-16LE_with_BOM.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Obj-C Apple NSJSONSerialization IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_FAILED n_array_extra_comma.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_FAILED n_array_number_and_comma.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_FAILED n_object_trailing_comma.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_PASSED y_number_double_huge_neg_exp.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_PASSED y_number_huge_exp.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_PASSED y_number_pos_double_huge_exp.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_PASSED y_number_real_pos_overflow.json -Obj-C Apple NSJSONSerialization SHOULD_HAVE_PASSED y_number_real_underflow.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_unicode_U+10FFFE_nonchar.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_unicode_U+1FFFE_nonchar.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_unicode_U+FDD0_nonchar.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_unicode_U+FFFE_nonchar.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Obj-C JSONKit IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Obj-C JSONKit IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Obj-C JSONKit CRASH n_structure_100000_opening_arrays.json -Obj-C JSONKit CRASH n_structure_no_data.json -Obj-C JSONKit CRASH n_structure_open_array_object.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_double_huge_neg_exp.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_huge_exp.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_pos_double_huge_exp.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_real_neg_overflow.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_real_pos_overflow.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_real_underflow.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_too_big_neg_int.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_too_big_pos_int.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_number_very_big_negative_int.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_object_escaped_null_in_key.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_escaped_noncharacter.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_last_surrogates_1_and_2.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+10FFFF.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_nonCharacterInUTF-8_U+FFFF.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_null_escape.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_space.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_lonely_false.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_lonely_int.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_lonely_negative_real.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_lonely_null.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_lonely_string.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_lonely_true.json -Obj-C JSONKit SHOULD_HAVE_PASSED y_structure_string_empty.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Obj-C SBJSON 4.0.3 CRASH i_string_not_in_unicode_range.json -Obj-C SBJSON 4.0.3 CRASH i_string_truncated-utf-8.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Obj-C SBJSON 4.0.3 CRASH i_string_UTF-8_invalid_sequence.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_structure_500_nested_arrays.json -Obj-C SBJSON 4.0.3 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_array_comma_after_close.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_array_extra_close.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Obj-C SBJSON 4.0.3 CRASH n_object_pi_in_key_and_trailing_comma.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_object_trailing_comment.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Obj-C SBJSON 4.0.3 CRASH n_string_invalid_utf-8.json -Obj-C SBJSON 4.0.3 CRASH n_string_iso_latin_1.json -Obj-C SBJSON 4.0.3 CRASH n_string_lone_utf8_continuation_byte.json -Obj-C SBJSON 4.0.3 CRASH n_string_overlong_sequence_2_bytes.json -Obj-C SBJSON 4.0.3 CRASH n_string_overlong_sequence_6_bytes.json -Obj-C SBJSON 4.0.3 CRASH n_string_overlong_sequence_6_bytes_null.json -Obj-C SBJSON 4.0.3 CRASH n_string_UTF8_surrogate_U+D800.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_structure_double_array.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_FAILED n_structure_trailing_#.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_string_space.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_lonely_false.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_lonely_int.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_lonely_negative_real.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_lonely_null.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_lonely_string.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_lonely_true.json -Obj-C SBJSON 4.0.3 SHOULD_HAVE_PASSED y_structure_string_empty.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Obj-C TouchJSON IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Obj-C TouchJSON IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Obj-C TouchJSON IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Obj-C TouchJSON IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Obj-C TouchJSON IMPLEMENTATION_PASS i_string_UTF-16LE_with_BOM.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Obj-C TouchJSON IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Obj-C TouchJSON IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_array_extra_comma.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_array_number_and_comma.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_-01.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_-2..json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0.3e+.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0.3e.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0.e1.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0_capital_E+.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0_capital_E.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0e+.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_0e.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_1.0e+.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_1.0e-.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_1.0e.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_2.e+3.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_2.e-3.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_2.e3.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_9.e+.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_object_trailing_comma.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Obj-C TouchJSON CRASH n_structure_100000_opening_arrays.json -Obj-C TouchJSON CRASH n_structure_open_array_object.json -Obj-C TouchJSON SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -PHP 5.5.36 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -PHP 5.5.36 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_-2..json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_0.e1.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_2.e+3.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_2.e-3.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_2.e3.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_structure_no_data.json -PHP 5.5.36 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -PHP 5.5.36 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Perl JSON IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Perl JSON IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Perl JSON IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Perl JSON IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Perl JSON IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Perl JSON IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Perl JSON IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Perl JSON IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Perl JSON IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Perl JSON IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Perl JSON IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Perl JSON IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Perl JSON IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Perl JSON IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Perl JSON IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Perl JSON IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Perl JSON IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Perl JSON IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Perl JSON IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Perl JSON IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Perl JSON SHOULD_HAVE_FAILED n_array_extra_comma.json -Perl JSON SHOULD_HAVE_FAILED n_array_number_and_comma.json -Perl JSON SHOULD_HAVE_FAILED n_number_then_00.json -Perl JSON SHOULD_HAVE_FAILED n_object_trailing_comma.json -Perl JSON SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Perl JSON SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Perl JSON SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Perl JSON SHOULD_HAVE_FAILED n_structure_trailing_#.json -Perl JSON SHOULD_HAVE_PASSED y_array_with_1_and_newline.json -Perl JSON SHOULD_HAVE_PASSED y_object_with_newlines.json -Perl JSON SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Perl JSON SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Perl JSON SHOULD_HAVE_PASSED y_structure_lonely_null.json -Perl JSON SHOULD_HAVE_PASSED y_structure_string_empty.json -Perl JSON::XS IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Perl JSON::XS IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Perl JSON::XS IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Perl JSON::XS IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Perl JSON::XS IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Perl JSON::XS IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Perl JSON::XS IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Perl JSON::XS IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Perl JSON::XS IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Perl JSON::XS SHOULD_HAVE_FAILED n_array_newlines_unclosed.json -Perl JSON::XS SHOULD_HAVE_FAILED n_array_unclosed_with_new_lines.json -Perl JSON::XS SHOULD_HAVE_FAILED n_number_then_00.json -Perl JSON::XS SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Perl JSON::XS SHOULD_HAVE_PASSED y_array_with_1_and_newline.json -Perl JSON::XS SHOULD_HAVE_PASSED y_object_with_newlines.json -Perl JSON::XS SHOULD_HAVE_PASSED y_string_space.json -Perl JSON::XS SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Perl JSON::XS SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Perl JSON::XS SHOULD_HAVE_PASSED y_structure_lonely_false.json -Perl JSON::XS SHOULD_HAVE_PASSED y_structure_lonely_null.json -Perl JSON::XS SHOULD_HAVE_PASSED y_structure_lonely_string.json -Perl JSON::XS SHOULD_HAVE_PASSED y_structure_string_empty.json -Python 2.7.10 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Python 2.7.10 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Python 2.7.10 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Python 2.7.10 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Python 2.7.10 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Python 2.7.10 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Python 2.7.10 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Python 2.7.10 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Python 2.7.10 SHOULD_HAVE_FAILED n_number_infinity.json -Python 2.7.10 SHOULD_HAVE_FAILED n_number_minus_infinity.json -Python 2.7.10 SHOULD_HAVE_FAILED n_number_NaN.json -Python 2.7.10 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Python 2.7.10 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Python 2.7.10 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -R jsonlite IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -R jsonlite IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -R jsonlite IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -R jsonlite IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -R jsonlite IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -R jsonlite IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -R jsonlite IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -R jsonlite IMPLEMENTATION_PASS i_string_invalid_surrogate.json -R jsonlite IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -R jsonlite IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -R jsonlite IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -R jsonlite IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -R jsonlite IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -R jsonlite IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -R jsonlite IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -R jsonlite IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -R jsonlite IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -R jsonlite IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -R jsonlite IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -R jsonlite IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -R jsonlite SHOULD_HAVE_FAILED n_object_trailing_comment.json -R jsonlite SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -R jsonlite SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -R jsonlite SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -R jsonlite SHOULD_HAVE_FAILED n_structure_object_with_comment.json -R jsonlite SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -R jsonlite SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -R jsonlite SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -R rjson IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -R rjson IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -R rjson IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -R rjson IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -R rjson IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -R rjson IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -R rjson IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -R rjson IMPLEMENTATION_PASS i_string_invalid_surrogate.json -R rjson IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -R rjson IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -R rjson IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -R rjson IMPLEMENTATION_PASS i_string_truncated-utf-8.json -R rjson IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -R rjson IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -R rjson IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -R rjson IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -R rjson IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -R rjson IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -R rjson IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -R rjson IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -R rjson SHOULD_HAVE_FAILED n_array_comma_after_close.json -R rjson SHOULD_HAVE_FAILED n_array_extra_close.json -R rjson SHOULD_HAVE_FAILED n_array_extra_comma.json -R rjson SHOULD_HAVE_FAILED n_array_just_minus.json -R rjson SHOULD_HAVE_FAILED n_array_number_and_comma.json -R rjson SHOULD_HAVE_FAILED n_number_-2..json -R rjson SHOULD_HAVE_FAILED n_number_0.3e+.json -R rjson SHOULD_HAVE_FAILED n_number_0.3e.json -R rjson SHOULD_HAVE_FAILED n_number_0.e1.json -R rjson SHOULD_HAVE_FAILED n_number_0_capital_E+.json -R rjson SHOULD_HAVE_FAILED n_number_0_capital_E.json -R rjson SHOULD_HAVE_FAILED n_number_0e+.json -R rjson SHOULD_HAVE_FAILED n_number_0e.json -R rjson SHOULD_HAVE_FAILED n_number_1.0e+.json -R rjson SHOULD_HAVE_FAILED n_number_1.0e-.json -R rjson SHOULD_HAVE_FAILED n_number_1.0e.json -R rjson SHOULD_HAVE_FAILED n_number_2.e+3.json -R rjson SHOULD_HAVE_FAILED n_number_2.e-3.json -R rjson SHOULD_HAVE_FAILED n_number_2.e3.json -R rjson SHOULD_HAVE_FAILED n_number_9.e+.json -R rjson SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -R rjson SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -R rjson SHOULD_HAVE_FAILED n_number_then_00.json -R rjson SHOULD_HAVE_FAILED n_object_trailing_comment.json -R rjson SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -R rjson SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -R rjson SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -R rjson SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -R rjson SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -R rjson SHOULD_HAVE_FAILED n_string_iso_latin_1.json -R rjson SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -R rjson SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -R rjson SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -R rjson SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -R rjson SHOULD_HAVE_FAILED n_string_unescaped_newline.json -R rjson SHOULD_HAVE_FAILED n_string_unescaped_tab.json -R rjson SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -R rjson SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -R rjson SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -R rjson SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -R rjson SHOULD_HAVE_FAILED n_structure_close_unopened_array.json -R rjson SHOULD_HAVE_FAILED n_structure_double_array.json -R rjson SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -R rjson SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -R rjson SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -R rjson SHOULD_HAVE_FAILED n_structure_trailing_#.json -R rjson SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -R rjson SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Ruby IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Ruby IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Ruby IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Ruby IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Ruby IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Ruby IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Ruby IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Ruby IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Ruby IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Ruby IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Ruby IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Ruby IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Ruby IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Ruby IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Ruby IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Ruby IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Ruby IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Ruby IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Ruby IMPLEMENTATION_FAIL i_structure_500_nested_arrays.json -Ruby IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Ruby SHOULD_HAVE_FAILED n_object_trailing_comment.json -Ruby SHOULD_HAVE_FAILED n_string_escape_x.json -Ruby SHOULD_HAVE_FAILED n_string_escaped_emoji.json -Ruby SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -Ruby SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -Ruby SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Ruby SHOULD_HAVE_FAILED n_string_invalid_utf8_after_escape.json -Ruby SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Ruby SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Ruby SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Ruby SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Ruby SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Ruby SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -Ruby SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Ruby SHOULD_HAVE_FAILED n_structure_object_with_comment.json -Ruby SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Ruby SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Ruby SHOULD_HAVE_PASSED y_structure_lonely_null.json -Ruby regex IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Ruby regex IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Ruby regex IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Ruby regex IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Ruby regex IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Ruby regex IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Ruby regex IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Ruby regex IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Ruby regex IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Ruby regex IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Ruby regex IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Ruby regex IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Ruby regex IMPLEMENTATION_FAIL i_string_unicode_U+10FFFE_nonchar.json -Ruby regex IMPLEMENTATION_FAIL i_string_unicode_U+1FFFE_nonchar.json -Ruby regex IMPLEMENTATION_FAIL i_string_unicode_U+FDD0_nonchar.json -Ruby regex IMPLEMENTATION_FAIL i_string_unicode_U+FFFE_nonchar.json -Ruby regex IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Ruby regex IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Ruby regex IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Ruby regex IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Ruby regex SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Ruby regex SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Ruby regex SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Ruby regex SHOULD_HAVE_FAILED n_structure_capitalized_True.json -Ruby regex CRASH n_structure_open_array_object.json -Ruby regex SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Ruby regex SHOULD_HAVE_PASSED y_object_escaped_null_in_key.json -Ruby regex SHOULD_HAVE_PASSED y_object_string_unicode.json -Ruby regex SHOULD_HAVE_PASSED y_string_1_2_3_bytes_UTF-8_sequences.json -Ruby regex SHOULD_HAVE_PASSED y_string_accepted_surrogate_pair.json -Ruby regex SHOULD_HAVE_PASSED y_string_accepted_surrogate_pairs.json -Ruby regex SHOULD_HAVE_PASSED y_string_allowed_escapes.json -Ruby regex SHOULD_HAVE_PASSED y_string_backslash_and_u_escaped_zero.json -Ruby regex SHOULD_HAVE_PASSED y_string_backslash_doublequotes.json -Ruby regex SHOULD_HAVE_PASSED y_string_double_escape_a.json -Ruby regex SHOULD_HAVE_PASSED y_string_double_escape_n.json -Ruby regex SHOULD_HAVE_PASSED y_string_escaped_control_character.json -Ruby regex SHOULD_HAVE_PASSED y_string_escaped_noncharacter.json -Ruby regex SHOULD_HAVE_PASSED y_string_last_surrogates_1_and_2.json -Ruby regex SHOULD_HAVE_PASSED y_string_newline_uescaped.json -Ruby regex SHOULD_HAVE_PASSED y_string_null_escape.json -Ruby regex SHOULD_HAVE_PASSED y_string_one-byte-utf-8.json -Ruby regex SHOULD_HAVE_PASSED y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json -Ruby regex SHOULD_HAVE_PASSED y_string_three-byte-utf-8.json -Ruby regex SHOULD_HAVE_PASSED y_string_two-byte-utf-8.json -Ruby regex SHOULD_HAVE_PASSED y_string_uEscape.json -Ruby regex SHOULD_HAVE_PASSED y_string_unicode.json -Ruby regex SHOULD_HAVE_PASSED y_string_unicode_escaped_double_quote.json -Ruby regex SHOULD_HAVE_PASSED y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json -Ruby regex SHOULD_HAVE_PASSED y_string_unicode_U+2064_invisible_plus.json -Ruby regex SHOULD_HAVE_PASSED y_string_unicodeEscapedBackslash.json -Ruby regex SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Ruby regex SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Rust json-rust IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Rust json-rust IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Rust json-rust IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Rust json-rust IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Rust json-rust IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Rust json-rust IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Rust json-rust IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Rust json-rust IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Rust json-rust IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Rust json-rust IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Rust json-rust IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Rust json-rust IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Rust json-rust IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Rust json-rust IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Rust json-rust IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Rust json-rust IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Rust json-rust IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Rust json-rust IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Rust json-rust CRASH i_structure_500_nested_arrays.json -Rust json-rust IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Rust json-rust SHOULD_HAVE_FAILED n_number_-2..json -Rust json-rust SHOULD_HAVE_FAILED n_number_0.e1.json -Rust json-rust SHOULD_HAVE_FAILED n_number_2.e+3.json -Rust json-rust SHOULD_HAVE_FAILED n_number_2.e-3.json -Rust json-rust SHOULD_HAVE_FAILED n_number_2.e3.json -Rust json-rust SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Rust json-rust CRASH n_string_accentuated_char_no_quotes.json -Rust json-rust CRASH n_structure_100000_opening_arrays.json -Rust json-rust CRASH n_structure_open_array_object.json -Rust json-rust CRASH n_structure_unicode-identifier.json -Rust json-rust SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Rust json-rust CRASH y_number_huge_exp.json -Rust json-rust SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Rust json-rust SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Rust rustc_serialize::json IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Rust rustc_serialize::json IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Rust rustc_serialize::json IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Rust rustc_serialize::json IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Rust rustc_serialize::json IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Rust rustc_serialize::json IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Rust rustc_serialize::json CRASH n_structure_100000_opening_arrays.json -Rust rustc_serialize::json CRASH n_structure_open_array_object.json -Rust rustc_serialize::json CRASH y_number_huge_exp.json -Rust rustc_serialize::json SHOULD_HAVE_PASSED y_number_too_big_neg_int.json -Rust rustc_serialize::json SHOULD_HAVE_PASSED y_number_too_big_pos_int.json -Rust rustc_serialize::json SHOULD_HAVE_PASSED y_number_very_big_negative_int.json -Rust rustc_serialize::json SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Rust rustc_serialize::json SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Squeak JSON-tonyg CRASH i_string_not_in_unicode_range.json -Squeak JSON-tonyg IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Squeak JSON-tonyg CRASH i_string_UTF-16LE_with_BOM.json -Squeak JSON-tonyg CRASH i_string_UTF-8_invalid_sequence.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Squeak JSON-tonyg IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_array_comma_after_close.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_array_extra_close.json -Squeak JSON-tonyg CRASH n_array_invalid_utf8.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_+1.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_-01.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_-1.0..json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_-2..json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_.2e-3.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0.1.2.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0.3e+.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0.3e.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0.e1.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0_capital_E+.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0_capital_E.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0e+.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_0e.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_1.0e+.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_1.0e-.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_1.0e.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_1eE2.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_2.e+3.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_2.e-3.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_2.e3.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_9.e+.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_expression.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_invalid+-.json -Squeak JSON-tonyg CRASH n_number_invalid-utf-8-in-bigger-int.json -Squeak JSON-tonyg CRASH n_number_invalid-utf-8-in-exponent.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Squeak JSON-tonyg CRASH n_number_real_with_invalid_utf8_after_e.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_starting_with_dot.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_then_00.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_U+FF11_fullwidth_digit_one.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Squeak JSON-tonyg CRASH n_object_pi_in_key_and_trailing_comma.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_object_trailing_comment.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_backslash_00.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_escape_x.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_escaped_ctrl_char_tab.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_escaped_emoji.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_incomplete_surrogate_escape_invalid.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_invalid_backslash_esc.json -Squeak JSON-tonyg CRASH n_string_invalid_utf-8.json -Squeak JSON-tonyg CRASH n_string_lone_utf8_continuation_byte.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Squeak JSON-tonyg CRASH n_string_overlong_sequence_6_bytes.json -Squeak JSON-tonyg CRASH n_string_overlong_sequence_6_bytes_null.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_unicode_CapitalU.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_close_unopened_array.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_double_array.json -Squeak JSON-tonyg CRASH n_structure_lone-invalid-utf-8.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_number_with_trailing_garbage.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_object_with_comment.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -Squeak JSON-tonyg CRASH n_structure_single_point.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_trailing_#.json -Squeak JSON-tonyg SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Squeak JSON-tonyg TIMEOUT y_number_huge_exp.json -Squeak JSON-tonyg TIMEOUT y_number_real_underflow.json -Squeak JSON-tonyg CRASH y_string_nonCharacterInUTF-8_U+10FFFF.json -Squeak JSON-tonyg SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Squeak JSON-tonyg SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_string_UTF-16LE_with_BOM.json -Swift Apple JSONSerialization IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift Apple JSONSerialization IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Swift Apple JSONSerialization SHOULD_HAVE_FAILED n_array_extra_comma.json -Swift Apple JSONSerialization SHOULD_HAVE_FAILED n_array_number_and_comma.json -Swift Apple JSONSerialization SHOULD_HAVE_FAILED n_object_trailing_comma.json -Swift Apple JSONSerialization SHOULD_HAVE_PASSED y_number_double_huge_neg_exp.json -Swift Apple JSONSerialization SHOULD_HAVE_PASSED y_number_huge_exp.json -Swift Apple JSONSerialization SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -Swift Apple JSONSerialization SHOULD_HAVE_PASSED y_number_pos_double_huge_exp.json -Swift Apple JSONSerialization SHOULD_HAVE_PASSED y_number_real_pos_overflow.json -Swift Apple JSONSerialization SHOULD_HAVE_PASSED y_number_real_underflow.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Swift Freddy 2.1.0 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift Freddy 2.1.0 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift Freddy 2.1.0 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift Freddy 2.1.0 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Swift Freddy 2.1.0 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Swift Freddy 2.1.0 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift Freddy 2.1.0 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Swift Freddy 2.1.0 CRASH n_array_newlines_unclosed.json -Swift Freddy 2.1.0 CRASH n_array_unclosed_trailing_comma.json -Swift Freddy 2.1.0 CRASH n_object_missing_value.json -Swift Freddy 2.1.0 CRASH n_single_space.json -Swift Freddy 2.1.0 CRASH n_string_start_escape_unclosed.json -Swift Freddy 2.1.0 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Swift Freddy 2.1.0 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Swift Freddy 2.1.0 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Swift Freddy 2.1.0 CRASH n_structure_object_unclosed_no_value.json -Swift Freddy 2.1.0 SHOULD_HAVE_PASSED y_number_0e+1.json -Swift Freddy 2.1.0 SHOULD_HAVE_PASSED y_number_0e1.json -Swift Freddy 2.1.0 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Swift Freddy 2.1.0 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Swift Freddy 20160830 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift Freddy 20160830 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift Freddy 20160830 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift Freddy 20160830 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Swift Freddy 20160830 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Swift Freddy 20160830 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift Freddy 20160830 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Swift Freddy 20160830 CRASH n_string_start_escape_unclosed.json -Swift Freddy 20160830 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Swift Freddy 20160830 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Swift Freddy 20160830 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Swift Freddy 20160830 SHOULD_HAVE_PASSED y_number_0e+1.json -Swift Freddy 20160830 SHOULD_HAVE_PASSED y_number_0e1.json -Swift Freddy 20160830 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Swift Freddy 20160830 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift Freddy 20161018 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift Freddy 20161018 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Swift Freddy 20161018 CRASH n_string_start_escape_unclosed.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Swift Freddy 20161018 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Swift Freddy 20161018 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Swift Freddy 20161018 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Swift PMJSON 1.1 CRASH i_object_key_lone_2nd_surrogate.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Swift PMJSON 1.1 CRASH i_string_incomplete_surrogate_pair.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Swift PMJSON 1.1 CRASH i_string_inverted_surrogates_U+1D11E.json -Swift PMJSON 1.1 CRASH i_string_lone_second_surrogate.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Swift PMJSON 1.1 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift PMJSON 1.1 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_number_-01.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Swift PMJSON 1.1 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Swift PMJSON 1.1 CRASH n_structure_100000_opening_arrays.json -Swift PMJSON 1.1 CRASH n_structure_open_array_object.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_0e+1.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_real_capital_e_neg_exp.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_real_capital_e_pos_exp.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_real_neg_exp.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_real_pos_exponent.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_number_real_underflow.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Swift PMJSON 1.1 SHOULD_HAVE_PASSED y_structure_lonely_null.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_invalid_lonely_surrogate.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_invalid_surrogate.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -Swift PMJSON 1.2 IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_UTF-16LE_with_BOM.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift PMJSON 1.2 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_array_extra_comma.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_array_number_and_comma.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_number_-01.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_object_pi_in_key_and_trailing_comma.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_object_trailing_comma.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Swift PMJSON 1.2 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Swift PMJSON 1.2 CRASH n_structure_100000_opening_arrays.json -Swift PMJSON 1.2 CRASH n_structure_open_array_object.json -Swift PMJSON 1.2 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Swift PMJSON 1.2 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Swift PMJSON 1.2 SHOULD_HAVE_PASSED y_structure_lonely_null.json -Swift STJSON IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Swift STJSON IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Swift STJSON IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Swift STJSON IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Swift STJSON IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Swift STJSON IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Swift STJSON IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Swift STJSON IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Swift STJSON IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Swift STJSON IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Swift STJSON IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -Swift STJSON IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -Swift STJSON IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Swift STJSON IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Swift STJSON IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Swift STJSON IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Swift STJSON IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -Swift STJSON IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -Swift STJSON IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Swift STJSON IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Swift STJSON SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -Swift STJSON SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_invalid_lonely_surrogate.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_invalid_surrogate.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_not_in_unicode_range.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_truncated-utf-8.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_UTF-16LE_with_BOM.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_string_UTF-8_invalid_sequence.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -Json.NET 9.0.1 IMPLEMENTATION_PASS i_structure_UTF-8_BOM_empty_object.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_comma_after_close.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_comma_and_number.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_double_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_double_extra_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_extra_close.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_extra_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_incomplete.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_just_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_missing_value.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_newlines_unclosed.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_number_and_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_number_and_several_commas.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_unclosed.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_unclosed_trailing_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_unclosed_with_new_lines.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_array_unclosed_with_object_inside.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_-01.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_-2..json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_.2e-3.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_0.e1.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_2.e+3.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_2.e-3.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_2.e3.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_hex_1_digit.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_hex_2_digits.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_infinity.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_minus_infinity.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_NaN.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_neg_int_starting_with_zero.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_neg_real_without_int_part.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_starting_with_dot.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_then_00.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_number_with_leading_zero.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_key_with_single_quotes.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_non_string_key.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_non_string_key_but_huge_number_instead.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_pi_in_key_and_trailing_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_repeated_null_null.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_single_quote.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_trailing_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_trailing_comment.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_trailing_comment_open.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_trailing_comment_slash_open_incomplete.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_unquoted_key.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_object_with_trailing_garbage.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_single_space.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_invalid_utf-8.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_iso_latin_1.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_lone_utf8_continuation_byte.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_2_bytes.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_overlong_sequence_6_bytes_null.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_single_quote.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_unescaped_crtl_char.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_unescaped_newline.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_unescaped_tab.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_UTF8_surrogate_U+D800.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_string_with_trailing_garbage.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_array_trailing_garbage.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_array_with_extra_array_close.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_close_unopened_array.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_double_array.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_lone-invalid-utf-8.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_lone-open-bracket.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_no_data.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_null-byte-outside-string.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_object_followed_by_closing_object.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_object_with_comment.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_object_with_trailing_garbage.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_open_array_comma.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_open_array_open_object.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_open_array_string.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_single_point.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_trailing_#.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_unclosed_array.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_UTF8_BOM_no_data.json -Json.NET 9.0.1 SHOULD_HAVE_FAILED n_structure_whitespace_formfeed.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_huge_exp.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_neg_int_huge_exp.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_pos_double_huge_exp.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_real_neg_overflow.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_real_pos_overflow.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_too_big_neg_int.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_too_big_pos_int.json -Json.NET 9.0.1 SHOULD_HAVE_PASSED y_number_very_big_negative_int.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_0.e1.json -PHP 5.5.36 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_-2..json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_UTF-16_invalid_lonely_surrogate.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_2.e-3.json -PHP 5.5.36 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -PHP 5.5.36 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_2.e3.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_number_2.e+3.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_UTF-16_invalid_surrogate.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -PHP 5.5.36 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -PHP 5.5.36 SHOULD_HAVE_FAILED n_structure_no_data.json -PHP 5.5.36 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -PHP 5.5.36 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_number_0.e1.json -PHP 5.6.28 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_number_-2..json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_UTF-16_invalid_lonely_surrogate.json -PHP 5.6.28 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_1st_surrogate_but_2nd_missing.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_inverted_surrogates_U+1D11E.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_incomplete_surrogate_and_escape_valid.json -PHP 5.6.28 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_lone_second_surrogate.json -PHP 5.6.28 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_incomplete_surrogate_pair.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_number_2.e-3.json -PHP 5.6.28 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_number_real_without_fractional_part.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -PHP 5.6.28 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_number_2.e3.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_number_2.e+3.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_1st_valid_surrogate_2nd_invalid.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_UTF-16_invalid_surrogate.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -PHP 5.6.28 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -PHP 5.6.28 IMPLEMENTATION_PASS i_object_key_lone_2nd_surrogate.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_incomplete_surrogates_escape_valid.json -PHP 5.6.28 SHOULD_HAVE_FAILED n_structure_no_data.json -PHP 5.6.28 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -PHP 5.6.28 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json -PHP 7.0.10 SHOULD_HAVE_PASSED y_string_utf16LE_no_BOM.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_UTF-16_invalid_lonely_surrogate.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_UTF-8_invalid_sequence.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_1st_surrogate_but_2nd_missing.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_inverted_surrogates_U+1D11E.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_and_escape_valid.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_truncated-utf-8.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_lone_second_surrogate.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_structure_UTF-8_BOM_empty_object.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_incomplete_surrogate_pair.json -PHP 7.0.10 SHOULD_HAVE_PASSED y_string_utf16BE_no_BOM.json -PHP 7.0.10 IMPLEMENTATION_PASS i_string_unicode_U+FFFE_nonchar.json -PHP 7.0.10 IMPLEMENTATION_PASS i_structure_500_nested_arrays.json -PHP 7.0.10 IMPLEMENTATION_PASS i_string_unicode_U+FDD0_nonchar.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_1st_valid_surrogate_2nd_invalid.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_UTF-16_invalid_surrogate.json -PHP 7.0.10 IMPLEMENTATION_PASS i_string_unicode_U+1FFFE_nonchar.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_not_in_unicode_range.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_object_key_lone_2nd_surrogate.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_incomplete_surrogates_escape_valid.json -PHP 7.0.10 IMPLEMENTATION_PASS i_string_unicode_U+10FFFE_nonchar.json -PHP 7.0.10 IMPLEMENTATION_FAIL i_string_UTF-16LE_with_BOM.json diff --git a/tests/JSONTestSuite/results/parsing.html b/tests/JSONTestSuite/results/parsing.html deleted file mode 100644 index 979b5ca51..000000000 --- a/tests/JSONTestSuite/results/parsing.html +++ /dev/null @@ -1,2816 +0,0 @@ - - - - - - JSON Parsing Tests - - - - - -

JSON Parsing Tests, Full

-

Appendix to: seriot.ch Parsing JSON is a Minefield http://www.seriot.ch/parsing_json.php

-
2016-10-28 16:59:34
-

Contents

-
    -
  1. Color Scheme -
  2. Full Results -
  3. Results by Parser
- - -

1. Color scheme:

- - - - - - - - -
expected result
parsing should have succeeded but failed
parsing should have failed but succeeded
result undefined, parsing succeeded
result undefined, parsing failed
parser crashed
timeout
- -

2. Full Results

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Bash JSON.sh 2016-08-12
C JSON Checker
C JSON Checker 2
C JSON Parser by udp
C cJSON
C ccan
C jansson
C jsmn
Go 1.7.1
Java Jackson 2.8.4
Java com.leastfixedpoint.json 1.0
Java gson 2.7
Java json-simple 1.1.1
Java nanojson 1.0
JavaScript
Json.NET 9.0.1
Lua JSON 20160916.19
Lua dkjson
Obj-C Apple NSJSONSerialization
Obj-C JSONKit
Obj-C SBJSON 4.0.3
Obj-C TouchJSON
PHP 5.5.36
PHP 5.6.28
PHP 7.0.10
Perl JSON
Perl JSON::XS
Python 2.7.10
R jsonlite
R rjson
Ruby
Ruby regex
Rust json-rust
Rust rustc_serialize::json
Squeak JSON-tonyg
Swift Apple JSONSerialization
Swift Freddy 2.1.0
Swift Freddy 20160830
Swift Freddy 20161018
Swift PMJSON 1.1
Swift PMJSON 1.2
Swift STJSON
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_no_data.json
n_object_missing_value.json {"a":
n_structure_object_unclosed_no_value.json {"":
n_string_start_escape_unclosed.json ["\
n_array_unclosed_trailing_comma.json [1,
n_single_space.json
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_number_then_00.json 100 <=> 1
n_string_escape_x.json ["\x00"]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_unicode_CapitalU.json "\UA66D"
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_structure_whitespace_formfeed.json [0C] <=> [ ]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_number_9.e+.json [9.e+]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_structure_null-byte-outside-string.json [00] <=> []
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_array_just_minus.json [-]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_string_single_doublequote.json "
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_with_trailing_garbage.json {"a":"b"}#
n_object_trailing_comment.json {"a":"b"}/**/
n_array_comma_after_close.json [""],
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_structure_array_trailing_garbage.json [1]x
n_structure_double_array.json [][]
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_string_with_trailing_garbage.json ""x
n_number_-01.json [-01]
n_number_neg_int_starting_with_zero.json [-012]
n_number_with_leading_zero.json [012]
n_number_neg_real_without_int_part.json [-.123]
n_structure_number_with_trailing_garbage.json 2@
n_structure_trailing_#.json {"a":"b"}#{}
n_array_extra_close.json ["x"]]
n_structure_array_with_extra_array_close.json [1]]
n_structure_object_followed_by_closing_object.json {}}
n_structure_close_unopened_array.json 1]
n_array_spaces_vertical_tab_formfeed.json ["0Ba"\f] <=> [" a"\f]
n_number_minus_space_1.json [- 1]
n_object_missing_colon.json {"a" b}
n_object_missing_key.json {:"b"}
n_string_leading_uescaped_thinspace.json [\u0020"asd"]
n_string_no_quotes_with_bad_escape.json [\n]
n_structure_uescaped_LF_before_string.json [\u000A""]
n_object_single_quote.json {'a':0}
n_string_single_quote.json ['single quote']
n_array_star_inside.json [*]
n_incomplete_false.json [fals]
n_incomplete_null.json [nul]
n_incomplete_true.json [tru]
n_number_++.json [++1234]
n_number_+Inf.json [+Inf]
n_number_-NaN.json [-NaN]
n_number_.-1.json [.-1]
n_number_Inf.json [Inf]
n_number_invalid-negative-real.json [-123.123foo]
n_number_minus_sign_with_trailing_garbage.json [-foo]
n_number_neg_with_garbage_at_end.json [-1x]
n_number_real_garbage_after_e.json [1ea]
n_number_with_alpha.json [1.2a-3]
n_number_with_alpha_char.json [1.8011670033376514H-308]
n_object_bad_value.json ["x", truth]
n_string_single_string_no_double_quotes.json abc
n_structure_<.>.json <.>
n_structure_.json []
n_structure_single_star.json *
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_just_comma.json [,]
n_array_missing_value.json [ , ""]
n_array_number_and_several_commas.json [1,,]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_object_key_with_single_quotes.json {key: 'value'}
n_object_repeated_null_null.json {null:null,null:null}
n_object_unquoted_key.json {a: "b"}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_number_.2e-3.json [.2e-3]
n_number_starting_with_dot.json [.123]
n_number_NaN.json [NaN]
n_number_infinity.json [Infinity]
n_number_minus_infinity.json [-Infinity]
n_structure_capitalized_True.json [True]
n_number_+1.json [+1]
n_number_-1.0..json [-1.0.]
n_number_0.1.2.json [0.1.2]
n_number_1eE2.json [1eE2]
n_number_expression.json [1+2]
n_number_invalid+-.json [0e+-1]
n_object_double_colon.json {"x"::"b"}
n_object_several_trailing_commas.json {"id":0,,,,,}
n_object_two_commas_in_a_row.json {"a":"b",,"c":"d"}
n_array_1_true_without_comma.json [1 true]
n_number_1_000.json [1 000.0]
n_object_missing_semicolon.json {"a" "b"}
n_array_colon_instead_of_comma.json ["": 1]
n_array_items_separated_by_semicolon.json [1:2]
n_object_comma_instead_of_colon.json {"x", null}
n_object_garbage_at_end.json {"a":"a" 123}
n_object_with_single_string.json { "foo" : "bar", "a" }
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_array_a_invalid_utf8.json [aE5] <=> [a]
n_number_invalid-utf-8-in-int.json [0E5]0A <=> [0] -
n_structure_U+2060_word_joined.json [E281A0] <=> [⁠]
n_structure_ascii-unicode-identifier.json aC3A5 <=> aå
n_structure_whitespace_U+2060_word_joiner.json [E281A0] <=> [⁠]
n_string_accentuated_char_no_quotes.json [C3A9] <=> [é]
n_structure_unicode-identifier.json C3A5 <=> å
n_array_invalid_utf8.json [FF] <=> []
n_number_invalid-utf-8-in-bigger-int.json [123E5] <=> [123]
n_number_invalid-utf-8-in-exponent.json [1e1E5] <=> [1e1]
n_number_real_with_invalid_utf8_after_e.json [1eE5] <=> [1e]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_single_point.json E9 <=>
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_array_inner_array_no_comma.json [3[4]]
n_array_incomplete.json ["x"
n_array_unclosed.json [""
n_array_unclosed_with_object_inside.json [{}
n_structure_UTF8_BOM_no_data.json EFBBBF <=> 
n_structure_lone-open-bracket.json [
n_structure_open_array_comma.json [,
n_structure_open_array_open_object.json [{
n_structure_open_array_string.json ["a"
n_structure_unclosed_array.json [1
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_unclosed_with_new_lines.json [1,0A10A,1 <=> [1, -1 -,1
y_string_unescaped_char_delete.json ["7F"] <=> [""]
y_string_with_del_character.json ["a7Fa"] <=> ["aa"]
y_string_nonCharacterInUTF-8_U+1FFFF.json ["F09BBFBF"] <=> ["𛿿"]
y_string_pi.json ["CF80"] <=> ["π"]
y_string_u+2028_line_sep.json ["E280A8"] <=> ["
"]
y_string_u+2029_par_sep.json ["E280A9"] <=> ["
"]
y_string_unicode_2.json ["E28D82E388B4E28D82"] <=> ["⍂㈴⍂"]
y_string_utf8.json ["E282ACF09D849E"] <=> ["€𝄞"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_true.json true
y_structure_string_empty.json ""
y_string_space.json " "
y_structure_lonely_false.json false
y_structure_lonely_string.json "asd"
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_number_0e1.json [0e1]
y_number_0e+1.json [0e+1]
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_pos_overflow.json [123123e100000]
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_object_long_strings.json {"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxx(...)
y_object_string_unicode.json {"title":"\u041f\u043e\u043b\u0442\u(...)
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_real_underflow.json [123e-10000000]
y_string_escaped_noncharacter.json ["\uFFFF"]
y_string_last_surrogates_1_and_2.json ["\uDBFF\uDFFF"]
y_array_with_1_and_newline.json [10A] <=> [1 -]
y_object_with_newlines.json {0A"a": "b"0A} <=> { -"a": "b" -}
y_string_1_2_3_bytes_UTF-8_sequences.json ["\u0060\u012a\u12AB"]
y_string_accepted_surrogate_pair.json ["\uD801\udc37"]
y_string_accepted_surrogate_pairs.json ["\ud83d\ude39\ud83d\udc8d"]
y_string_allowed_escapes.json ["\"\\\/\b\f\n\r\t"]
y_string_backslash_and_u_escaped_zero.json ["\\u0000"]
y_string_backslash_doublequotes.json ["\""]
y_string_double_escape_a.json ["\\a"]
y_string_double_escape_n.json ["\\n"]
y_string_escaped_control_character.json ["\u0012"]
y_string_newline_uescaped.json ["new\u00A0line"]
y_string_one-byte-utf-8.json ["\u002c"]
y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json ["\uD834\uDd1e"]
y_string_three-byte-utf-8.json ["\u0821"]
y_string_two-byte-utf-8.json ["\u0123"]
y_string_uEscape.json ["\u0061\u30af\u30EA\u30b9"]
y_string_unicode.json ["\uA66D"]
y_string_unicodeEscapedBackslash.json ["\u005C"]
y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json ["\u200B"]
y_string_unicode_U+2064_invisible_plus.json ["\u2064"]
y_string_unicode_escaped_double_quote.json ["\u0022"]
y_number_real_capital_e_neg_exp.json [1E-2]
y_number_real_capital_e_pos_exp.json [1E+2]
y_number_real_neg_exp.json [1e-2]
y_number_real_pos_exponent.json [1e+2]
- -

3. Results by Parser

-

Bash JSON.sh 2016-08-12

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_real_without_fractional_part.json [1.]
n_number_then_00.json 100 <=> 1
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unicode_CapitalU.json "\UA66D"
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_null-byte-outside-string.json [00] <=> []
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_string_unescaped_char_delete.json ["7F"] <=> [""]
y_string_with_del_character.json ["a7Fa"] <=> ["aa"]
-

-

-

C JSON Checker

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
y_number_0e+1.json [0e+1]
y_number_0e1.json [0e1]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_nonCharacterInUTF-8_U+1FFFF.json ["F09BBFBF"] <=> ["𛿿"]
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_pi.json ["CF80"] <=> ["π"]
y_string_space.json " "
y_string_u+2028_line_sep.json ["E280A8"] <=> ["
"]
y_string_u+2029_par_sep.json ["E280A9"] <=> ["
"]
y_string_unicode_2.json ["E28D82E388B4E28D82"] <=> ["⍂㈴⍂"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_string_utf8.json ["E282ACF09D849E"] <=> ["€𝄞"]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

C JSON Checker 2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_nonCharacterInUTF-8_U+1FFFF.json ["F09BBFBF"] <=> ["𛿿"]
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_pi.json ["CF80"] <=> ["π"]
y_string_space.json " "
y_string_u+2028_line_sep.json ["E280A8"] <=> ["
"]
y_string_u+2029_par_sep.json ["E280A9"] <=> ["
"]
y_string_unicode_2.json ["E28D82E388B4E28D82"] <=> ["⍂㈴⍂"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_string_utf8.json ["E282ACF09D849E"] <=> ["€𝄞"]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

C JSON Parser by udp

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_just_minus.json [-]
n_array_number_and_comma.json [1,]
n_number_then_00.json 100 <=> 1
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

C cJSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_just_minus.json [-]
n_number_-01.json [-01]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_doublequote.json "
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

C ccan

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_then_00.json 100 <=> 1
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

C jansson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

C jsmn

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_1_true_without_comma.json [1 true]
n_array_colon_instead_of_comma.json ["": 1]
n_array_comma_after_close.json [""],
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_comma.json ["",]
n_array_items_separated_by_semicolon.json [1:2]
n_array_just_comma.json [,]
n_array_just_minus.json [-]
n_array_missing_value.json [ , ""]
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_array_spaces_vertical_tab_formfeed.json ["0Ba"\f] <=> [" a"\f]
n_array_star_inside.json [*]
n_incomplete_false.json [fals]
n_incomplete_null.json [nul]
n_incomplete_true.json [tru]
n_number_++.json [++1234]
n_number_+1.json [+1]
n_number_+Inf.json [+Inf]
n_number_-01.json [-01]
n_number_-1.0..json [-1.0.]
n_number_-2..json [-2.]
n_number_-NaN.json [-NaN]
n_number_.-1.json [.-1]
n_number_.2e-3.json [.2e-3]
n_number_0.1.2.json [0.1.2]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_1_000.json [1 000.0]
n_number_1eE2.json [1eE2]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_Inf.json [Inf]
n_number_NaN.json [NaN]
n_number_expression.json [1+2]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_number_infinity.json [Infinity]
n_number_invalid+-.json [0e+-1]
n_number_invalid-negative-real.json [-123.123foo]
n_number_minus_infinity.json [-Infinity]
n_number_minus_sign_with_trailing_garbage.json [-foo]
n_number_minus_space_1.json [- 1]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_neg_with_garbage_at_end.json [-1x]
n_number_real_garbage_after_e.json [1ea]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_alpha.json [1.2a-3]
n_number_with_alpha_char.json [1.8011670033376514H-308]
n_number_with_leading_zero.json [012]
n_object_bad_value.json ["x", truth]
n_object_comma_instead_of_colon.json {"x", null}
n_object_double_colon.json {"x"::"b"}
n_object_garbage_at_end.json {"a":"a" 123}
n_object_key_with_single_quotes.json {key: 'value'}
n_object_missing_colon.json {"a" b}
n_object_missing_key.json {:"b"}
n_object_missing_semicolon.json {"a" "b"}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_repeated_null_null.json {null:null,null:null}
n_object_several_trailing_commas.json {"id":0,,,,,}
n_object_single_quote.json {'a':0}
n_object_trailing_comma.json {"id":0,}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_two_commas_in_a_row.json {"a":"b",,"c":"d"}
n_object_unquoted_key.json {a: "b"}
n_object_with_single_string.json { "foo" : "bar", "a" }
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_leading_uescaped_thinspace.json [\u0020"asd"]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_no_quotes_with_bad_escape.json [\n]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_single_string_no_double_quotes.json abc
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_with_trailing_garbage.json ""x
n_structure_<.>.json <.>
n_structure_.json []
n_structure_array_trailing_garbage.json [1]x
n_structure_capitalized_True.json [True]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_single_star.json *
n_structure_uescaped_LF_before_string.json [\u000A""]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_object_long_strings.json {"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxx(...)
y_object_string_unicode.json {"title":"\u041f\u043e\u043b\u0442\u(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Crystal

-

-

Go 1.7.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Haskell Aeson 0.11.2.1

-

-

Java Jackson 2.8.4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_double_array.json [][]
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Java com.leastfixedpoint.json 1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_with_leading_zero.json [012]
n_object_single_quote.json {'a':0}
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Java gson 2.7

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_a_invalid_utf8.json [aE5] <=> [a]
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_comma.json ["",]
n_array_invalid_utf8.json [FF] <=> []
n_array_just_comma.json [,]
n_array_just_minus.json [-]
n_array_missing_value.json [ , ""]
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_array_star_inside.json [*]
n_incomplete_false.json [fals]
n_incomplete_null.json [nul]
n_incomplete_true.json [tru]
n_number_++.json [++1234]
n_number_+1.json [+1]
n_number_+Inf.json [+Inf]
n_number_-01.json [-01]
n_number_-1.0..json [-1.0.]
n_number_-2..json [-2.]
n_number_-NaN.json [-NaN]
n_number_.-1.json [.-1]
n_number_.2e-3.json [.2e-3]
n_number_0.1.2.json [0.1.2]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_1eE2.json [1eE2]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_Inf.json [Inf]
n_number_NaN.json [NaN]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_number_expression.json [1+2]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_number_infinity.json [Infinity]
n_number_invalid+-.json [0e+-1]
n_number_invalid-negative-real.json [-123.123foo]
n_number_invalid-utf-8-in-bigger-int.json [123E5] <=> [123]
n_number_invalid-utf-8-in-exponent.json [1e1E5] <=> [1e1]
n_number_invalid-utf-8-in-int.json [0E5]0A <=> [0] -
n_number_minus_infinity.json [-Infinity]
n_number_minus_sign_with_trailing_garbage.json [-foo]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_neg_with_garbage_at_end.json [-1x]
n_number_real_garbage_after_e.json [1ea]
n_number_real_with_invalid_utf8_after_e.json [1eE5] <=> [1e]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_alpha.json [1.2a-3]
n_number_with_alpha_char.json [1.8011670033376514H-308]
n_number_with_leading_zero.json [012]
n_object_bad_value.json ["x", truth]
n_object_key_with_single_quotes.json {key: 'value'}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_repeated_null_null.json {null:null,null:null}
n_object_single_quote.json {'a':0}
n_object_unquoted_key.json {a: "b"}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_accentuated_char_no_quotes.json [C3A9] <=> [é]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_single_string_no_double_quotes.json abc
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_<.>.json <.>
n_structure_.json []
n_structure_U+2060_word_joined.json [E281A0] <=> [⁠]
n_structure_ascii-unicode-identifier.json aC3A5 <=> aå
n_structure_capitalized_True.json [True]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_null-byte-outside-string.json [00] <=> []
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_single_point.json E9 <=>
n_structure_single_star.json *
n_structure_unicode-identifier.json C3A5 <=> å
n_structure_whitespace_U+2060_word_joiner.json [E281A0] <=> [⁠]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Java json-simple 1.1.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_1_true_without_comma.json [1 true]
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_comma.json ["",]
n_array_inner_array_no_comma.json [3[4]]
n_array_just_comma.json [,]
n_array_missing_value.json [ , ""]
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_number_-01.json [-01]
n_number_1_000.json [1 000.0]
n_number_neg_int_starting_with_zero.json [-012]
n_number_with_leading_zero.json [012]
n_object_double_colon.json {"x"::"b"}
n_object_missing_semicolon.json {"a" "b"}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_several_trailing_commas.json {"id":0,,,,,}
n_object_trailing_comma.json {"id":0,}
n_object_two_commas_in_a_row.json {"a":"b",,"c":"d"}
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Java nanojson 1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
-

-

-

JavaScript

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Json.NET 9.0.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_close.json ["x"]]
n_array_extra_comma.json ["",]
n_array_incomplete.json ["x"
n_array_just_comma.json [,]
n_array_missing_value.json [ , ""]
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_array_unclosed.json [""
n_array_unclosed_trailing_comma.json [1,
n_array_unclosed_with_new_lines.json [1,0A10A,1 <=> [1, -1 -,1
n_array_unclosed_with_object_inside.json [{}
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_.2e-3.json [.2e-3]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_NaN.json [NaN]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_number_infinity.json [Infinity]
n_number_minus_infinity.json [-Infinity]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_key_with_single_quotes.json {key: 'value'}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_repeated_null_null.json {null:null,null:null}
n_object_single_quote.json {'a':0}
n_object_trailing_comma.json {"id":0,}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_unquoted_key.json {a: "b"}
n_object_with_trailing_garbage.json {"a":"b"}#
n_single_space.json
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_with_trailing_garbage.json ""x
n_structure_UTF8_BOM_no_data.json EFBBBF <=> 
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_lone-open-bracket.json [
n_structure_no_data.json
n_structure_null-byte-outside-string.json [00] <=> []
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_open_array_comma.json [,
n_structure_open_array_open_object.json [{
n_structure_open_array_string.json ["a"
n_structure_single_point.json E9 <=>
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_unclosed_array.json [1
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
-

-

-

Lua JSON 20160916.19

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Lua dkjson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_1_true_without_comma.json [1 true]
n_array_colon_instead_of_comma.json ["": 1]
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_extra_comma.json ["",]
n_array_inner_array_no_comma.json [3[4]]
n_array_items_separated_by_semicolon.json [1:2]
n_array_number_and_comma.json [1,]
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_.2e-3.json [.2e-3]
n_number_0.e1.json [0.e1]
n_number_1_000.json [1 000.0]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_comma_instead_of_colon.json {"x", null}
n_object_garbage_at_end.json {"a":"a" 123}
n_object_missing_semicolon.json {"a" "b"}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_single_string.json { "foo" : "bar", "a" }
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Obj-C Apple NSJSONSerialization

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_object_trailing_comma.json {"id":0,}
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_pos_overflow.json [123123e100000]
y_number_real_underflow.json [123e-10000000]
-

-

-

Obj-C JSONKit

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_no_data.json
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_number_real_underflow.json [123e-10000000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_escaped_noncharacter.json ["\uFFFF"]
y_string_last_surrogates_1_and_2.json ["\uDBFF\uDFFF"]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_null_escape.json ["\u0000"]
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

Obj-C SBJSON 4.0.3

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_number_neg_real_without_int_part.json [-.123]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_double_array.json [][]
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

Obj-C TouchJSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_with_leading_zero.json [012]
n_object_trailing_comma.json {"id":0,}
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_whitespace_formfeed.json [0C] <=> [ ]
-

-

-

PHP 5.5.36

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-16_invalid_lonely_surrogate.json (MISSING FILE)
i_string_UTF-16_invalid_surrogate.json (MISSING FILE)
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_structure_no_data.json
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Perl JSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_number_then_00.json 100 <=> 1
n_object_trailing_comma.json {"id":0,}
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_trailing_#.json {"a":"b"}#{}
y_array_with_1_and_newline.json [10A] <=> [1 -]
y_object_with_newlines.json {0A"a": "b"0A} <=> { -"a": "b" -}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
y_structure_string_empty.json ""
-

-

-

Perl JSON::XS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_unclosed_with_new_lines.json [1,0A10A,1 <=> [1, -1 -,1
n_number_then_00.json 100 <=> 1
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
y_array_with_1_and_newline.json [10A] <=> [1 -]
y_object_with_newlines.json {0A"a": "b"0A} <=> { -"a": "b" -}
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_string_empty.json ""
-

-

-

Python 2.7.10

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_NaN.json [NaN]
n_number_infinity.json [Infinity]
n_number_minus_infinity.json [-Infinity]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Qt JSON

-

-

R jsonlite

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

R rjson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_extra_comma.json ["",]
n_array_just_minus.json [-]
n_array_number_and_comma.json [1,]
n_number_-2..json [-2.]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_then_00.json 100 <=> 1
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Ruby

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_object_trailing_comment.json {"a":"b"}/**/
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_escape_x.json ["\x00"]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unicode_CapitalU.json "\UA66D"
n_structure_object_with_comment.json {"a":/*comment*/"b"}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Ruby Oj (compat mode)

-

-

Ruby Oj (strict mode)

-

-

Ruby Yajl

-

-

Ruby regex

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_capitalized_True.json [True]
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_object_string_unicode.json {"title":"\u041f\u043e\u043b\u0442\u(...)
y_string_1_2_3_bytes_UTF-8_sequences.json ["\u0060\u012a\u12AB"]
y_string_accepted_surrogate_pair.json ["\uD801\udc37"]
y_string_accepted_surrogate_pairs.json ["\ud83d\ude39\ud83d\udc8d"]
y_string_allowed_escapes.json ["\"\\\/\b\f\n\r\t"]
y_string_backslash_and_u_escaped_zero.json ["\\u0000"]
y_string_backslash_doublequotes.json ["\""]
y_string_double_escape_a.json ["\\a"]
y_string_double_escape_n.json ["\\n"]
y_string_escaped_control_character.json ["\u0012"]
y_string_escaped_noncharacter.json ["\uFFFF"]
y_string_last_surrogates_1_and_2.json ["\uDBFF\uDFFF"]
y_string_newline_uescaped.json ["new\u00A0line"]
y_string_null_escape.json ["\u0000"]
y_string_one-byte-utf-8.json ["\u002c"]
y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json ["\uD834\uDd1e"]
y_string_three-byte-utf-8.json ["\u0821"]
y_string_two-byte-utf-8.json ["\u0123"]
y_string_uEscape.json ["\u0061\u30af\u30EA\u30b9"]
y_string_unicode.json ["\uA66D"]
y_string_unicodeEscapedBackslash.json ["\u005C"]
y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json ["\u200B"]
y_string_unicode_U+2064_invisible_plus.json ["\u2064"]
y_string_unicode_escaped_double_quote.json ["\u0022"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Rust json-rust

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_string_accentuated_char_no_quotes.json [C3A9] <=> [é]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_unicode-identifier.json C3A5 <=> å
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Rust rustc_serialize::json

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Rust serde_json

-

-

Squeak JSON-tonyg

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_invalid_utf8.json [FF] <=> []
n_number_+1.json [+1]
n_number_-01.json [-01]
n_number_-1.0..json [-1.0.]
n_number_-2..json [-2.]
n_number_.2e-3.json [.2e-3]
n_number_0.1.2.json [0.1.2]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_1eE2.json [1eE2]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_number_expression.json [1+2]
n_number_invalid+-.json [0e+-1]
n_number_invalid-utf-8-in-bigger-int.json [123E5] <=> [123]
n_number_invalid-utf-8-in-exponent.json [1e1E5] <=> [1e1]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_with_invalid_utf8_after_e.json [1eE5] <=> [1e]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_single_point.json E9 <=>
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_real_underflow.json [123e-10000000]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift Apple JSONSerialization

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_object_trailing_comma.json {"id":0,}
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_pos_overflow.json [123123e100000]
y_number_real_underflow.json [123e-10000000]
-

-

-

Swift Freddy 2.1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_unclosed_trailing_comma.json [1,
n_object_missing_value.json {"a":
n_single_space.json
n_string_start_escape_unclosed.json ["\
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_object_unclosed_no_value.json {"":
y_number_0e+1.json [0e+1]
y_number_0e1.json [0e1]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift Freddy 20160830

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_start_escape_unclosed.json ["\
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
y_number_0e+1.json [0e+1]
y_number_0e1.json [0e1]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift Freddy 20161018

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_start_escape_unclosed.json ["\
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift PMJSON 1.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-01.json [-01]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_with_leading_zero.json [012]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_number_0e+1.json [0e+1]
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_real_capital_e_neg_exp.json [1E-2]
y_number_real_capital_e_pos_exp.json [1E+2]
y_number_real_neg_exp.json [1e-2]
y_number_real_pos_exponent.json [1e+2]
y_number_real_underflow.json [123e-10000000]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Swift PMJSON 1.2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_number_-01.json [-01]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_with_leading_zero.json [012]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Swift STJSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

- - - - - - \ No newline at end of file diff --git a/tests/JSONTestSuite/results/parsing_pruned.html b/tests/JSONTestSuite/results/parsing_pruned.html deleted file mode 100644 index 24bf3a826..000000000 --- a/tests/JSONTestSuite/results/parsing_pruned.html +++ /dev/null @@ -1,2661 +0,0 @@ - - - - - - JSON Parsing Tests - - - - - -

JSON Parsing Tests, Prunned

-

Appendix to: seriot.ch Parsing JSON is a Minefield http://www.seriot.ch/parsing_json.php

-
2016-10-28 16:59:35
-

Contents

-
    -
  1. Color Scheme -
  2. Full Results -
  3. Results by Parser
- - -

1. Color scheme:

- - - - - - - - -
expected result
parsing should have succeeded but failed
parsing should have failed but succeeded
result undefined, parsing succeeded
result undefined, parsing failed
parser crashed
timeout
- -

2. Full Results

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Bash JSON.sh 2016-08-12
C JSON Checker
C JSON Checker 2
C JSON Parser by udp
C cJSON
C ccan
C jansson
C jsmn
Go 1.7.1
Java Jackson 2.8.4
Java com.leastfixedpoint.json 1.0
Java gson 2.7
Java json-simple 1.1.1
Java nanojson 1.0
JavaScript
Json.NET 9.0.1
Lua JSON 20160916.19
Lua dkjson
Obj-C Apple NSJSONSerialization
Obj-C JSONKit
Obj-C SBJSON 4.0.3
Obj-C TouchJSON
PHP 5.5.36
PHP 5.6.28
PHP 7.0.10
Perl JSON
Perl JSON::XS
Python 2.7.10
R jsonlite
R rjson
Ruby
Ruby regex
Rust json-rust
Rust rustc_serialize::json
Squeak JSON-tonyg
Swift Apple JSONSerialization
Swift Freddy 2.1.0
Swift Freddy 20160830
Swift Freddy 20161018
Swift PMJSON 1.1
Swift PMJSON 1.2
Swift STJSON
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_no_data.json
n_object_missing_value.json {"a":
n_string_start_escape_unclosed.json ["\
n_array_unclosed_trailing_comma.json [1,
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
n_number_-2..json [-2.]
n_number_then_00.json 100 <=> 1
n_string_escape_x.json ["\x00"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_number_0.3e+.json [0.3e+]
n_structure_whitespace_formfeed.json [0C] <=> [ ]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_number_9.e+.json [9.e+]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_structure_null-byte-outside-string.json [00] <=> []
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_array_just_minus.json [-]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_array_extra_comma.json ["",]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_string_single_doublequote.json "
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_with_trailing_garbage.json {"a":"b"}#
n_object_trailing_comment.json {"a":"b"}/**/
n_array_comma_after_close.json [""],
n_string_with_trailing_garbage.json ""x
n_number_-01.json [-01]
n_number_neg_real_without_int_part.json [-.123]
n_structure_number_with_trailing_garbage.json 2@
n_structure_trailing_#.json {"a":"b"}#{}
n_array_extra_close.json ["x"]]
n_structure_close_unopened_array.json 1]
n_array_spaces_vertical_tab_formfeed.json ["0Ba"\f] <=> [" a"\f]
n_object_single_quote.json {'a':0}
n_array_star_inside.json [*]
n_array_comma_and_number.json [,1]
n_number_hex_1_digit.json [0x1]
n_object_non_string_key.json {1:1}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_number_.2e-3.json [.2e-3]
n_number_NaN.json [NaN]
n_structure_capitalized_True.json [True]
n_number_+1.json [+1]
n_object_double_colon.json {"x"::"b"}
n_array_1_true_without_comma.json [1 true]
n_array_colon_instead_of_comma.json ["": 1]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_array_a_invalid_utf8.json [aE5] <=> [a]
n_string_accentuated_char_no_quotes.json [C3A9] <=> [é]
n_array_invalid_utf8.json [FF] <=> []
n_structure_lone-invalid-utf-8.json E5 <=>
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_array_inner_array_no_comma.json [3[4]]
n_array_incomplete.json ["x"
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_unclosed_with_new_lines.json [1,0A10A,1 <=> [1, -1 -,1
y_string_unescaped_char_delete.json ["7F"] <=> [""]
y_string_nonCharacterInUTF-8_U+1FFFF.json ["F09BBFBF"] <=> ["𛿿"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_structure_lonely_null.json null
y_structure_lonely_int.json 42
y_structure_string_empty.json ""
y_string_space.json " "
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_number_0e1.json [0e1]
y_number_0e+1.json [0e+1]
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_object_long_strings.json {"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxx(...)
y_object_string_unicode.json {"title":"\u041f\u043e\u043b\u0442\u(...)
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_real_underflow.json [123e-10000000]
y_string_escaped_noncharacter.json ["\uFFFF"]
y_array_with_1_and_newline.json [10A] <=> [1 -]
y_string_1_2_3_bytes_UTF-8_sequences.json ["\u0060\u012a\u12AB"]
y_number_real_capital_e_neg_exp.json [1E-2]
- -

3. Results by Parser

-

Bash JSON.sh 2016-08-12

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_real_without_fractional_part.json [1.]
n_number_then_00.json 100 <=> 1
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unicode_CapitalU.json "\UA66D"
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_null-byte-outside-string.json [00] <=> []
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_string_unescaped_char_delete.json ["7F"] <=> [""]
y_string_with_del_character.json ["a7Fa"] <=> ["aa"]
-

-

-

C JSON Checker

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
y_number_0e+1.json [0e+1]
y_number_0e1.json [0e1]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_nonCharacterInUTF-8_U+1FFFF.json ["F09BBFBF"] <=> ["𛿿"]
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_pi.json ["CF80"] <=> ["π"]
y_string_space.json " "
y_string_u+2028_line_sep.json ["E280A8"] <=> ["
"]
y_string_u+2029_par_sep.json ["E280A9"] <=> ["
"]
y_string_unicode_2.json ["E28D82E388B4E28D82"] <=> ["⍂㈴⍂"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_string_utf8.json ["E282ACF09D849E"] <=> ["€𝄞"]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

C JSON Checker 2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_nonCharacterInUTF-8_U+1FFFF.json ["F09BBFBF"] <=> ["𛿿"]
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_pi.json ["CF80"] <=> ["π"]
y_string_space.json " "
y_string_u+2028_line_sep.json ["E280A8"] <=> ["
"]
y_string_u+2029_par_sep.json ["E280A9"] <=> ["
"]
y_string_unicode_2.json ["E28D82E388B4E28D82"] <=> ["⍂㈴⍂"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_string_utf8.json ["E282ACF09D849E"] <=> ["€𝄞"]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

C JSON Parser by udp

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_just_minus.json [-]
n_array_number_and_comma.json [1,]
n_number_then_00.json 100 <=> 1
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

C cJSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_just_minus.json [-]
n_number_-01.json [-01]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_doublequote.json "
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

C ccan

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_then_00.json 100 <=> 1
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

C jansson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_null_escape.json ["\u0000"]
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

C jsmn

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_1_true_without_comma.json [1 true]
n_array_colon_instead_of_comma.json ["": 1]
n_array_comma_after_close.json [""],
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_comma.json ["",]
n_array_items_separated_by_semicolon.json [1:2]
n_array_just_comma.json [,]
n_array_just_minus.json [-]
n_array_missing_value.json [ , ""]
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_array_spaces_vertical_tab_formfeed.json ["0Ba"\f] <=> [" a"\f]
n_array_star_inside.json [*]
n_incomplete_false.json [fals]
n_incomplete_null.json [nul]
n_incomplete_true.json [tru]
n_number_++.json [++1234]
n_number_+1.json [+1]
n_number_+Inf.json [+Inf]
n_number_-01.json [-01]
n_number_-1.0..json [-1.0.]
n_number_-2..json [-2.]
n_number_-NaN.json [-NaN]
n_number_.-1.json [.-1]
n_number_.2e-3.json [.2e-3]
n_number_0.1.2.json [0.1.2]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_1_000.json [1 000.0]
n_number_1eE2.json [1eE2]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_Inf.json [Inf]
n_number_NaN.json [NaN]
n_number_expression.json [1+2]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_number_infinity.json [Infinity]
n_number_invalid+-.json [0e+-1]
n_number_invalid-negative-real.json [-123.123foo]
n_number_minus_infinity.json [-Infinity]
n_number_minus_sign_with_trailing_garbage.json [-foo]
n_number_minus_space_1.json [- 1]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_neg_with_garbage_at_end.json [-1x]
n_number_real_garbage_after_e.json [1ea]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_alpha.json [1.2a-3]
n_number_with_alpha_char.json [1.8011670033376514H-308]
n_number_with_leading_zero.json [012]
n_object_bad_value.json ["x", truth]
n_object_comma_instead_of_colon.json {"x", null}
n_object_double_colon.json {"x"::"b"}
n_object_garbage_at_end.json {"a":"a" 123}
n_object_key_with_single_quotes.json {key: 'value'}
n_object_missing_colon.json {"a" b}
n_object_missing_key.json {:"b"}
n_object_missing_semicolon.json {"a" "b"}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_repeated_null_null.json {null:null,null:null}
n_object_several_trailing_commas.json {"id":0,,,,,}
n_object_single_quote.json {'a':0}
n_object_trailing_comma.json {"id":0,}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_two_commas_in_a_row.json {"a":"b",,"c":"d"}
n_object_unquoted_key.json {a: "b"}
n_object_with_single_string.json { "foo" : "bar", "a" }
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_leading_uescaped_thinspace.json [\u0020"asd"]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_no_quotes_with_bad_escape.json [\n]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_single_string_no_double_quotes.json abc
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_with_trailing_garbage.json ""x
n_structure_<.>.json <.>
n_structure_.json []
n_structure_array_trailing_garbage.json [1]x
n_structure_capitalized_True.json [True]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_single_star.json *
n_structure_uescaped_LF_before_string.json [\u000A""]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_object_long_strings.json {"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxx(...)
y_object_string_unicode.json {"title":"\u041f\u043e\u043b\u0442\u(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Crystal

-

-

Go 1.7.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Haskell Aeson 0.11.2.1

-

-

Java Jackson 2.8.4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_double_array.json [][]
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Java com.leastfixedpoint.json 1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_with_leading_zero.json [012]
n_object_single_quote.json {'a':0}
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Java gson 2.7

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_a_invalid_utf8.json [aE5] <=> [a]
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_comma.json ["",]
n_array_invalid_utf8.json [FF] <=> []
n_array_just_comma.json [,]
n_array_just_minus.json [-]
n_array_missing_value.json [ , ""]
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_array_star_inside.json [*]
n_incomplete_false.json [fals]
n_incomplete_null.json [nul]
n_incomplete_true.json [tru]
n_number_++.json [++1234]
n_number_+1.json [+1]
n_number_+Inf.json [+Inf]
n_number_-01.json [-01]
n_number_-1.0..json [-1.0.]
n_number_-2..json [-2.]
n_number_-NaN.json [-NaN]
n_number_.-1.json [.-1]
n_number_.2e-3.json [.2e-3]
n_number_0.1.2.json [0.1.2]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_1eE2.json [1eE2]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_Inf.json [Inf]
n_number_NaN.json [NaN]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_number_expression.json [1+2]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_number_infinity.json [Infinity]
n_number_invalid+-.json [0e+-1]
n_number_invalid-negative-real.json [-123.123foo]
n_number_invalid-utf-8-in-bigger-int.json [123E5] <=> [123]
n_number_invalid-utf-8-in-exponent.json [1e1E5] <=> [1e1]
n_number_invalid-utf-8-in-int.json [0E5]0A <=> [0] -
n_number_minus_infinity.json [-Infinity]
n_number_minus_sign_with_trailing_garbage.json [-foo]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_neg_with_garbage_at_end.json [-1x]
n_number_real_garbage_after_e.json [1ea]
n_number_real_with_invalid_utf8_after_e.json [1eE5] <=> [1e]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_alpha.json [1.2a-3]
n_number_with_alpha_char.json [1.8011670033376514H-308]
n_number_with_leading_zero.json [012]
n_object_bad_value.json ["x", truth]
n_object_key_with_single_quotes.json {key: 'value'}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_repeated_null_null.json {null:null,null:null}
n_object_single_quote.json {'a':0}
n_object_unquoted_key.json {a: "b"}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_accentuated_char_no_quotes.json [C3A9] <=> [é]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_single_string_no_double_quotes.json abc
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_<.>.json <.>
n_structure_.json []
n_structure_U+2060_word_joined.json [E281A0] <=> [⁠]
n_structure_ascii-unicode-identifier.json aC3A5 <=> aå
n_structure_capitalized_True.json [True]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_null-byte-outside-string.json [00] <=> []
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_single_point.json E9 <=>
n_structure_single_star.json *
n_structure_unicode-identifier.json C3A5 <=> å
n_structure_whitespace_U+2060_word_joiner.json [E281A0] <=> [⁠]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Java json-simple 1.1.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_1_true_without_comma.json [1 true]
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_comma.json ["",]
n_array_inner_array_no_comma.json [3[4]]
n_array_just_comma.json [,]
n_array_missing_value.json [ , ""]
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_number_-01.json [-01]
n_number_1_000.json [1 000.0]
n_number_neg_int_starting_with_zero.json [-012]
n_number_with_leading_zero.json [012]
n_object_double_colon.json {"x"::"b"}
n_object_missing_semicolon.json {"a" "b"}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_several_trailing_commas.json {"id":0,,,,,}
n_object_trailing_comma.json {"id":0,}
n_object_two_commas_in_a_row.json {"a":"b",,"c":"d"}
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Java nanojson 1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
-

-

-

JavaScript

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Json.NET 9.0.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_comma_and_number.json [,1]
n_array_double_comma.json [1,,2]
n_array_double_extra_comma.json ["x",,]
n_array_extra_close.json ["x"]]
n_array_extra_comma.json ["",]
n_array_incomplete.json ["x"
n_array_just_comma.json [,]
n_array_missing_value.json [ , ""]
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_number_and_comma.json [1,]
n_array_number_and_several_commas.json [1,,]
n_array_unclosed.json [""
n_array_unclosed_trailing_comma.json [1,
n_array_unclosed_with_new_lines.json [1,0A10A,1 <=> [1, -1 -,1
n_array_unclosed_with_object_inside.json [{}
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_.2e-3.json [.2e-3]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_NaN.json [NaN]
n_number_hex_1_digit.json [0x1]
n_number_hex_2_digits.json [0x42]
n_number_infinity.json [Infinity]
n_number_minus_infinity.json [-Infinity]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_key_with_single_quotes.json {key: 'value'}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_repeated_null_null.json {null:null,null:null}
n_object_single_quote.json {'a':0}
n_object_trailing_comma.json {"id":0,}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_unquoted_key.json {a: "b"}
n_object_with_trailing_garbage.json {"a":"b"}#
n_single_space.json
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_single_quote.json ['single quote']
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_with_trailing_garbage.json ""x
n_structure_UTF8_BOM_no_data.json EFBBBF <=> 
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_lone-open-bracket.json [
n_structure_no_data.json
n_structure_null-byte-outside-string.json [00] <=> []
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_open_array_comma.json [,
n_structure_open_array_open_object.json [{
n_structure_open_array_string.json ["a"
n_structure_single_point.json E9 <=>
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_unclosed_array.json [1
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
-

-

-

Lua JSON 20160916.19

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Lua dkjson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_1_true_without_comma.json [1 true]
n_array_colon_instead_of_comma.json ["": 1]
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_extra_comma.json ["",]
n_array_inner_array_no_comma.json [3[4]]
n_array_items_separated_by_semicolon.json [1:2]
n_array_number_and_comma.json [1,]
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_.2e-3.json [.2e-3]
n_number_0.e1.json [0.e1]
n_number_1_000.json [1 000.0]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_comma_instead_of_colon.json {"x", null}
n_object_garbage_at_end.json {"a":"a" 123}
n_object_missing_semicolon.json {"a" "b"}
n_object_non_string_key.json {1:1}
n_object_non_string_key_but_huge_number_instead.json {9999E9999:1}
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_single_string.json { "foo" : "bar", "a" }
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_1_surrogate_then_escape u.json ["\uD800\u"]
n_string_1_surrogate_then_escape u1.json ["\uD800\u1"]
n_string_1_surrogate_then_escape u1x.json ["\uD800\u1x"]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_escaped_character.json ["\u00A"]
n_string_incomplete_surrogate.json ["\uD834\uDd"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid-utf-8-in-escape.json ["\uE5"] <=> ["\u"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_unicode_escape.json ["\uqqqq"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Obj-C Apple NSJSONSerialization

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_object_trailing_comma.json {"id":0,}
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_pos_overflow.json [123123e100000]
y_number_real_underflow.json [123e-10000000]
-

-

-

Obj-C JSONKit

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_no_data.json
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_neg_overflow.json [-123123e100000]
y_number_real_pos_overflow.json [123123e100000]
y_number_real_underflow.json [123e-10000000]
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_string_escaped_noncharacter.json ["\uFFFF"]
y_string_last_surrogates_1_and_2.json ["\uDBFF\uDFFF"]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_nonCharacterInUTF-8_U+FFFF.json ["EFBFBF"] <=> ["￿"]
y_string_null_escape.json ["\u0000"]
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

Obj-C SBJSON 4.0.3

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_number_neg_real_without_int_part.json [-.123]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_double_array.json [][]
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_int.json 42
y_structure_lonely_negative_real.json -0.1
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_lonely_true.json true
y_structure_string_empty.json ""
-

-

-

Obj-C TouchJSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_number_-01.json [-01]
n_number_-2..json [-2.]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_with_leading_zero.json [012]
n_object_trailing_comma.json {"id":0,}
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_whitespace_formfeed.json [0C] <=> [ ]
-

-

-

PHP 5.5.36

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-16_invalid_lonely_surrogate.json (MISSING FILE)
i_string_UTF-16_invalid_surrogate.json (MISSING FILE)
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_structure_no_data.json
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Perl JSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_number_then_00.json 100 <=> 1
n_object_trailing_comma.json {"id":0,}
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_trailing_#.json {"a":"b"}#{}
y_array_with_1_and_newline.json [10A] <=> [1 -]
y_object_with_newlines.json {0A"a": "b"0A} <=> { -"a": "b" -}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
y_structure_string_empty.json ""
-

-

-

Perl JSON::XS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_unclosed_with_new_lines.json [1,0A10A,1 <=> [1, -1 -,1
n_number_then_00.json 100 <=> 1
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
y_array_with_1_and_newline.json [10A] <=> [1 -]
y_object_with_newlines.json {0A"a": "b"0A} <=> { -"a": "b" -}
y_string_space.json " "
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_false.json false
y_structure_lonely_null.json null
y_structure_lonely_string.json "asd"
y_structure_string_empty.json ""
-

-

-

Python 2.7.10

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_NaN.json [NaN]
n_number_infinity.json [Infinity]
n_number_minus_infinity.json [-Infinity]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Qt JSON

-

-

R jsonlite

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

R rjson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_extra_comma.json ["",]
n_array_just_minus.json [-]
n_array_number_and_comma.json [1,]
n_number_-2..json [-2.]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_without_fractional_part.json [1.]
n_number_then_00.json 100 <=> 1
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_trailing_#.json {"a":"b"}#{}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Ruby

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_object_trailing_comment.json {"a":"b"}/**/
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_escape_x.json ["\x00"]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_invalid_utf8_after_escape.json ["\E5"] <=> ["\"]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unicode_CapitalU.json "\UA66D"
n_structure_object_with_comment.json {"a":/*comment*/"b"}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Ruby Oj (compat mode)

-

-

Ruby Oj (strict mode)

-

-

Ruby Yajl

-

-

Ruby regex

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_capitalized_True.json [True]
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_object_escaped_null_in_key.json {"foo\u0000bar": 42}
y_object_string_unicode.json {"title":"\u041f\u043e\u043b\u0442\u(...)
y_string_1_2_3_bytes_UTF-8_sequences.json ["\u0060\u012a\u12AB"]
y_string_accepted_surrogate_pair.json ["\uD801\udc37"]
y_string_accepted_surrogate_pairs.json ["\ud83d\ude39\ud83d\udc8d"]
y_string_allowed_escapes.json ["\"\\\/\b\f\n\r\t"]
y_string_backslash_and_u_escaped_zero.json ["\\u0000"]
y_string_backslash_doublequotes.json ["\""]
y_string_double_escape_a.json ["\\a"]
y_string_double_escape_n.json ["\\n"]
y_string_escaped_control_character.json ["\u0012"]
y_string_escaped_noncharacter.json ["\uFFFF"]
y_string_last_surrogates_1_and_2.json ["\uDBFF\uDFFF"]
y_string_newline_uescaped.json ["new\u00A0line"]
y_string_null_escape.json ["\u0000"]
y_string_one-byte-utf-8.json ["\u002c"]
y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json ["\uD834\uDd1e"]
y_string_three-byte-utf-8.json ["\u0821"]
y_string_two-byte-utf-8.json ["\u0123"]
y_string_uEscape.json ["\u0061\u30af\u30EA\u30b9"]
y_string_unicode.json ["\uA66D"]
y_string_unicodeEscapedBackslash.json ["\u005C"]
y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json ["\u200B"]
y_string_unicode_U+2064_invisible_plus.json ["\u2064"]
y_string_unicode_escaped_double_quote.json ["\u0022"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Rust json-rust

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-2..json [-2.]
n_number_0.e1.json [0.e1]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_real_without_fractional_part.json [1.]
n_string_accentuated_char_no_quotes.json [C3A9] <=> [é]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
n_structure_unicode-identifier.json C3A5 <=> å
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Rust rustc_serialize::json

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_too_big_neg_int.json [-123123123123123123123123123123]
y_number_too_big_pos_int.json [100000000000000000000]
y_number_very_big_negative_int.json [-2374623746732768942798327498324234(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Rust serde_json

-

-

Squeak JSON-tonyg

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_comma_after_close.json [""],
n_array_extra_close.json ["x"]]
n_array_invalid_utf8.json [FF] <=> []
n_number_+1.json [+1]
n_number_-01.json [-01]
n_number_-1.0..json [-1.0.]
n_number_-2..json [-2.]
n_number_.2e-3.json [.2e-3]
n_number_0.1.2.json [0.1.2]
n_number_0.3e+.json [0.3e+]
n_number_0.3e.json [0.3e]
n_number_0.e1.json [0.e1]
n_number_0_capital_E+.json [0E+]
n_number_0_capital_E.json [0E]
n_number_0e+.json [0e+]
n_number_0e.json [0e]
n_number_1.0e+.json [1.0e+]
n_number_1.0e-.json [1.0e-]
n_number_1.0e.json [1.0e]
n_number_1eE2.json [1eE2]
n_number_2.e+3.json [2.e+3]
n_number_2.e-3.json [2.e-3]
n_number_2.e3.json [2.e3]
n_number_9.e+.json [9.e+]
n_number_U+FF11_fullwidth_digit_one.json [EFBC91] <=> [1]
n_number_expression.json [1+2]
n_number_invalid+-.json [0e+-1]
n_number_invalid-utf-8-in-bigger-int.json [123E5] <=> [123]
n_number_invalid-utf-8-in-exponent.json [1e1E5] <=> [1e1]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_real_with_invalid_utf8_after_e.json [1eE5] <=> [1e]
n_number_real_without_fractional_part.json [1.]
n_number_starting_with_dot.json [.123]
n_number_then_00.json 100 <=> 1
n_number_with_leading_zero.json [012]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comment.json {"a":"b"}/**/
n_object_trailing_comment_open.json {"a":"b"}/**//
n_object_trailing_comment_slash_open.json {"a":"b"}//
n_object_trailing_comment_slash_open_incomplete.json {"a":"b"}/
n_object_with_trailing_garbage.json {"a":"b"}#
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_backslash_00.json ["\00"] <=> ["\"]
n_string_escape_x.json ["\x00"]
n_string_escaped_ctrl_char_tab.json ["\09"] <=> ["\ "]
n_string_escaped_emoji.json ["\F09F8C80"] <=> ["\🌀"]
n_string_incomplete_surrogate_escape_invalid.json ["\uD800\uD800\x"]
n_string_invalid_backslash_esc.json ["\a"]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_string_unicode_CapitalU.json "\UA66D"
n_string_with_trailing_garbage.json ""x
n_structure_array_trailing_garbage.json [1]x
n_structure_array_with_extra_array_close.json [1]]
n_structure_close_unopened_array.json 1]
n_structure_double_array.json [][]
n_structure_lone-invalid-utf-8.json E5 <=>
n_structure_number_with_trailing_garbage.json 2@
n_structure_object_followed_by_closing_object.json {}}
n_structure_object_with_comment.json {"a":/*comment*/"b"}
n_structure_object_with_trailing_garbage.json {"a": true} "x"
n_structure_single_point.json E9 <=>
n_structure_trailing_#.json {"a":"b"}#{}
n_structure_whitespace_formfeed.json [0C] <=> [ ]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_real_underflow.json [123e-10000000]
y_string_nonCharacterInUTF-8_U+10FFFF.json ["F48FBFBF"] <=> ["􏿿"]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift Apple JSONSerialization

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_object_trailing_comma.json {"id":0,}
y_number_double_huge_neg_exp.json [123.456e-789]
y_number_huge_exp.json [0.4e0066999999999999999999999999999(...)
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_pos_double_huge_exp.json [1.5e+9999]
y_number_real_pos_overflow.json [123123e100000]
y_number_real_underflow.json [123e-10000000]
-

-

-

Swift Freddy 2.1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_newlines_unclosed.json ["a",0A40A,1, <=> ["a", -4 -,1,
n_array_unclosed_trailing_comma.json [1,
n_object_missing_value.json {"a":
n_single_space.json
n_string_start_escape_unclosed.json ["\
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
n_structure_object_unclosed_no_value.json {"":
y_number_0e+1.json [0e+1]
y_number_0e1.json [0e1]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift Freddy 20160830

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_start_escape_unclosed.json ["\
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
y_number_0e+1.json [0e+1]
y_number_0e1.json [0e1]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift Freddy 20161018

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_string_start_escape_unclosed.json ["\
n_string_unescaped_crtl_char.json ["a00a"] <=> ["aa"]
n_string_unescaped_newline.json ["new0Aline"] <=> ["new -line"]
n_string_unescaped_tab.json ["09"] <=> [" "]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

-

-

Swift PMJSON 1.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_number_-01.json [-01]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_with_leading_zero.json [012]
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_number_0e+1.json [0e+1]
y_number_neg_int_huge_exp.json [-1e+9999]
y_number_real_capital_e_neg_exp.json [1E-2]
y_number_real_capital_e_pos_exp.json [1E+2]
y_number_real_neg_exp.json [1e-2]
y_number_real_pos_exponent.json [1e+2]
y_number_real_underflow.json [123e-10000000]
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Swift PMJSON 1.2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
n_array_extra_comma.json ["",]
n_array_number_and_comma.json [1,]
n_number_-01.json [-01]
n_number_neg_int_starting_with_zero.json [-012]
n_number_neg_real_without_int_part.json [-.123]
n_number_with_leading_zero.json [012]
n_object_pi_in_key_and_trailing_comma.json {"B9":"0",} <=> {"":"0",}
n_object_trailing_comma.json {"id":0,}
n_string_UTF8_surrogate_U+D800.json ["EDA080"] <=> [""]
n_string_invalid_utf-8.json ["FF"] <=> [""]
n_string_iso_latin_1.json ["E9"] <=> [""]
n_string_lone_utf8_continuation_byte.json ["81"] <=> [""]
n_string_overlong_sequence_2_bytes.json ["C0AF"] <=> [""]
n_string_overlong_sequence_6_bytes.json ["FC83BFBFBFBF"] <=> [""]
n_string_overlong_sequence_6_bytes_null.json ["FC8080808080"] <=> [""]
n_structure_100000_opening_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
n_structure_open_array_object.json [{"":[{"":[{"":[{"":[{"":[{"":[{"":[(...)
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
y_structure_lonely_null.json null
-

-

-

Swift STJSON

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
i_object_key_lone_2nd_surrogate.json {"\uDFAA":0}
i_string_1st_surrogate_but_2nd_missing.json ["\uDADA"]
i_string_1st_valid_surrogate_2nd_invalid.json ["\uD888\u1234"]
i_string_UTF-16LE_with_BOM.json FFFE[00"00E900"00]00 <=> [""]
i_string_UTF-8_invalid_sequence.json ["E697A5D188FA"] <=> ["日ш"]
i_string_incomplete_surrogate_and_escape_valid.json ["\uD800\n"]
i_string_incomplete_surrogate_pair.json ["\uDd1ea"]
i_string_incomplete_surrogates_escape_valid.json ["\uD800\uD800\n"]
i_string_invalid_lonely_surrogate.json ["\ud800"]
i_string_invalid_surrogate.json ["\ud800abc"]
i_string_inverted_surrogates_U+1D11E.json ["\uDd1e\uD834"]
i_string_lone_second_surrogate.json ["\uDFAA"]
i_string_not_in_unicode_range.json ["F4BFBFBF"] <=> [""]
i_string_truncated-utf-8.json ["E0FF"] <=> [""]
i_string_unicode_U+10FFFE_nonchar.json ["\uDBFF\uDFFE"]
i_string_unicode_U+1FFFE_nonchar.json ["\uD83F\uDFFE"]
i_string_unicode_U+FDD0_nonchar.json ["\uFDD0"]
i_string_unicode_U+FFFE_nonchar.json ["\uFFFE"]
i_structure_500_nested_arrays.json [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[(...)
i_structure_UTF-8_BOM_empty_object.json EFBBBF{} <=> {}
y_string_utf16BE_no_BOM.json 00[00"00E900"00] <=> [""]
y_string_utf16LE_no_BOM.json [00"00E900"00]00 <=> [""]
-

- - - - - - \ No newline at end of file diff --git a/tests/JSONTestSuite/results/pruned_results.png b/tests/JSONTestSuite/results/pruned_results.png deleted file mode 100644 index dcc9c81a8..000000000 Binary files a/tests/JSONTestSuite/results/pruned_results.png and /dev/null differ diff --git a/tests/JSONTestSuite/results/style.css b/tests/JSONTestSuite/results/style.css deleted file mode 100644 index b38c3e878..000000000 --- a/tests/JSONTestSuite/results/style.css +++ /dev/null @@ -1,89 +0,0 @@ -body { -} - -/* -.verticalTableHeader { - text-align:center; - white-space:nowrap; - transform-origin:50% 50%; - -webkit-transform: rotate(-90deg); - -moz-transform: rotate(-90deg); - -ms-transform: rotate(-90deg); - -o-transform: rotate(-90deg); - transform: rotate(-90deg); - -} - -.verticalTableHeader:before { - content:''; - padding-top:110%; - display:inline-block; - vertical-align:middle; -} -*/ - -table { - border-collapse: collapse; - font-family: monospace; - font-size: 12px; -} -/* -table, td, th { - border: 1px solid black; -} -*/ -th.vertical { - /* Something you can count on */ - height: 240px; - white-space: nowrap; -} - -th.vertical > div { - transform: - translate(0px, 105px) - rotate(270deg); /* 360 - 90 */ - width: 16px; -} - -th.space > div { - width: 16px; -} - -/* - colors from https://www.pinterest.com/pin/479000110340670725/ - */ - -.EXPECTED_RESULT { - border: 1px solid black; - background-color: #CCFFCC; -} - -.SHOULD_HAVE_FAILED { - border: 1px solid black; - background-color: #FFCC33; -} - -.SHOULD_HAVE_PASSED { - border: 1px solid black; - background-color: #CC6600; -} - -.CRASH { - border: 1px solid black; - background-color: #FF3333; -} - -.TIMEOUT { - border: 1px solid black; - background-color: #666666; -} - -.IMPLEMENTATION_PASS { - border: 1px solid black; - background-color: #0066FF; -} - -.IMPLEMENTATION_FAIL { - border: 1px solid black; - background-color: #66CCFF; -} diff --git a/tests/JSONTestSuite/results/transform.html b/tests/JSONTestSuite/results/transform.html deleted file mode 100644 index 461dea76d..000000000 --- a/tests/JSONTestSuite/results/transform.html +++ /dev/null @@ -1,1492 +0,0 @@ - - - - - JSON Transform Tests - - - - - -

JSON Transform Tests

-

Appendix to: Parsing JSON is a Minefield

-
2016-10-17 22:00:00
- -
    -
  1. Numbers
  2. -
  3. Objects
  4. -
  5. Strings
  6. -
- -

Numbers

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized1.0Double
Freddy1.0Double
MyJSON1.0NSNumber - double
JSONSerialization1.0NSNumber - double
JSONKit1.0NSNumber - double
Lua JSON 20160728.171number
Lua dkjson1number
Ruby1.0Float
Rust 1.12.0 / json 0.10.21.0Number
-

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized1.000000000000000005Double
Freddy1.0Double
MyJSON1.0NSNumber - double
JSONSerialization1.0NSNumber - double
JSONKit1.0NSNumber - double
Lua JSON 20160728.171number
Lua dkjson1number
Ruby1.0Float
Rust 1.12.0 / json 0.10.21.000000000000000005Number
-

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized1E-999Double
Freddy1E-999String
MyJSON0NSNumber - double
JSONSerializationError
JSONKitError
Lua JSON 20160728.170number
Lua dkjson0number
Ruby0.0Float
Rust 1.12.0 / json 0.10.21E-999Number
-

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized1E6Double
Freddy1000000.0Double
MyJSON1000000NSNumber - double
JSONSerialization1000000.0NSNumber - double
JSONKit1000000.0NSNumber - double
Lua JSON 20160728.171000000number
Lua dkjson1000000number
Ruby1000000.0Float
Rust 1.12.0 / json 0.10.21E6Number
-

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized1000000000000000Int
Freddy1000000000000000Int
MyJSON1000000000000000NSNumber - long long
JSONSerialization1000000000000000NSNumber - long long
JSONKit1000000000000000NSNumber - long long
Lua JSON 20160728.171e+15number
Lua dkjson1e+15number
Ruby1000000000000000Fixnum
Rust 1.12.0 / json 0.10.21000000000000000Number
-

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized10000000000000000999Int
Freddy10000000000000000999String
MyJSON10000000000000000999String
JSONSerialization10000000000000000999NSDecimalNumber - double
JSONKit10000000000000000999unsigned long long
cJSON10000000000000002048double
Lua JSON 20160728.171e+19number
Lua dkjson1e+19number
Lua dkjson10000000000000000999Bignum
Rust 1.12.0 / json 0.10.210000000000000000999Number
-

- -

Objects

- -

Objects - Key NFC, key NFD

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized{"C3A9:"NFC","65CC81":"NFD"}{"é":"NFC","é":"NFD"}
Freddy{"65CC81":"NFD"}
MyJSON{"65CC81":"NFD"}
Swift JSONSerialization{"65CC81":"NFD"}
Obj-C NSJSONSerialization{"C3A9:"NFC","65CC81":"NFD"}
Obj-C SBJSON{"C3A9:"NFC","65CC81":"NFD"}
JSONKit{"C3A9:"NFC","65CC81":"NFD"}
C cJSON{"C3A9:"NFC","65CC81":"NFD"}
Go{"C3A9:"NFC","65CC81":"NFD"}
Python 3.5.2{"C3A9:"NFC","65CC81":"NFD"}
JavaScript{"C3A9:"NFC","65CC81":"NFD"}
R rjson{"C3A9:"NFC","65CC81":"NFD"}
R jsonlite{"C3A9:"NFC","65CC81":"NFD"}
Lua JSON 20160728.17{"C3A9:"NFC","65CC81":"NFD"}
Lua dkjson{"C3A9:"NFC","65CC81":"NFD"}
Ruby{"C3A9:"NFC","65CC81":"NFD"}
Rust 1.12.0 / json 0.10.2{"C3A9:"NFC","65CC81":"NFD"}
-

- -

Objects - Key NFD, key NFC

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized{"65CC81":"NFD","C3A9:"NFC"}{"é":"NFD","é":"NFC"}
Freddy{"C3A9":"NFC"}
MyJSON{"C3A9":"NFC"}
Swift JSONSerialization{"C3A9":"NFC"}
Obj-C NSJSONSerialization{"C3A9:"NFC","65CC81":"NFD"}
Obj-C SBJSON{"C3A9:"NFC","65CC81":"NFD"}
JSONKit{"C3A9:"NFC","65CC81":"NFD"}
C cJSON{"C3A9:"NFC","65CC81":"NFD"}
Go{"65CC81":"NFD","C3A9:"NFC"}
Python 2{"65CC81":"NFD","C3A9:"NFC"}
Python 3{"C3A9:"NFC","65CC81":"NFD"}
JavaScript{"65CC81":"NFD","C3A9:"NFC"}
R rjson{"65CC81":"NFD","C3A9:"NFC"}
R jsonlite{"65CC81":"NFD","C3A9:"NFC"}
Lua JSON 20160728.17{"C3A9:"NFC","65CC81":"NFD"}
Lua dkjson{"C3A9:"NFC","65CC81":"NFD"}
Ruby{"65CC81":"NFD","C3A9:"NFC"}
Rust 1.12.0 / json 0.10.2{"65CC81":"NFD","C3A9:"NFC"}
-

- -

Objects - Same keys, different values

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized{"a":1,"a":2}
Freddy{"a":2}
MyJSON{"a":2}
Swift JSONSerialization{"a":1}
Obj-C NSJSONSerialization{"a":1}
Obj-C SBJSON{"a":2}
JSONKit{"a":2}
C cJSON{"a":1,"a":2}
Go{"a":2}
Python 2{"a":2}
Python 3{"a":2}
JavaScript{"a":2}
R rjson{"a":1,"a":2}
R jsonlite{"a":1,"a":2}
Lua JSON 20160728.17{"a":1,"a":2}
Lua dkjson{"a":2}
Ruby{"a":2}
Rust 1.12.0 / json 0.10.2{"a":2}
-

- -

Objects - Same keys, same values

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized{"a":1,"a":1}
Freddy{"a":1}
MyJSON{"a":1}
Swift JSONSerialization{"a":1}
Obj-C NSJSONSerialization{"a":1}
Obj-C SBJSON{"a":1}
JSONKit{"a":1}
C cJSON{"a":1,"a":1}
Go{"a":1}
Python 2{"a":1}
Python 3{"a":1}
JavaScript{"a":1}
R rjson{"a":1,"a":1}
R jsonlite{"a":1,"a":1}
Lua JSON 20160728.17{"a":1,"a":1}
Lua dkjson{"a":1}
Ruby{"a":1}
Rust 1.12.0 / json 0.10.2{"a":1}
-

- -

Objects - Same keys, values 0 and -0

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized{"a":0,"a":-0}
Freddy{"a":0}
MyJSON{"a":0}
Swift JSONSerialization
Obj-C NSJSONSerialization{"a":0}
Obj-C SBJSON{"a":0}
JSONKit{"a":-0}
C cJSON{"a":0, "a":0}
Go{"a":-0}
Python 2{"a":0}
Python 3{"a":0}
JavaScript{"a":-0}
R rjson{"a":0, "a":0}
R jsonlite{"a":0, "a":0}
Lua JSON 20160728.17{"a":-0}
Lua dkjson{"a":-0}
Ruby{"a":0}
Rust 1.12.0 / json 0.10.2{"a":0}
-

- -

Strings

- -

String - String with escaped NULL

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["A\u0000B"]
Freddy["A"]
MyJSON["A00B"]
Swift JSONSerialization["A00B"]
Obj-C NSJSONSerialization["A00B"]
Obj-C SBJSON["A00B"]
JSONKitnil
C cJSONNULL
Go["A00B"]
Python 2["A00B"]
Python 3["A00B"]
JavaScript["A00B"]
Lua JSON 20160728.17["A00B"]
Lua dkjson["A00B"]
Ruby["A00B"]
Rust 1.12.0 / json 0.10.2["A00B"]
-

- -

String - 1 escaped invalid codepoint

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["\uD800"]
FreddyUnicodeEscapeInvalid(2) -
MyJSON["EFBFBD"]�, U+FFFD REPLACEMENT CHARACTER
Swift JSONSerializationError Domain=NSCocoaErrorDomain, Code=3840, "Unexpected end of file during string parse (expected low-surrogate code point but did not find one)."
Obj-C NSJSONSerializationError Domain=NSCocoaErrorDomain, Code=3840, "Unexpected end of file during string parse (expected low-surrogate code point but did not find one)."
Obj-C SBJSONWaitingForData - a partial document was found and more data is required to complete it
JSONKitError Domain=JKErrorDomain Code=-1 "Required a second \u Unicode escape sequence following a surrogate \u Unicode escape sequence."
C cJSONNULL
Go["EFBFBD"]�, U+FFFD REPLACEMENT CHARACTER
Python 2["\uD800"]
Python 3["\uD800"]
JavaScript["EFBFBD"]�, U+FFFD REPLACEMENT CHARACTER
R rjson["EDA080"]
R jsonlite["?"]
Lua JSON 20160728.17["?"]
Lua dkjson["EDA080"]
Rubynil
Rust 1.12.0 / json 0.10.2UnexpectedCharacter { ch: '\"', line: 1, column: 9 }
-

- -

String - 2 escaped invalid codepoints

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["\uD800\uD800"]
FreddyUnicodeEscapeInvalid(2)
MyJSON["EFBFBDEFBFBD"]["��"]
Swift JSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Invalid surrogate pair in unicode escape sequence around character 10."
Obj-C NSJSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Invalid surrogate pair in unicode escape sequence around character 10."
Obj-C SBJSONError Domain=org.sbjson.parser Code=3 "Invalid low character in surrogate pair at index 14"
JSONKitError Domain=JKErrorDomain Code=-1 "Illegal \u Unicode escape sequence."
C cJSONNULL
Go["EFBFBDEFBFBD"]["��"]
Python 2["\ud800\ud800"]
Python 3["\ud800\ud800"]
JavaScript["EFBFBDEFBFBD"]["��"]
R rjson["EDA080EDA080"]
R jsonlite["\U00010000"]
Lua JSON 20160728.17["??"]
Lua dkjson["EDA080EDA080"]
Ruby["F0908080"]??
Rust 1.12.0 / json 0.10.2FailedUtf8Parsing
-

- -

String - 3 escaped invalid codepoints

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["\uD800\uD800\uD800"]
FreddyUnicodeEscapeInvalid(2)
MyJSON["EFBFBDEFBFBDEFBFBD"]["���"]
Swift JSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Invalid surrogate pair in unicode escape sequence around character 10."
Obj-C NSJSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Invalid surrogate pair in unicode escape sequence around character 10."
Obj-C SBJSONError Domain=org.sbjson.parser Code=3 "Invalid low character in surrogate pair at index 14"
JSONKitError Domain=JKErrorDomain Code=-1 "Illegal \u Unicode escape sequence."
C cJSONNULL
Go["EFBFBDEFBFBDEFBFBD"]["���"]
Python 2["\ud800\ud800\ud800"]
Python 3["\ud800\ud800\ud800"]
JavaScript["EFBFBDEFBFBDEFBFBD"]["���"]
R rjson["EDA080EDA080EDA080"]
R jsonlite["\U00010000?"]
Lua JSON 20160728.17["???"]
Lua dkjson["EDA080EDA080EDA080"]
Rubynil
Rust 1.12.0 / json 0.10.2FailedUtf8Parsing
-

- -

String - 1 invalid codepoint

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["EDA080"]
FreddyUnicodeEscapeInvalid(1)
MyJSONcannotBuildStringFromData(5)
Swift JSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 1."
Obj-C NSJSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 1."
Obj-C SBJSONCRASH
JSONKitError Domain=JKErrorDomain Code=-1 "Illegal UTF8 sequence found in "" string."
C cJSON["EDA080"]
Go["EFBFBDEFBFBDEFBFBD"]���, U+FFFD REPLACEMENT CHARACTER
Python 2["\ud800"]
Python 3UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 2: invalid continuation byt
JavaScript["EFBFBDEFBFBDEFBFBD"]���, U+FFFD REPLACEMENT CHARACTER
R rjson["EDA080"]
R jsonlite["EDA080"]
Lua JSON 20160728.17["EDA080"]
Lua dkjson["EDA080"]
Ruby["EDA080"]
Rust 1.12.0 / json 0.10.2InvalidData - stream did not contain valid UTF-8
-

- -

String - 2 invalid codepoints

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["EDA080EDA080"]
FreddyUnicodeEscapeInvalid(1)
MyJSONcannotBuildStringFromData(8)
Swift JSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 1."
Obj-C NSJSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 1."
Obj-C SBJSON
JSONKitError Domain=JKErrorDomain Code=-1 "Illegal UTF8 sequence found in "" string."
C cJSON["EDA080EDA080"]
Go[������]
Python 2["\ud800\ud800"]
Python 3UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 2: invalid continuation byte
JavaScript["������"]
R rjson["EDA080EDA080"]
R jsonlite["EDA080EDA080"]
Lua JSON 20160728.17["EDA080EDA080"]
Lua dkjson["EDA080EDA080"]
Ruby["EDA080EDA080"]
Rust 1.12.0 / json 0.10.2InvalidData - stream did not contain valid UTF-8
-

- -

String - 3 invalid codepoints

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serialized["EDA080EDA080EDA080"]
FreddyUnicodeEscapeInvalid(1)
MyJSONcannotBuildStringFromData(11)
Swift JSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 1."
Obj-C NSJSONSerializationError Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 1."
Obj-C SBJSONCRASH
JSONKitError Domain=JKErrorDomain Code=-1 "Illegal UTF8 sequence found in "" string."
C cJSON["EDA080EDA080EDA080"]
Go["���������"]
Python 2["\ud800\ud800\ud800"]
Python 3UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 2: invalid continuation byte
JavaScript["���������"]
R rjson["EDA080EDA080EDA080"]
R jsonlite["EDA080EDA080EDA080"]
Lua JSON 20160728.17["EDA080EDA080EDA080"]
Lua dkjson["EDA080EDA080EDA080"]
Ruby["EDA080EDA080EDA080"]nil
Rust 1.12.0 / json 0.10.2InvalidData - stream did not contain valid UTF-8
-

- - - - diff --git a/tests/JSONTestSuite/run_tests.py b/tests/JSONTestSuite/run_tests.py deleted file mode 100755 index d15f94f00..000000000 --- a/tests/JSONTestSuite/run_tests.py +++ /dev/null @@ -1,673 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -from os import listdir -from time import strftime - -BASE_DIR = os.path.dirname(os.path.realpath(__file__)) -PARSERS_DIR = os.path.join(BASE_DIR, "parsers") -TEST_CASES_DIR_PATH = os.path.join(BASE_DIR, "test_parsing") -LOGS_DIR_PATH = os.path.join(BASE_DIR, "results") -LOG_FILENAME = "logs.txt" -LOG_FILE_PATH = os.path.join(LOGS_DIR_PATH, LOG_FILENAME) - -programs = { - "Bash JSON.sh 2016-08-12": - { - "url":"https://github.com/dominictarr/JSON.sh", - "commands":[os.path.join(PARSERS_DIR, "test_Bash_JSON/JSON.sh")], - "use_stdin":True - }, - "R rjson": - { - "url":"", - "commands":["/usr/local/bin/RScript", os.path.join(PARSERS_DIR, "test_rjson.r")] - }, - "R jsonlite": - { - "url":"", - "commands":["/usr/local/bin/RScript", os.path.join(PARSERS_DIR, "test_jsonlite.r")] - }, - "Obj-C JSONKit": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_JSONKit/bin/test-JSONKit")] - }, - "Obj-C Apple NSJSONSerialization": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_ObjCNSJSONSerializer/bin/test_ObjCNSJSONSerializer")] - }, - "Obj-C TouchJSON": - { - "url":"https://github.com/TouchCode/TouchJSON", - "commands":[os.path.join(PARSERS_DIR, "test_TouchJSON/bin/test_TouchJSON")] - }, - "Obj-C SBJSON 4.0.3": - { - "url":"https://github.com/stig/json-framework", - "commands":[os.path.join(PARSERS_DIR, "test_sbjson/bin/test_sbjson")] - }, - "Go 1.7.1": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_go/test_json")] - }, - "Lua JSON 20160916.19": - { - "url":"http://regex.info/blog/lua/json", - "commands":["/usr/local/bin/lua", os.path.join(PARSERS_DIR, "test_Lua_JSON/test_JSON.lua")] - }, - "Lua dkjson": - { - "url":"http://dkolf.de/src/dkjson-lua.fsl/home", - "commands":["/usr/local/bin/lua", os.path.join(PARSERS_DIR, "test_dkjson.lua")] - }, - "Ruby": - { - "url":"", - "commands":["/usr/bin/env", "ruby", os.path.join(PARSERS_DIR, "test_json.rb")] - }, - "Ruby regex": - { - "url":"", - "commands":["/usr/bin/env", "ruby", os.path.join(PARSERS_DIR, "test_json_re.rb")] - }, - "Ruby Yajl": - { - "url":"https://github.com/brianmario/yajl-ruby", - "commands":["/usr/bin/env", "ruby", os.path.join(PARSERS_DIR, "test_yajl.rb")] - }, - "Ruby Oj (strict mode)": - { - "url":"https://github.com/ohler55/oj", - "commands":["/usr/bin/env", "ruby", os.path.join(PARSERS_DIR, "test_oj_strict.rb")] - }, - "Ruby Oj (compat mode)": - { - "url":"https://github.com/ohler55/oj", - "commands":["/usr/bin/env", "ruby", os.path.join(PARSERS_DIR, "test_oj_compat.rb")] - }, - "Crystal": - { - "url":"https://github.com/crystal-lang/crystal", - "commands":[os.path.join(PARSERS_DIR, "test_json_cr")] - }, - "JavaScript": - { - "url":"", - "commands":["/usr/local/bin/node", os.path.join(PARSERS_DIR, "test_json.js")] - }, - "Python 2.7.10": - { - "url":"", - "commands":["/usr/bin/python", os.path.join(PARSERS_DIR, "test_json.py")] - }, - "Perl JSON": - { - "url":"", - "commands":["/usr/bin/perl", os.path.join(PARSERS_DIR, "test_json.pl")] - }, - "Perl JSON::XS": - { - "url":"http://search.cpan.org/dist/JSON-XS/XS.pm", - "commands":["/usr/bin/perl", os.path.join(PARSERS_DIR, "test_json_xs.pl")] - }, - "PHP 5.5.36": - { - "url":"", - "commands":["/usr/bin/php", os.path.join(PARSERS_DIR, "test_json.php")] - }, - "Swift Freddy 2.1.0": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_Freddy_2_1_0/bin/test_Freddy_2_1_0")] - }, - "Swift Freddy 20160830": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_Freddy_20160830/bin/test_Freddy")] - }, - "Swift Freddy 20161018": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_Freddy_20161018/bin/test_Freddy")] - }, - "Swift PMJSON 1.1": - { - "url":"https://github.com/postmates/PMJSON", - "commands":[os.path.join(PARSERS_DIR, "test_PMJSON_1_1_0/bin/test_PMJSON")] - }, - "Swift PMJSON 1.2": - { - "url":"https://github.com/postmates/PMJSON", - "commands":[os.path.join(PARSERS_DIR, "test_PMJSON_1_2_0/bin/test_PMJSON")] - }, - "Swift STJSON": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_STJSON/bin/STJSON")] - }, - "Swift Apple JSONSerialization": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test-AppleJSONSerialization/bin/test-AppleJSONSerialization")] - }, - "C jsmn": - { - "url":"https://github.com/zserge/jsmn", - "commands":[os.path.join(PARSERS_DIR, "test_jsmn/bin/test_jsmn")] - }, - "C jansson": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_jansson/bin/test_jansson")] - }, - "C JSON Checker": - { - "url":"http://www.json.org/JSON_checker/", - "commands":[os.path.join(PARSERS_DIR, "test_jsonChecker/bin/jsonChecker")] - }, - "C JSON Checker 2": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_jsonChecker2/bin/jsonChecker2")] - }, - "C ccan": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_ccan_json/bin/test_ccan")] - }, - "C cJSON": - { - "url":"https://github.com/DaveGamble/cJSON", - "commands":[os.path.join(PARSERS_DIR, "test_cJSON/bin/test-cJSON")] - }, - "C JSON Parser by udp": - { - "url":"https://github.com/udp/json-parser", - "commands":[os.path.join(PARSERS_DIR, "test_json-parser/bin/test_json-parser")] - }, - "Rust json-rust": - { - "url":"https://github.com/maciejhirsz/json-rust", - "commands":[os.path.join(PARSERS_DIR, "test_json-rust/target/debug/tj")] - }, - "Rust rustc_serialize::json": - { - "url":"https://doc.rust-lang.org/rustc-serialize/rustc_serialize/json/index.html", - "commands":[os.path.join(PARSERS_DIR, "test_json-rustc_serialize/rj/target/debug/rj")] - }, - "Rust serde_json": - { - "url":"https://github.com/serde-rs/json", - "commands":[os.path.join(PARSERS_DIR, "test_json-rust-serde_json/rj/target/debug/rj")] - }, - "Java json-simple 1.1.1": - { - "url":"", - "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_simple_json_1_1_1/TestJSONParsing.jar")] - }, - "Java gson 2.7": - { - "url":"", - "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_gson_2_7/TestJSONParsing.jar")] - }, - "Java com.leastfixedpoint.json 1.0": - { - "url":"", - "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jar")] - }, - "Java Jackson 2.8.4": - { - "url":"", - "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_jackson_2_8_4/TestJSONParsing.jar")] - }, - "Java nanojson 1.0": - { - "url":"", - "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_nanojson_1_0/TestJSONParsing.jar")] - }, - "Haskell Aeson 0.11.2.1": - { - "url":"https://github.com/bos/aeson", - "commands":[os.path.join(PARSERS_DIR, "test_haskell-aeson/testaeson")] - }, - "Qt JSON": - { - "url":"", - "commands":[os.path.join(PARSERS_DIR, "test_qt/test_qt")] - }, - "Squeak JSON-tonyg": - { - "url":"http://www.squeaksource.com/JSON.html", - "commands":[ - os.path.join(PARSERS_DIR, "test_Squeak_JSON_tonyg/Squeak.app/Contents/MacOS/Squeak"), - "-headless", #<--optional - os.path.join(PARSERS_DIR, "test_Squeak_JSON_tonyg/Squeak5.1-16549-32bit.image"), - "test_JSON.st" - ] - }, - "Json.NET 9.0.1": - { - "url":"http://www.newtonsoft.com/json", - "commands":["/usr/local/share/dotnet/dotnet", os.path.join(PARSERS_DIR, "test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.dll")] - }, -} - -def run_tests(restrict_to_path=None): - - FNULL = open(os.devnull, 'w') - log_file = open(LOG_FILE_PATH, 'w') - - prog_names = list(programs.keys()) - prog_names.sort() - - for prog_name in prog_names: - d = programs[prog_name] - - url = d["url"] - commands = d["commands"] - - if not os.path.exists(commands[0]): - print("-- skip non-existing", commands[0]) - continue - - for root, dirs, files in os.walk(TEST_CASES_DIR_PATH): - json_files = (f for f in files if f.endswith(".json")) - for filename in json_files: - - if restrict_to_path: - restrict_to_filename = os.path.basename(restrict_to_path) - if filename != restrict_to_filename: - continue - - file_path = os.path.join(root, filename) - - my_stdin = FNULL - - use_stdin = "use_stdin" in d and d["use_stdin"] - if use_stdin: - my_stdin = open(file_path, "rb") - a = commands - else: - a = commands + [file_path] - - #print("->", a) - print("--", " ".join(a)) - - try: - status = subprocess.call( - a, - stdin=my_stdin, - stdout=FNULL, - stderr=subprocess.STDOUT, - timeout=5 - ) - #print("-->", status) - except subprocess.TimeoutExpired: - print("timeout expired") - s = "%s\tTIMEOUT\t%s" % (prog_name, filename) - log_file.write("%s\n" % s) - print("RESULT:", result) - continue - - if use_stdin: - my_stdin.close() - - result = None - if status == 0: - result = "PASS" - elif status == 1: - result == "FAIL" - else: - result = "CRASH" - - s = None - if result == "CRASH": - s = "%s\tCRASH\t%s" % (prog_name, filename) - elif filename.startswith("y_") and result != "PASS": - s = "%s\tSHOULD_HAVE_PASSED\t%s" % (prog_name, filename) - elif filename.startswith("n_") and result == "PASS": - s = "%s\tSHOULD_HAVE_FAILED\t%s" % (prog_name, filename) - elif filename.startswith("i_") and result == "PASS": - s = "%s\tIMPLEMENTATION_PASS\t%s" % (prog_name, filename) - elif filename.startswith("i_") and result != "PASS": - s = "%s\tIMPLEMENTATION_FAIL\t%s" % (prog_name, filename) - - if s != None: - print(s) - log_file.write("%s\n" % s) - - FNULL.close() - log_file.close() - -def f_underline_non_printable_bytes(bytes): - - html = "" - - has_non_printable_characters = False - - for b in bytes: - - is_not_printable = b < 0x20 or b > 0x7E - - has_non_printable_characters |= is_not_printable - - if is_not_printable: - html += "%02X" % b - else: - html += "%c" % b - - if has_non_printable_characters: - try: - html += " <=> %s" % bytes.decode("utf-8", errors='ignore') - except: - pass - - if len(bytes) > 36: - return "%s(...)" % html[:36] - - return html - -def f_status_for_lib_for_file(json_dir, results_dir): - - txt_filenames = [f for f in listdir(results_dir) if f.endswith(".txt")] - - # comment to ignore some tests - statuses = [ - "SHOULD_HAVE_FAILED", - - "SHOULD_HAVE_PASSED", - "CRASH", - - "IMPLEMENTATION_FAIL", - "IMPLEMENTATION_PASS", - - "TIMEOUT" - ] - - d = {} - libs = [] - - for filename in txt_filenames: - path = os.path.join(results_dir, filename) - - with open(path) as f: - for l in f: - comps = l.split("\t") - if len(comps) != 3: - continue - - if comps[1] not in statuses: - print("-- unhandled status:", comps[1]) - - (lib, status, json_filename) = (comps[0], comps[1], comps[2].rstrip()) - - if lib not in libs: - libs.append(lib) - - json_path = os.path.join(TEST_CASES_DIR_PATH, json_filename) - - if json_path not in d: - d[json_path] = {} - - d[json_path][lib] = status - - return d, libs - -def f_status_for_path_for_lib(json_dir, results_dir): - - txt_filenames = [f for f in listdir(results_dir) if f.endswith(".txt")] - - # comment to ignore some tests - statuses = [ - "SHOULD_HAVE_FAILED", - - "SHOULD_HAVE_PASSED", - "CRASH", - - "IMPLEMENTATION_FAIL", - "IMPLEMENTATION_PASS", - - "TIMEOUT" - - ] - - d = {} # d['lib']['file'] = status - - for filename in txt_filenames: - path = os.path.join(results_dir, filename) - - with open(path) as f: - for l in f: - comps = l.split("\t") - if len(comps) != 3: - continue - - if comps[1] not in statuses: - #print "-- unhandled status:", comps[1] - continue - - (lib, status, json_filename) = (comps[0], comps[1], comps[2].rstrip()) - - if lib not in d: - d[lib] = {} - - json_path = os.path.join(TEST_CASES_DIR_PATH, json_filename) - - d[lib][json_path] = status - - return d - -def f_tests_with_same_results(libs, status_for_lib_for_file): - - tests_with_same_results = {} #{ {lib1:status, lib2:status, lib3:status} : { filenames } } - - files = list(status_for_lib_for_file.keys()) - files.sort() - - for f in files: - prefix = os.path.basename(f)[:1] - lib_status_for_file = [] - for l in libs: - if l in status_for_lib_for_file[f]: - status = status_for_lib_for_file[f][l] - lib_status = "%s_%s" % (status, l) - lib_status_for_file.append(lib_status) - results = " || ".join(lib_status_for_file) - if results not in tests_with_same_results: - tests_with_same_results[results] = set() - tests_with_same_results[results].add(f) - - r = [] - for k,v in tests_with_same_results.items(): - r.append((k,v)) - r.sort() - - return r - -def generate_report(report_path, keep_only_first_result_in_set = False): - - (status_for_lib_for_file, libs) = f_status_for_lib_for_file(TEST_CASES_DIR_PATH, LOGS_DIR_PATH) - - status_for_path_for_lib = f_status_for_path_for_lib(TEST_CASES_DIR_PATH, LOGS_DIR_PATH) - - tests_with_same_results = f_tests_with_same_results(libs, status_for_lib_for_file) - - with open(report_path, 'w') as f: - - f.write(""" - - - - - JSON Parsing Tests - - - - - - """) - - prog_names = list(programs.keys()) - prog_names.sort() - - libs = list(status_for_path_for_lib.keys()) - libs.sort() - - title = "JSON Parsing Tests" - if keep_only_first_result_in_set: - title += ", Prunned" - else: - title += ", Full" - f.write("

%s

\n" % title) - f.write('

Appendix to: seriot.ch Parsing JSON is a Minefield http://www.seriot.ch/parsing_json.php

\n') - f.write("
%s
\n" % strftime("%Y-%m-%d %H:%M:%S")) - - f.write("""

Contents

-
    -
  1. Color Scheme -
  2. Full Results -
  3. Results by Parser""") - f.write("
      \n") - for i, prog in enumerate(prog_names): - f.write('
    • %s\n' % (i, prog)) - f.write("
\n") - - f.write(""" - -

1. Color scheme:

- - - - - - - - -
expected result
parsing should have succeeded but failed
parsing should have failed but succeeded
result undefined, parsing succeeded
result undefined, parsing failed
parser crashed
timeout
- """) - - ### - - f.write('\n') - f.write("

2. Full Results

\n") - f.write("\n") - - f.write(" \n") - f.write(" \n") - for lib in libs: - f.write(' \n' % lib) - f.write(" \n") - f.write(" \n") - - for (k, file_set) in tests_with_same_results: - - ordered_file_set = list(file_set) - ordered_file_set.sort() - - if keep_only_first_result_in_set: - ordered_file_set = [ordered_file_set[0]] - - for path in [path for path in ordered_file_set if os.path.exists(path)]: - - f.write(" \n") - f.write(' ' % os.path.basename(path)) - - status_for_lib = status_for_lib_for_file[path] - bytes = open(path, "rb").read() - - for lib in libs: - if lib in status_for_lib: - status = status_for_lib[lib] - f.write(' ' % (status, "")) - else: - f.write(' ') - f.write(' ' % f_underline_non_printable_bytes(bytes)) - f.write(" ") - - f.write("
%s
%s%s%s
\n") - - - ### - - f.write('\n') - f.write("

3. Results by Parser

") - for i, prog in enumerate(prog_names): - url = programs[prog]["url"] - f.write("

\n") - f.write('' % i) - if len(url) > 0: - f.write('

%s

\n' % (url, prog)) - else: - f.write('

%s

\n' % prog) - - ### - - if prog not in status_for_path_for_lib: - continue - status_for_path = status_for_path_for_lib[prog] - - paths = list(status_for_path.keys()) - paths.sort() - - f.write('\n') - - f.write(" \n") - f.write(" \n") - f.write(' \n') - f.write(" \n") - f.write(" \n") - - for path in paths: - - f.write(" \n") - f.write(" " % os.path.basename(path)) - - status_for_lib = status_for_lib_for_file[path] - if os.path.exists(path): - bytes = open(path, "rb").read() - else: - bytes = [ord(x) for x in "(MISSING FILE)"] - - if prog in status_for_lib: - status = status_for_lib[prog] - f.write(' ' % (status, "")) - else: - f.write(" ") - f.write(" " % f_underline_non_printable_bytes(bytes)) - f.write(" ") - - f.write('
%s%s%s
\n') - f.write("

\n") - - ### - - f.write(""" - - - - - """) - - os.system('/usr/bin/open "%s"' % report_path) - -### - -if __name__ == '__main__': - - restrict_to_path = None - if len(sys.argv) == 2: - restrict_to_path = os.path.join(BASE_DIR, sys.argv[1]) - if not os.path.exists(restrict_to_path): - print("-- file does not exist:", restrict_to_path) - sys.exit(-1) - - run_tests(restrict_to_path) - - generate_report(os.path.join(BASE_DIR, "results/parsing.html"), keep_only_first_result_in_set = False) - generate_report(os.path.join(BASE_DIR, "results/parsing_pruned.html"), keep_only_first_result_in_set = True) diff --git a/tests/JSONTestSuite/test_parsing/y_number_double_huge_neg_exp.json b/tests/JSONTestSuite/test_parsing/i_number_double_huge_neg_exp.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_double_huge_neg_exp.json rename to tests/JSONTestSuite/test_parsing/i_number_double_huge_neg_exp.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_huge_exp.json b/tests/JSONTestSuite/test_parsing/i_number_huge_exp.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_huge_exp.json rename to tests/JSONTestSuite/test_parsing/i_number_huge_exp.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_neg_int_huge_exp.json b/tests/JSONTestSuite/test_parsing/i_number_neg_int_huge_exp.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_neg_int_huge_exp.json rename to tests/JSONTestSuite/test_parsing/i_number_neg_int_huge_exp.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_pos_double_huge_exp.json b/tests/JSONTestSuite/test_parsing/i_number_pos_double_huge_exp.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_pos_double_huge_exp.json rename to tests/JSONTestSuite/test_parsing/i_number_pos_double_huge_exp.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_real_neg_overflow.json b/tests/JSONTestSuite/test_parsing/i_number_real_neg_overflow.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_real_neg_overflow.json rename to tests/JSONTestSuite/test_parsing/i_number_real_neg_overflow.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_real_pos_overflow.json b/tests/JSONTestSuite/test_parsing/i_number_real_pos_overflow.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_real_pos_overflow.json rename to tests/JSONTestSuite/test_parsing/i_number_real_pos_overflow.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_real_underflow.json b/tests/JSONTestSuite/test_parsing/i_number_real_underflow.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_real_underflow.json rename to tests/JSONTestSuite/test_parsing/i_number_real_underflow.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_too_big_neg_int.json b/tests/JSONTestSuite/test_parsing/i_number_too_big_neg_int.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_too_big_neg_int.json rename to tests/JSONTestSuite/test_parsing/i_number_too_big_neg_int.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_too_big_pos_int.json b/tests/JSONTestSuite/test_parsing/i_number_too_big_pos_int.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_too_big_pos_int.json rename to tests/JSONTestSuite/test_parsing/i_number_too_big_pos_int.json diff --git a/tests/JSONTestSuite/test_parsing/y_number_very_big_negative_int.json b/tests/JSONTestSuite/test_parsing/i_number_very_big_negative_int.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_number_very_big_negative_int.json rename to tests/JSONTestSuite/test_parsing/i_number_very_big_negative_int.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_UTF8_surrogate_U+D800.json b/tests/JSONTestSuite/test_parsing/i_string_UTF8_surrogate_U+D800.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_UTF8_surrogate_U+D800.json rename to tests/JSONTestSuite/test_parsing/i_string_UTF8_surrogate_U+D800.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_invalid_utf-8.json b/tests/JSONTestSuite/test_parsing/i_string_invalid_utf-8.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_invalid_utf-8.json rename to tests/JSONTestSuite/test_parsing/i_string_invalid_utf-8.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_iso_latin_1.json b/tests/JSONTestSuite/test_parsing/i_string_iso_latin_1.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_iso_latin_1.json rename to tests/JSONTestSuite/test_parsing/i_string_iso_latin_1.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_lone_utf8_continuation_byte.json b/tests/JSONTestSuite/test_parsing/i_string_lone_utf8_continuation_byte.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_lone_utf8_continuation_byte.json rename to tests/JSONTestSuite/test_parsing/i_string_lone_utf8_continuation_byte.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_overlong_sequence_2_bytes.json b/tests/JSONTestSuite/test_parsing/i_string_overlong_sequence_2_bytes.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_overlong_sequence_2_bytes.json rename to tests/JSONTestSuite/test_parsing/i_string_overlong_sequence_2_bytes.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_overlong_sequence_6_bytes.json b/tests/JSONTestSuite/test_parsing/i_string_overlong_sequence_6_bytes.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_overlong_sequence_6_bytes.json rename to tests/JSONTestSuite/test_parsing/i_string_overlong_sequence_6_bytes.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_overlong_sequence_6_bytes_null.json b/tests/JSONTestSuite/test_parsing/i_string_overlong_sequence_6_bytes_null.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_overlong_sequence_6_bytes_null.json rename to tests/JSONTestSuite/test_parsing/i_string_overlong_sequence_6_bytes_null.json diff --git a/tests/JSONTestSuite/test_parsing/y_string_utf16BE_no_BOM.json b/tests/JSONTestSuite/test_parsing/i_string_utf16BE_no_BOM.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_string_utf16BE_no_BOM.json rename to tests/JSONTestSuite/test_parsing/i_string_utf16BE_no_BOM.json diff --git a/tests/JSONTestSuite/test_parsing/y_string_utf16LE_no_BOM.json b/tests/JSONTestSuite/test_parsing/i_string_utf16LE_no_BOM.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_string_utf16LE_no_BOM.json rename to tests/JSONTestSuite/test_parsing/i_string_utf16LE_no_BOM.json diff --git a/tests/JSONTestSuite/test_parsing/n_multidigit_number_then_00.json b/tests/JSONTestSuite/test_parsing/n_multidigit_number_then_00.json new file mode 100644 index 000000000..c22507b86 Binary files /dev/null and b/tests/JSONTestSuite/test_parsing/n_multidigit_number_then_00.json differ diff --git a/tests/JSONTestSuite/test_parsing/n_number_then_00.json b/tests/JSONTestSuite/test_parsing/n_number_then_00.json deleted file mode 100644 index 0e7ef5419..000000000 Binary files a/tests/JSONTestSuite/test_parsing/n_number_then_00.json and /dev/null differ diff --git a/tests/JSONTestSuite/test_parsing/n_object_pi_in_key_and_trailing_comma.json b/tests/JSONTestSuite/test_parsing/n_object_lone_continuation_byte_in_key_and_trailing_comma.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_object_pi_in_key_and_trailing_comma.json rename to tests/JSONTestSuite/test_parsing/n_object_lone_continuation_byte_in_key_and_trailing_comma.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape u.json b/tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape_u.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape u.json rename to tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape_u.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape u1.json b/tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape_u1.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape u1.json rename to tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape_u1.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape u1x.json b/tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape_u1x.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape u1x.json rename to tests/JSONTestSuite/test_parsing/n_string_1_surrogate_then_escape_u1x.json diff --git a/tests/JSONTestSuite/test_parsing/n_string_unescaped_crtl_char.json b/tests/JSONTestSuite/test_parsing/n_string_unescaped_ctrl_char.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_string_unescaped_crtl_char.json rename to tests/JSONTestSuite/test_parsing/n_string_unescaped_ctrl_char.json diff --git a/tests/JSONTestSuite/test_parsing/n_structure_..json b/tests/JSONTestSuite/test_parsing/n_structure_angle_bracket_..json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_structure_..json rename to tests/JSONTestSuite/test_parsing/n_structure_angle_bracket_..json diff --git a/tests/JSONTestSuite/test_parsing/n_structure_null.json b/tests/JSONTestSuite/test_parsing/n_structure_angle_bracket_null.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_structure_null.json rename to tests/JSONTestSuite/test_parsing/n_structure_angle_bracket_null.json diff --git a/tests/JSONTestSuite/test_parsing/n_structure_single_point.json b/tests/JSONTestSuite/test_parsing/n_structure_single_eacute.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/n_structure_single_point.json rename to tests/JSONTestSuite/test_parsing/n_structure_single_eacute.json diff --git a/tests/JSONTestSuite/test_parsing/y_object_extreme_numbers.json b/tests/JSONTestSuite/test_parsing/y_object_extreme_numbers.json index 56a908924..a0d3531c3 100644 --- a/tests/JSONTestSuite/test_parsing/y_object_extreme_numbers.json +++ b/tests/JSONTestSuite/test_parsing/y_object_extreme_numbers.json @@ -1 +1 @@ -{ "min": -1.0e+28, "max": 1.0e+28 } +{ "min": -1.0e+28, "max": 1.0e+28 } \ No newline at end of file diff --git a/tests/JSONTestSuite/test_parsing/y_string_newline_uescaped.json b/tests/JSONTestSuite/test_parsing/y_string_nbsp_uescaped.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_string_newline_uescaped.json rename to tests/JSONTestSuite/test_parsing/y_string_nbsp_uescaped.json diff --git a/tests/JSONTestSuite/test_parsing/y_string_nonCharacterInUTF-8_U+1FFFF.json b/tests/JSONTestSuite/test_parsing/y_string_reservedCharacterInUTF-8_U+1BFFF.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/y_string_nonCharacterInUTF-8_U+1FFFF.json rename to tests/JSONTestSuite/test_parsing/y_string_reservedCharacterInUTF-8_U+1BFFF.json diff --git a/tests/JSONTestSuite/test_parsing/y_string_uescaped_newline.json b/tests/JSONTestSuite/test_parsing/y_string_uescaped_newline.json new file mode 100644 index 000000000..3a5a220b6 --- /dev/null +++ b/tests/JSONTestSuite/test_parsing/y_string_uescaped_newline.json @@ -0,0 +1 @@ +["new\u000Aline"] \ No newline at end of file diff --git a/tests/JSONTestSuite/test_parsing/i_string_unicode_U+10FFFE_nonchar.json b/tests/JSONTestSuite/test_parsing/y_string_unicode_U+10FFFE_nonchar.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/i_string_unicode_U+10FFFE_nonchar.json rename to tests/JSONTestSuite/test_parsing/y_string_unicode_U+10FFFE_nonchar.json diff --git a/tests/JSONTestSuite/test_parsing/i_string_unicode_U+1FFFE_nonchar.json b/tests/JSONTestSuite/test_parsing/y_string_unicode_U+1FFFE_nonchar.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/i_string_unicode_U+1FFFE_nonchar.json rename to tests/JSONTestSuite/test_parsing/y_string_unicode_U+1FFFE_nonchar.json diff --git a/tests/JSONTestSuite/test_parsing/i_string_unicode_U+FDD0_nonchar.json b/tests/JSONTestSuite/test_parsing/y_string_unicode_U+FDD0_nonchar.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/i_string_unicode_U+FDD0_nonchar.json rename to tests/JSONTestSuite/test_parsing/y_string_unicode_U+FDD0_nonchar.json diff --git a/tests/JSONTestSuite/test_parsing/i_string_unicode_U+FFFE_nonchar.json b/tests/JSONTestSuite/test_parsing/y_string_unicode_U+FFFE_nonchar.json similarity index 100% rename from tests/JSONTestSuite/test_parsing/i_string_unicode_U+FFFE_nonchar.json rename to tests/JSONTestSuite/test_parsing/y_string_unicode_U+FFFE_nonchar.json diff --git a/tests/JSONTestSuite/test_transform/number_-9223372036854775808.json b/tests/JSONTestSuite/test_transform/number_-9223372036854775808.json new file mode 100644 index 000000000..f8853ff83 --- /dev/null +++ b/tests/JSONTestSuite/test_transform/number_-9223372036854775808.json @@ -0,0 +1 @@ +[-9223372036854775808] diff --git a/tests/JSONTestSuite/test_transform/number_-9223372036854775809.json b/tests/JSONTestSuite/test_transform/number_-9223372036854775809.json new file mode 100644 index 000000000..5dca91fde --- /dev/null +++ b/tests/JSONTestSuite/test_transform/number_-9223372036854775809.json @@ -0,0 +1 @@ +[-9223372036854775809] diff --git a/tests/JSONTestSuite/test_transform/number_1.0.json b/tests/JSONTestSuite/test_transform/number_1.0.json index e7a19a6ec..0ea64a68f 100644 --- a/tests/JSONTestSuite/test_transform/number_1.0.json +++ b/tests/JSONTestSuite/test_transform/number_1.0.json @@ -1 +1 @@ -[1.0] \ No newline at end of file +[1.0] diff --git a/tests/JSONTestSuite/test_transform/number_1.000000000000000005.json b/tests/JSONTestSuite/test_transform/number_1.000000000000000005.json index c73b7cfca..4c3849de2 100644 --- a/tests/JSONTestSuite/test_transform/number_1.000000000000000005.json +++ b/tests/JSONTestSuite/test_transform/number_1.000000000000000005.json @@ -1 +1 @@ -[1.000000000000000005] \ No newline at end of file +[1.000000000000000005] diff --git a/tests/JSONTestSuite/test_transform/number_10000000000000000999.json b/tests/JSONTestSuite/test_transform/number_10000000000000000999.json index 946d13d36..fa37dfa7c 100644 --- a/tests/JSONTestSuite/test_transform/number_10000000000000000999.json +++ b/tests/JSONTestSuite/test_transform/number_10000000000000000999.json @@ -1 +1 @@ -[10000000000000000999] \ No newline at end of file +[10000000000000000999] diff --git a/tests/JSONTestSuite/test_transform/number_1e-999.json b/tests/JSONTestSuite/test_transform/number_1e-999.json index c8ed222fc..61ce7529a 100644 --- a/tests/JSONTestSuite/test_transform/number_1e-999.json +++ b/tests/JSONTestSuite/test_transform/number_1e-999.json @@ -1 +1 @@ -[1E-999] \ No newline at end of file +[1E-999] diff --git a/tests/JSONTestSuite/test_transform/number_1e6.json b/tests/JSONTestSuite/test_transform/number_1e6.json index 1a8b0f78b..b55cfc4b2 100644 --- a/tests/JSONTestSuite/test_transform/number_1e6.json +++ b/tests/JSONTestSuite/test_transform/number_1e6.json @@ -1 +1 @@ -[1E6] \ No newline at end of file +[1E6] diff --git a/tests/JSONTestSuite/test_transform/number_9223372036854775807.json b/tests/JSONTestSuite/test_transform/number_9223372036854775807.json new file mode 100644 index 000000000..f899e4c40 --- /dev/null +++ b/tests/JSONTestSuite/test_transform/number_9223372036854775807.json @@ -0,0 +1 @@ +[9223372036854775807] diff --git a/tests/JSONTestSuite/test_transform/number_9223372036854775808.json b/tests/JSONTestSuite/test_transform/number_9223372036854775808.json new file mode 100644 index 000000000..15757d3e5 --- /dev/null +++ b/tests/JSONTestSuite/test_transform/number_9223372036854775808.json @@ -0,0 +1 @@ +[9223372036854775808] diff --git a/tests/Tests.hs b/tests/Tests.hs index 9f722ec99..c0cc44a97 100644 --- a/tests/Tests.hs +++ b/tests/Tests.hs @@ -8,9 +8,11 @@ import Test.Tasty (defaultMain, testGroup) import qualified DataFamilies.Properties as DF import qualified Properties import qualified UnitTests +import qualified JSONTestSuite main :: IO () main = do ioTests <- UnitTests.ioTests - let allTests = DF.tests : Properties.tests : UnitTests.tests : ioTests + jsTests <- JSONTestSuite.tests + let allTests = DF.tests : Properties.tests : UnitTests.tests : jsTests : ioTests defaultMain (testGroup "tests" allTests) diff --git a/tests/UnitTests.hs b/tests/UnitTests.hs index d36ba56b9..5b1502d66 100644 --- a/tests/UnitTests.hs +++ b/tests/UnitTests.hs @@ -49,10 +49,9 @@ import qualified Data.Aeson.Types import qualified Data.Aeson.KeyMap as KM import Data.Attoparsec.ByteString (Parser, parseOnly) import Data.Char (toUpper, GeneralCategory(Control,Surrogate), generalCategory) -import Data.Either.Compat (isLeft, isRight) import Data.Hashable (hash) import Data.HashMap.Strict (HashMap) -import Data.List (sort, isSuffixOf) +import Data.List (isSuffixOf) import Data.Maybe (fromMaybe) import Data.Scientific (Scientific, scientific) import Data.Tagged (Tagged(..)) @@ -63,16 +62,13 @@ import GHC.Generics (Generic) import GHC.Generics.Generically (Generically (..)) import Instances () import Numeric.Natural (Natural) -import System.Directory (getDirectoryContents) -import System.FilePath ((), takeExtension, takeFileName) import Test.Tasty (TestTree, testGroup) -import Test.Tasty.HUnit (Assertion, assertBool, assertFailure, assertEqual, testCase, (@?=)) +import Test.Tasty.HUnit (Assertion, assertFailure, assertEqual, testCase, (@?=)) import Text.Printf (printf) import UnitTests.NullaryConstructors (nullaryConstructors) import qualified Data.ByteString as S import qualified Data.ByteString.Base16.Lazy as LBase16 import qualified Data.ByteString.Lazy.Char8 as L -import qualified Data.HashSet as HashSet import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy.Builder as TLB import qualified Data.Text.Lazy.Encoding as LT @@ -420,72 +416,7 @@ unescapeString = do Surrogate -> False _ -> True --- JSONTestSuite - -jsonTestSuiteTest :: FilePath -> TestTree -jsonTestSuiteTest path = testCase fileName $ do - payload <- L.readFile path - let result = eitherDecode payload :: Either String Value - assertBool fileName $ case take 2 fileName of - "i_" -> isRight result - "n_" -> isLeft result - "y_" -> isRight result - _ -> isRight result -- test_transform tests have inconsistent names - where - fileName = takeFileName path - --- Build a collection of tests based on the current contents of the --- JSONTestSuite test directories. - -jsonTestSuite :: IO TestTree -jsonTestSuite = do - let suitePath = "tests/JSONTestSuite" - let suites = ["test_parsing", "test_transform"] - testPaths <- fmap (sort . concat) . forM suites $ \suite -> do - let dir = suitePath suite - entries <- getDirectoryContents dir - let ok name = takeExtension name == ".json" && - not (name `HashSet.member` blacklist) - return . map (dir ) . filter ok $ entries - return $ testGroup "JSONTestSuite" $ map jsonTestSuiteTest testPaths - --- The set expected-to-be-failing JSONTestSuite tests. --- Not all of these failures are genuine bugs. --- Of those that are bugs, not all are worth fixing. - -blacklist :: HashSet.HashSet String --- blacklist = HashSet.empty -blacklist = _blacklist - -_blacklist :: HashSet.HashSet String -_blacklist = HashSet.fromList [ - "i_object_key_lone_2nd_surrogate.json" - , "i_string_1st_surrogate_but_2nd_missing.json" - , "i_string_1st_valid_surrogate_2nd_invalid.json" - , "i_string_UTF-16LE_with_BOM.json" - , "i_string_UTF-16_invalid_lonely_surrogate.json" - , "i_string_UTF-16_invalid_surrogate.json" - , "i_string_UTF-8_invalid_sequence.json" - , "i_string_incomplete_surrogate_and_escape_valid.json" - , "i_string_incomplete_surrogate_pair.json" - , "i_string_incomplete_surrogates_escape_valid.json" - , "i_string_invalid_lonely_surrogate.json" - , "i_string_invalid_surrogate.json" - , "i_string_inverted_surrogates_U+1D11E.json" - , "i_string_lone_second_surrogate.json" - , "i_string_not_in_unicode_range.json" - , "i_string_truncated-utf-8.json" - , "i_structure_UTF-8_BOM_empty_object.json" - , "string_1_escaped_invalid_codepoint.json" - , "string_1_invalid_codepoint.json" - , "string_1_invalid_codepoints.json" - , "string_2_escaped_invalid_codepoints.json" - , "string_2_invalid_codepoints.json" - , "string_3_escaped_invalid_codepoints.json" - , "string_3_invalid_codepoints.json" - , "y_string_utf16BE_no_BOM.json" - , "y_string_utf16LE_no_BOM.json" - ] + -- A regression test for: https://github.com/bos/aeson/pull/455 data Foo a = FooNil | FooCons (Foo Int) @@ -839,8 +770,7 @@ monadFixTests = testGroup "MonadFix" ioTests :: IO [TestTree] ioTests = do enc <- encoderComparisonTests - js <- jsonTestSuite - return [enc, js] + return [enc] tests :: TestTree tests = testGroup "unit" [