- plugin_loader_v2: store per-Box resolve() from TypeBox FFI; add resolve_method_id() and use in invoke_instance_method
- plugin_loader_unified: resolve_method() falls back to loader’s resolve when TOML lacks method entries
- nyash.toml: register JsonDocBox/JsonNodeBox methods (birth/parse/root/error; kind/get/size/at/str/int/bool)
- plugins/nyash-json-plugin:
* serde/yyjson provider switch via env NYASH_JSON_PROVIDER (default serde)
* vendored yyjson (c/yyjson) + shim; parse/root/get/size/at/str/int/bool implemented for yyjson
* TLV void returns aligned to tag=9
- PyVM: add minimal JsonDocBox/JsonNodeBox shims in ops_box.py (for dev path)
- tests/smokes: add jsonbox_{parse_ok,parse_err,nested,collect_prints}; wire two into min-gate CI
- tools: collect_prints_mixed now uses JSON-based app
- MiniVmPrints: move BinaryOp and fallback heuristics behind a dev toggle (default OFF)
- CURRENT_TASK.md: updated with provider policy and fallback stance
17 lines
386 B
Plaintext
17 lines
386 B
Plaintext
static box Main {
|
|
main(args) {
|
|
local json = "{\"a\":{\"n\":7,\"s\":\"B\"},\"arr\":[1,2,3]}"
|
|
local doc = new JsonDocBox()
|
|
doc.parse(json)
|
|
local root = doc.root()
|
|
// prints: B, 7, 3, 2
|
|
print(root.get("a").get("s").str())
|
|
print(root.get("a").get("n").int())
|
|
local arr = root.get("arr")
|
|
print(arr.size())
|
|
print(arr.at(1).int())
|
|
return 0
|
|
}
|
|
}
|
|
|