MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / parseIncGcbRanges

Function parseIncGcbRanges

scripts/check-unicode-sync.mjs:72–89  ·  view source on GitHub ↗
(incText, gcbEnum)

Source from the content-addressed store, hash-verified

70}
71
72function parseIncGcbRanges(incText, gcbEnum) {
73 const block = extractBlock(incText, "static const zr_unicode_range8_t kGcbRanges[]");
74 const out = [];
75 const re =
76 /\{\s*(0x[0-9A-Fa-f]+)u\s*,\s*(0x[0-9A-Fa-f]+)u\s*,\s*\(uint8_t\)(ZR_GCB_[A-Z_]+)\s*,/g;
77 for (;;) {
78 const m = re.exec(block);
79 if (!m) break;
80 const lo = Number.parseInt(m[1], 16);
81 const hi = Number.parseInt(m[2], 16);
82 const cls = m[3];
83 const v = gcbEnum.get(cls);
84 if (v === undefined) throw new Error(`unknown GCB enum value: ${cls}`);
85 out.push(lo, hi, v);
86 }
87 if (out.length === 0) throw new Error("parsed 0 GCB ranges from inc");
88 return out;
89}
90
91function parseIncPairRanges(incText, name) {
92 const block = extractBlock(incText, `static const zr_unicode_range_t ${name}[]`);

Callers 1

checkUnicodeSyncFunction · 0.85

Calls 3

extractBlockFunction · 0.85
getMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected