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:
37
lang/src/shared/adapters/map_kv_string_to_array.hako
Normal file
37
lang/src/shared/adapters/map_kv_string_to_array.hako
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user