Files
ww/selfhost
Hojun-Cho 50fc976e1d cmd/ww: FOLD 2 — str-lift scanuse/peekpackage/dirfilekeep scanners (capstone)
The three byte-id-critical import scanners in cmd/ww/main.ww drop
their hand-rolled byte-pyramids for strings.has{prefix,suffix} over
constructed str views, keeping every boundary guard that the lifted
helpers do not subsume:

- dirfilekeep: nlen<=3 guard kept (bare ".ww" len-3 stays rejected,
  which strings.hassuffix(".ww") alone would wrongly accept).
- scanuse: i+7>len guard kept (hasprefix("import") covers 6 bytes;
  the separator read at src[i+6] still needs i+6 < len).
- peekpackage: s+8<=q guard kept (hasprefix("package") covers 7
  bytes; the separator read at buf[s+7] needs s+7 < q).

bytecmp (the enumeratedir sort comparator) is left as-is: it is a
magnitude-returning 3-way memcmp at a read boundary, not a spell-out.

Regenerated ww/main.combined.ww. All 6 corpus .combined.ww remain
byte-identical (cstage ww == wwstage ww_ww); 990-997 byte-id + 993
self-rebuild green.
2026-06-03 02:59:29 +09:00
..