restore(lang): full lang tree from ff3ef452 (306 files) — compiler, vm, shared, runner, c-abi, etc.\n\n- Restores lang/ directory (files≈306, dirs≈64) as per historical branch with selfhost sources\n- Keeps our recent parser index changes in compiler/* (merged clean by checkout)\n- Unblocks selfhost development and documentation references

This commit is contained in:
nyash-codex
2025-10-31 20:45:46 +09:00
parent dbc285f2b1
commit e5f697eb22
244 changed files with 16915 additions and 47 deletions

View File

@ -0,0 +1,37 @@
// map_kv_string_to_array.hako — Adapter to convert keysS/valuesS string to ArrayBox
// Responsibility: Provide split helpers (String -> ArrayBox) for MapBox keys/values
static box MapKvStringToArrayAdapter {
// Split a newline-joined String into an ArrayBox of strings.
// Empty or null-like input yields empty ArrayBox.
split_lines(s) {
local out = new ArrayBox()
if s == null { return out }
// Simple scan: split by "\n"
local i = 0
local start = 0
local n = s.size()
loop(i < n) {
if s.substring(i, i+1) == "\n" {
out.push(s.substring(start, i))
start = i + 1
}
i = i + 1
}
// tail
if start <= n { out.push(s.substring(start, n)) }
return out
}
// Adapt Map.keysS() -> ArrayBox
adapt_keysS(map) {
local ks = map.keysS()
return me.split_lines(ks)
}
// Adapt Map.valuesS() -> ArrayBox
adapt_valuesS(map) {
local vs = map.valuesS()
return me.split_lines(vs)
}
}