Repository navigation
ranges: admit a symbol repeated closed up on both members - #6
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements spec 1.3.0's
ranges.md§3.2a and thedashes.mdstep 8 amendment it forced (polytypo/polytypo@bb9a54e, canonical issue polytypo/polytypo#23), after polytypo/polytypo-js#15.$15-$20and35%-50%become range candidates. The line is closed-up versus spaced, not currency versus unit (Chicago 9.19), so$and%are one rule and15 kg-20 kgis out of scope.CLOSED_SYMBOLis 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 anSctest 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;Noneis the signaldashesreads to stay out, so$15-€20and15-$20never change hands.T1 is the part that could not be skipped. Widening a range member widens what a
dashesedit 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 nowCLOSED-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 --strictclean. 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