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

Function parseGcbEnum

scripts/check-unicode-sync.mjs:51–70  ·  view source on GitHub ↗
(headerText)

Source from the content-addressed store, hash-verified

49}
50
51function parseGcbEnum(headerText) {
52 const start = headerText.indexOf("typedef enum zr_gcb_class_t");
53 if (start < 0) throw new Error("missing zr_gcb_class_t enum");
54 const brace = headerText.indexOf("{", start);
55 const end = headerText.indexOf("}", brace);
56 if (brace < 0 || end < 0) throw new Error("malformed zr_gcb_class_t enum");
57
58 const body = headerText.slice(brace + 1, end);
59 const names = body
60 .split(",")
61 .map((s) => s.trim())
62 .filter(Boolean)
63 .map((s) => s.replace(/\s*=.*$/, "").trim())
64 .filter((s) => s.startsWith("ZR_GCB_"));
65
66 const map = new Map();
67 for (let i = 0; i < names.length; i++) map.set(names[i], i);
68 if (!map.has("ZR_GCB_OTHER")) throw new Error("expected ZR_GCB_OTHER in enum");
69 return map;
70}
71
72function parseIncGcbRanges(incText, gcbEnum) {
73 const block = extractBlock(incText, "static const zr_unicode_range8_t kGcbRanges[]");

Callers 1

checkUnicodeSyncFunction · 0.85

Calls 3

replaceMethod · 0.80
setMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected