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), after polytypo/polytypo-js#15.

$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.

CLOSED_SYMBOL is a literal code-point set — the currency part is the U+20A0–U+20CF block by its bounds, not the subset assigned in some Unicode version, because that subset drifts between runtimes built against different UCD releases. Tests pin both sides, including two currency signs deliberately outside the set that an Sc test would wrongly admit.

range_flanks() decides both sides from the original flanks simultaneously and takes a side's walk only if the symbol is matched on the opposite member; None is the signal 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 in the tests, one per position and side.

Python's two-step lookout already read effective neighbours on both branches, which is what spec 1.3.0's step 8 now states in text — a test pins that too.

Checks: 1191 tests, packaging 4, ruff, ruff format, mypy --strict clean. 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 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. CLOSED_SYMBOL is a literal
code-point set, never a Unicode category test: 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 that an Sc test would admit.

range_flanks() 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, None 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 (spacing_transition_guard_blocks) 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. Four witnesses in the
tests, one per position and side, plus the composed shape the canonical
exhaustive sweep could not reach.

Python's two-step lookout already read effective neighbours on both branches,
which is what spec 1.3.0's step 8 now says in text; a test pins it.

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. 1191 tests pass, ruff, ruff format, mypy --strict and the packaging test
are clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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