MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / rawTokens

Function rawTokens

src/codegraph/helper-extract.ts:220–226  ·  view source on GitHub ↗

Code tokens WITH literals kept and source offsets (for substitution in the sketch). PURE.

(body: string)

Source from the content-addressed store, hash-verified

218
219/** Code tokens WITH literals kept and source offsets (for substitution in the sketch). PURE. */
220function rawTokens(body: string): RawTok[] {
221 const re = /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`|\d+(?:\.\d+)?|[A-Za-z_$][\w$]*|[^\sA-Za-z0-9_$]/g;
222 const out: RawTok[] = [];
223 let m: RegExpExecArray | null;
224 while ((m = re.exec(body))) out.push({ text: m[0], start: m.index });
225 return out;
226}
227
228/**
229 * Given a cluster of near-duplicate functions, propose ONE parameterized helper: align the bodies

Callers 1

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected