json(vm): fix birth dispatch; unify constructor naming (Box.birth/N); JsonNode factories return JsonNodeInstance; quick: enable heavy JSON with probe; builder: NYASH_BUILDER_DEBUG_LIMIT guard; json_query_min(core) harness; docs/tasks updated

This commit is contained in:
nyash-codex
2025-09-27 08:45:25 +09:00
parent fcf8042b06
commit cb236b7f5a
263 changed files with 12990 additions and 272 deletions

View File

@ -0,0 +1,11 @@
// std/operators/add.nyash
// AddOperator — 加算の演算子ボックス開発用観測MVP
// 目的: 加算を明示呼び出しとして観測(返り値は未使用)
static box AddOperator {
// apply(a, b) -> Any
apply(a, b) {
// 実評価採用フラグON時にVMが結果採用。演算子内は再入ガードで安全
return a + b
}
}

View File

@ -0,0 +1,4 @@
static box BitAndOperator {
apply(a, b) { return a & b }
}

View File

@ -0,0 +1,4 @@
static box BitNotOperator {
apply(a) { return ~a }
}

View File

@ -0,0 +1,4 @@
static box BitOrOperator {
apply(a, b) { return a | b }
}

View File

@ -0,0 +1,4 @@
static box BitXorOperator {
apply(a, b) { return a ^ b }
}

View File

@ -0,0 +1,18 @@
// std/operators/compare.nyash
// CompareOperator — 比較演算の演算子ボックス開発用観測MVP
// 目的: 比較を明示の呼び出しとして観測可能にするMVPでは返り値は未使用
static box CompareOperator {
// apply(op, a, b) -> Bool
apply(op, a, b) {
// 実評価採用フラグON時にVMが結果採用。演算子内は再入ガードで安全
if op == "Eq" { return a == b }
if op == "Ne" { return a != b }
if op == "Lt" { return a < b }
if op == "Le" { return a <= b }
if op == "Gt" { return a > b }
if op == "Ge" { return a >= b }
// 未知のopは false安全側
return false
}
}

View File

@ -0,0 +1,4 @@
static box DivOperator {
apply(a, b) { return a / b }
}

View File

@ -0,0 +1,4 @@
static box ModOperator {
apply(a, b) { return a % b }
}

View File

@ -0,0 +1,4 @@
static box MulOperator {
apply(a, b) { return a * b }
}

View File

@ -0,0 +1,4 @@
static box NegOperator {
apply(a) { return -a }
}

View File

@ -0,0 +1,4 @@
static box NotOperator {
apply(a) { return not a }
}

View File

@ -0,0 +1,4 @@
static box ShlOperator {
apply(a, b) { return a << b }
}

View File

@ -0,0 +1,4 @@
static box ShrOperator {
apply(a, b) { return a >> b }
}

View File

@ -0,0 +1,20 @@
// std/operators/stringify.nyash
// StringifyOperator — 明示的な文字列化の演算子ボックス(開発用)
// 目的: 暗黙の toString に依存せず、観測可能な文字列化を提供する
static box StringifyOperator {
// apply(value) -> String
apply(value) {
// null 安全
if value == null {
return "null"
}
// stringify メソッドがあれば尊重JsonNodeInstance 等)
if value.stringify != null {
return value.stringify()
}
// それ以外は連結で安全に文字列化(プリミティブ toString 依存を避ける)
return "" + value
}
}

View File

@ -0,0 +1,4 @@
static box SubOperator {
apply(a, b) { return a - b }
}