90 -> canonical gives back the same text, so the same bytes). // bin/jumphp php games/alis tools/lang/human.php [out folder] require __DIR__ . '/../../vendor/autoload.php'; use App\Alis\Lang\Human; $src = rtrim($argv[1] ?? '', '/'); $out = isset($argv[2]) ? rtrim($argv[2], '/') : null; if ($src === '' || !is_dir($src)) { fwrite(STDERR, "usage: tools/lang/human.php [out folder]\n"); exit(1); } if ($out !== null) { @mkdir($out, 0777, true); } $bad = 0; $n = 0; foreach (glob("$src/*.als") as $file) { $canon = (string) file_get_contents($file); $human = Human::toHuman($canon); $back = Human::toCanonical($human); $n++; if ($back !== $canon || !Human::isHuman($human) || Human::isHuman($canon)) { $bad++; $a = explode("\n", $canon); $b = explode("\n", $back); foreach ($a as $k => $l) { if (($b[$k] ?? null) !== $l) { printf("%s line %d:\n %s\n %s\n (90: %s)\n", basename($file), $k + 1, $l, $b[$k] ?? '(none)', explode("\n", $human)[$k] ?? ''); break; } } } if ($out !== null) { file_put_contents("$out/" . basename($file), $human); } } printf("%d scripts, %d round trips differ\n", $n, $bad); exit($bad ? 2 : 0);