Implement marqdo-std-data#13 without changing the default `json.解析` behavior: - `json.严格解析(文本)` rejects duplicate keys in one object level after decoding (`"\u0061"` equals `"a"`) with `json.duplicate_key`, and numbers that cannot be represented as finite binary64 values with `json.non_finite_number` (1e400 / -1e400 / 1.8e308 reject; 1e308 / 1.79e308 stay finite). - The strict validator reuses the existing tokenizer/parser helpers and the 128-level depth limit; no second JSON grammar or parser is introduced. - Candidate-input self-test: `tests/json-strict.mq.md` + `tests/cases-strict/json-strict.json` + `scripts/test-strict.sh`, kept separate from the default suite because the frozen ecosystem Bundle predates the new function. `run_cases.py` accepts `MARQDO_STDLIB_CASES_DIR`. - README documents the new entry, error codes and candidate-Bundle test lane; docs/evidence records the real CLI runs and digests. No cross-repo dependency, no CLI change, no release.
816 B
816 B
import
| import | ||
|---|---|---|
|
@exec 严格解析
main
合法对象 = json.严格解析("{\"b\":3,\"c\":[1,2.5,true,null]}")
合法数组 = json.严格解析("[1,2.5,true,null,\"x\",{\"b\":3}]")
重复键 = json.严格解析("{\"a\":1,\"a\":2}")
转义等价重复 = json.严格解析("{\"a\":1,\"\\u0061\":2}")
溢出 = json.严格解析("1e400")
负溢出 = json.严格解析("-1e400")
最大量级 = json.严格解析("1.79e308")
超出最大量级 = json.严格解析("1.8e308")
普通入口 = json.解析("{\"a\":1,\"a\":2}")
return [合法对象.ok, 合法数组.ok, 重复键.ok, 重复键.code, 转义等价重复.code, 溢出.code, 负溢出.code, 最大量级.ok, 超出最大量级.ok, 普通入口.ok, 普通入口.value]