MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / parseClassInString

Function parseClassInString

src/pkg/utils/regex_to_glob.ts:277–292  ·  view source on GitHub ↗
(s: string, idx: number)

Source from the content-addressed store, hash-verified

275
276 // ----- Simple sequence analysis ----- 简单序列分析
277 function parseClassInString(s: string, idx: number): number {
278 idx++;
279 if (idx < s.length && s[idx] === "^") idx++;
280 let first = true;
281 while (idx < s.length) {
282 const ch = s[idx++];
283 if (ch === "\\") {
284 if (idx >= s.length) return -1;
285 idx++;
286 } else if (ch === "]" && !first) {
287 return idx;
288 }
289 first = false;
290 }
291 return -1;
292 }
293
294 interface QuantifierResult {
295 ok: boolean;

Callers 1

analyzeSimpleSequenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected