from __future__ import annotations
import re
from pathlib import Path
ROOT = Path("/mnt/c/Users/RyanJ/spectre-rs")
PATTERNS = [
(r"list-item ML tools", "list-item marker"),
(r"ML tools to be a", "marker to be a"),
(r"start ML tools", "start marker"),
(r"end ML tools", "end marker"),
(r"EI ML tools", "EI marker"),
(r"EOL ML tools", "EOL marker"),
(r"with a smaller list ML tools", "with a smaller list marker"),
(r"\"ML tools\" comment", "\"marker\" comment"),
(r"ML tools\b", "marker"),
]
for path in ROOT.rglob("*.rs"):
if "target/" in str(path) or "/lopdf-fork/" in str(path):
continue
original = path.read_text(encoding="utf-8")
new = original
for pat, repl in PATTERNS:
new = re.sub(pat, repl, new)
if new != original:
path.write_text(new, encoding="utf-8")
print(f" fixed {path.relative_to(ROOT)}")