Code tokens WITH literals kept and source offsets (for substitution in the sketch). PURE.
(body: string)
| 218 | |
| 219 | /** Code tokens WITH literals kept and source offsets (for substitution in the sketch). PURE. */ |
| 220 | function 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 |
no test coverage detected