improved JSON parser conformity (chqrlie) (#250)

This commit is contained in:
Fabrice Bellard
2025-05-19 17:23:25 +02:00
parent aaa9cea6a8
commit 9bce51eefd
5 changed files with 152 additions and 31 deletions

View File

@@ -596,7 +596,7 @@ function test_json()
]
]`);
assert_json_error('\n" @\\x"');
assert_json_error('\n" \\@x"');
assert_json_error('\n{ "a": @x }"');
}

View File

@@ -134,7 +134,7 @@ function test_ext_json()
"y":true, // also a comment
z2:null, // unquoted property names
"a":[+1,0o10,0xa0,], // plus prefix, octal, hexadecimal
"s":"str",} // trailing comma in objects and arrays
"s":'str',} // trailing comma in objects and arrays, single quoted string
`;
obj = std.parseExtJSON(input);
assert(JSON.stringify(obj), expected);