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:
44
lang/src/shared/json/json_cursor.hako
Normal file
44
lang/src/shared/json/json_cursor.hako
Normal file
@ -0,0 +1,44 @@
|
||||
// json_cursor.hako — JsonCursorBox (thin scan facade)
|
||||
// Responsibility: provide a minimal, escape-aware scanning facade used by JsonFragBox
|
||||
// Delegates to StringOps, StringScanBox and JsonScanBox.
|
||||
|
||||
using "lang/src/shared/common/string_ops.hako" as StringOps
|
||||
using "lang/src/shared/json/core/string_scan.hako" as StringScanBox
|
||||
using "lang/src/shared/json/core/json_scan.hako" as JsonScanBox
|
||||
|
||||
static box JsonCursorBox {
|
||||
index_of_from(hay, needle, pos) {
|
||||
return StringOps.index_of_from(hay, needle, pos)
|
||||
}
|
||||
// Alias: find_from (compat)
|
||||
find_from(hay, needle, pos) { return me.index_of_from(hay, needle, pos) }
|
||||
scan_string_end(text, quote_pos) { return StringScanBox.scan_string_end(text, quote_pos) }
|
||||
seek_array_end(text, lbracket_pos) { return JsonScanBox.seek_array_end(text, lbracket_pos) }
|
||||
seek_obj_end(text, start) { return JsonScanBox.seek_obj_end(text, start) }
|
||||
find_key_dual(text, plain, escaped, pos) { return JsonScanBox.find_key_dual(text, plain, escaped, pos) }
|
||||
// Extract a sequence of optional sign + digits starting at start_pos
|
||||
digits_from(text, start_pos) {
|
||||
if text == null { return "" }
|
||||
local i = start_pos
|
||||
local n = text.size()
|
||||
local out = ""
|
||||
if i < n {
|
||||
local ch = text.substring(i, i+1)
|
||||
if ch == "-" {
|
||||
out = out + ch
|
||||
i = i + 1
|
||||
}
|
||||
}
|
||||
loop(i < n) {
|
||||
local ch = text.substring(i, i+1)
|
||||
if ch == "" { break }
|
||||
if ch >= "0" && ch <= "9" {
|
||||
out = out + ch
|
||||
i = i + 1
|
||||
} else { break }
|
||||
}
|
||||
return out
|
||||
}
|
||||
}
|
||||
|
||||
static box JsonCursorMain { main(args){ return 0 } }
|
||||
Reference in New Issue
Block a user