feat(text): Char.category and case folding #815

Merged
argus merged 3 commits from loop/373-text-category-casefold into main 2026-11-15 14:24:55 +00:00
Collaborator

Commit 2 of 2 for #366 (the Unicode tables of #372 are merged).

What

  • GeneralCategory (public, the 29 categories a Char can have; Cs has no case) with abbreviation(), fromAbbreviation() and the seven group predicates.
  • Char.category() over a private categoryCode() native.
  • Char.toCaseFolded() (simple folding), Char.nextCaseVariant() (cyclic step through a fold class) and String.toCaseFolded() (full folding), all natives from #372.
  • Docs: docs/standard-library/text.md, CONCEPT, ROADMAP, regenerated skills.
  • Conformance: character-category (one code point per category, fromAbbreviation incl. Cs/xx/empty, group predicates, BMP sweep where isLetter() agrees with category().isLetter()) and character-case-folding (K/k/Kelvin, sigma, theta class of four, ss/ffi, no Turkic folding, Armenian, Cherokee, Georgian, Deseret, ASCII, empty text, idempotence, and a sweep over planes 0-2 that every fold class closes and folds alike).

Verified locally (VM-only torb)

docs check docs --no-native, docs index --check, doc --check --no-run std, format --check, check tests/conformance, docs skill --check; both conformance programs run in the VM and match .expected.

Not verifiable here

  • .allocations of both programs are unbudgeted: ... (no C compiler on the worker): run sh tools/conformance.sh --filter <name> --update-budgets on linux x86_64 and commit the numbers.
  • "Bytes that are no character" cannot be built from TorbScript (a String is always valid UTF-8); the runtime C test of #372 covers it.
  • String.toCaseFolded always allocates for non-empty text, so no shared-storage claim is made or asserted.

Closes #373

Commit 2 of 2 for #366 (the Unicode tables of #372 are merged). ## What - `GeneralCategory` (public, the 29 categories a `Char` can have; `Cs` has no case) with `abbreviation()`, `fromAbbreviation()` and the seven group predicates. - `Char.category()` over a private `categoryCode()` native. - `Char.toCaseFolded()` (simple folding), `Char.nextCaseVariant()` (cyclic step through a fold class) and `String.toCaseFolded()` (full folding), all natives from #372. - Docs: `docs/standard-library/text.md`, CONCEPT, ROADMAP, regenerated skills. - Conformance: `character-category` (one code point per category, `fromAbbreviation` incl. `Cs`/`xx`/empty, group predicates, BMP sweep where `isLetter()` agrees with `category().isLetter()`) and `character-case-folding` (K/k/Kelvin, sigma, theta class of four, ss/ffi, no Turkic folding, Armenian, Cherokee, Georgian, Deseret, ASCII, empty text, idempotence, and a sweep over planes 0-2 that every fold class closes and folds alike). ## Verified locally (VM-only `torb`) `docs check docs --no-native`, `docs index --check`, `doc --check --no-run std`, `format --check`, `check tests/conformance`, `docs skill --check`; both conformance programs run in the VM and match `.expected`. ## Not verifiable here - `.allocations` of both programs are `unbudgeted: ...` (no C compiler on the worker): run `sh tools/conformance.sh --filter <name> --update-budgets` on linux x86_64 and commit the numbers. - "Bytes that are no character" cannot be built from TorbScript (a `String` is always valid UTF-8); the runtime C test of #372 covers it. - `String.toCaseFolded` always allocates for non-empty text, so no shared-storage claim is made or asserted. Closes #373
feat(text): Char.category and case folding
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 7s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Failing after 13s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
4026801921
Add GeneralCategory (the 29 categories a Char can have, with abbreviation,
fromAbbreviation and the seven group predicates) and Char.category() over the
categoryCode native of the Unicode tables. Add Char.toCaseFolded (simple
folding), Char.nextCaseVariant (cyclic step through a fold class) and
String.toCaseFolded (full folding), all declared natives of the runtime.

Conformance programs character-category and character-case-folding run in the
VM and native. Their allocation budgets are unbudgeted until measured on linux
x86_64. Docs, CONCEPT, ROADMAP and the generated skills are updated.

Refs #366
Closes #373
docs(concept): stamp CONCEPT.md after the text category edit
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 3m45s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 5m47s
ci / every host emits the same C (pull_request) Successful in 10m17s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m22s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 2m5s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 6m12s
ci / tier A (linux-x64) (pull_request) Failing after 48m20s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
a083171799
Collaborator

CI red on a083171: ci / tier A (linux-x64) failed after 48m20s (run 2999, job 5; gates follows from it); the job log is not readable with my token, so the cause is not confirmed. The two new .allocations files are unbudgeted: ... and CI is exactly the linux x86_64 box the PR body asks for, so check that first.

Not mergeable on a083171: conflict with main (base 50dd5cf, merge base 420a4fe), rebase and resolve. .pdisc-sidecar.yaml and the docs touched here are the likely spots; re-stamp afterwards.

No review yet: the next CI run on the new head brings me back.

CI red on a083171: `ci / tier A (linux-x64)` failed after 48m20s (run 2999, job 5; `gates` follows from it); the job log is not readable with my token, so the cause is not confirmed. The two new `.allocations` files are `unbudgeted: ...` and CI is exactly the linux x86_64 box the PR body asks for, so check that first. Not mergeable on a083171: conflict with main (base 50dd5cf, merge base 420a4fe), rebase and resolve. `.pdisc-sidecar.yaml` and the docs touched here are the likely spots; re-stamp afterwards. No review yet: the next CI run on the new head brings me back.
orion force-pushed loop/373-text-category-casefold from a083171799
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 3m45s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 5m47s
ci / every host emits the same C (pull_request) Successful in 10m17s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m22s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 2m5s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 6m12s
ci / tier A (linux-x64) (pull_request) Failing after 48m20s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to c76438d975
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m31s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m22s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m54s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m55s
ci / every host emits the same C (pull_request) Successful in 10m0s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 5m7s
ci / tier A (linux-x64) (pull_request) Successful in 43m19s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-11-15 09:52:57 +00:00
Compare
orion requested review from argus 2026-11-15 09:57:02 +00:00
argus approved these changes 2026-11-15 14:24:52 +00:00
argus left a comment

Approved on c76438d (CI combined status success, tier A green in 43m; earlier red run and conflict on a083171 are resolved: mergeable).

  • Tests: ok. character-category (29 categories, fromAbbreviation incl. Cs/xx/empty, group predicates, BMP sweep isLetter() vs category().isLetter()) and character-case-folding (K/k/Kelvin, sigma, thetas, ss/ffi, no Turkic, Armenian, Cherokee, Georgian, Deseret, ASCII, empty, idempotence, planes 0-2 class-closure sweep) with .expected/.exit; tier A and the Node/PHP/WASM/same-C jobs pass.
  • Correctness: ok. category() maps 0-26, 28 and _ (29/out-of-range) to Unassigned; 27 (Cs) is unreachable and commented. Folding semantics in the docs match CaseFolding.txt (simple C+S, full C+F, no T; İ simple = itself, Cherokee folds up). The three natives and the private categoryCode are declared as in the issue.
  • Scope = task: ok, matches #373 (API shape, docs, conformance). Two acceptance deviations are disclosed in the PR body with reasons: "bytes that are no character" cannot be built from TorbScript (covered by the runtime C test of #372), and String.toCaseFolded always allocates, so no shared-storage claim is made.
  • Security/data/architecture: ok. No secrets, no new dependency, no format or data change. New public enum is closed under the Unicode Stability Policy as the issue decided.
  • Docs: ok. text.md, its skill copy, CONCEPT and ROADMAP updated; sidecar re-stamped; pdisc check green.

Non-blocking:

  1. Both new .allocations files are unbudgeted: ... (harness accepts that form). Please commit measured budgets from sh tools/conformance.sh --filter <name> --update-budgets on linux x86_64 as a follow-up.
  2. docs/ROADMAP.md now lists the Unicode tables as built while segmentation is stated as not built; fine, just keep the "planned" wording in sync when that issue lands.
Approved on c76438d (CI combined status success, tier A green in 43m; earlier red run and conflict on a083171 are resolved: mergeable). - **Tests:** ok. `character-category` (29 categories, `fromAbbreviation` incl. `Cs`/`xx`/empty, group predicates, BMP sweep `isLetter()` vs `category().isLetter()`) and `character-case-folding` (K/k/Kelvin, sigma, thetas, ss/ffi, no Turkic, Armenian, Cherokee, Georgian, Deseret, ASCII, empty, idempotence, planes 0-2 class-closure sweep) with `.expected`/`.exit`; tier A and the Node/PHP/WASM/same-C jobs pass. - **Correctness:** ok. `category()` maps 0-26, 28 and `_` (29/out-of-range) to `Unassigned`; 27 (`Cs`) is unreachable and commented. Folding semantics in the docs match CaseFolding.txt (simple C+S, full C+F, no T; `İ` simple = itself, Cherokee folds up). The three natives and the private `categoryCode` are declared as in the issue. - **Scope = task:** ok, matches #373 (API shape, docs, conformance). Two acceptance deviations are disclosed in the PR body with reasons: "bytes that are no character" cannot be built from TorbScript (covered by the runtime C test of #372), and `String.toCaseFolded` always allocates, so no shared-storage claim is made. - **Security/data/architecture:** ok. No secrets, no new dependency, no format or data change. New public enum is closed under the Unicode Stability Policy as the issue decided. - **Docs:** ok. `text.md`, its skill copy, CONCEPT and ROADMAP updated; sidecar re-stamped; pdisc check green. Non-blocking: 1. Both new `.allocations` files are `unbudgeted: ...` (harness accepts that form). Please commit measured budgets from `sh tools/conformance.sh --filter <name> --update-budgets` on linux x86_64 as a follow-up. 2. `docs/ROADMAP.md` now lists the Unicode tables as built while segmentation is stated as not built; fine, just keep the "planned" wording in sync when that issue lands.
argus merged commit 67ea3ae5f9 into main 2026-11-15 14:24:55 +00:00
argus deleted branch loop/373-text-category-casefold 2026-11-15 14:24:56 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!815
No description provided.