Skip to content

ranges: admit a symbol repeated closed up on both members - #6

Merged
rogulia merged 1 commit into
mainfrom
feat/closed-up-symbol-ranges
Sep 19, 2026
Merged

rogulia merged 1 commit into
mainfrom
feat/closed-up-symbol-ranges

Conversation

@rogulia

@rogulia rogulia commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Implements spec 1.3.0's ranges.md §3.2a and the dashes.md step 8 amendment it forced (polytypo/polytypo@bb9a54e, canonical issue polytypo/polytypo#23). Fifth and last runtime, after polytypo/polytypo-js#15, polytypo/polytypo-python#6, polytypo/polytypo-go#6 and polytypo/polytypo-ruby#6.

$15-$20 and 35%-50% become range candidates. The line is closed-up versus spaced, not currency versus unit (Chicago 9.19), so $ and % are one rule and 15 kg-20 kg is out of scope.

isClosedUpSymbol is a literal code-point predicate, never a preg_match on \p{Sc} — the currency part is the U+20A0–U+20CF block by its bounds, because the assigned subset drifts between runtimes built against different UCD releases. Tests pin both sides, including two currency signs deliberately outside the set that a category test would wrongly admit.

rangeFlanks decides both sides from the original flanks simultaneously and takes a side's walk only if the symbol is matched on the opposite member; null is what dashes reads to stay out, so $15-€20 and 15-$20 never change hands.

T1 is the part that could not be skipped. Widening a range member widens what a dashes edit elsewhere can disturb — an unamended T1 reads the symbol as the neighbour, stops one code point short of the dash, and a neighbouring range converts on the next pass. The reach is now CLOSED-SYMBOL-transparent at two positions per side; four witnesses, plus the composed eleven-token shape the canonical sweep could not reach.

Checks: 1138 tests, 2953 assertions, 21 skipped (the markdown cases this runtime declines); PHPStan level 8 and phpcs clean — PHP 8.3.32. Beyond the suite: all 1219 runnable text/html canonical 1.3.0 fixture cases across 18 locales pass and are idempotent against this build.

The vendored resources/spec/ snapshot stays at 1.2.0; it is re-vendored in the 1.3.0 release round.

🤖 Generated with Claude Code

Implements spec 1.3.0's ranges.md 3.2a and the dashes.md step 8 amendment it
forced (polytypo/polytypo@bb9a54e, canonical issue #23), porting
polytypo-js@5bf847f. `$15-$20` and `35%-50%` are range candidates now; through
1.2.0 `$15-20` converted and `$15-$20` did not, because the flank next to the
dash was the symbol.

The discriminator is closed-up versus spaced, per Chicago 9.19 — so `$` and `%`
are one rule and `15 kg-20 kg` is out of scope. isClosedUpSymbol is a literal
code-point predicate, never a preg_match on \p{Sc}: the currency part is the
U+20A0-U+20CF block by its own bounds, because the assigned subset drifts
between runtimes built against different UCD releases and block bounds do not.
Tests pin both sides — U+20B9/U+20B4, which no other case names, and
U+058F/U+FFE5, currency signs deliberately outside the set.

rangeFlanks is the whole feature: both sides decided from the original flanks
simultaneously, a side's walk taken only if the symbol is matched on the
opposite member, null for a non-candidate — which is the signal `dashes` reads
to stay out. So `$15-€20` and `15-$20` never change hands, and G4/G5 still
compare digit runs and never see a symbol.

T1 (isSpacingTransitionBlocked) is the part that could not be skipped. Widening
a range member widens what a `dashes` edit elsewhere can disturb: an unamended
T1 reads the symbol as the neighbour, stops one code point short of the dash,
lets a tight token become spaced, and that U+0020 flips a neighbouring range's
guard on the next pass. The reach is now CLOSED-SYMBOL-transparent at two
positions per side, with a test for the composed shape the canonical exhaustive
sweep could not reach — it needs eleven tokens.

Verified beyond the suite: all 1219 runnable text/html canonical fixture cases
at spec 1.3.0, across all 18 locales, pass and are idempotent against this
build. 1138 tests, 2953 assertions; PHPStan level 8 and phpcs clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rogulia
rogulia merged commit 41fc046 into main Sep 19, 2026
3 checks passed
@rogulia
rogulia deleted the feat/closed-up-symbol-ranges branch September 19, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant