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, polytypo/polytypo-python#6 and polytypo/polytypo-go#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.

closed_up_symbol? is a literal code-point predicate — 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. Examples pin both sides, including two currency signs deliberately outside the set.

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; nil 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: 1141 examples, 0 failures on Ruby 3.3.8. Beyond the suite: all 1238 runnable canonical 1.3.0 fixture cases across 18 locales and all three modes pass and are idempotent against this build. RuboCop was not run locally (it does not build on this machine); CI covers it.

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_up_symbol? is a literal
code-point predicate, never a regex or a Unicode property 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. Examples pin both sides — U+20B9/U+20B4, which nothing else names, and
U+058F/U+FFE5, currency signs deliberately outside the set.

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, nil 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_blocked?) 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 an example for the composed shape the canonical
exhaustive sweep could not reach — it needs eleven tokens.

Verified beyond the suite: all 1238 runnable canonical fixture cases at spec
1.3.0, across all 18 locales and all three modes, pass and are idempotent
against this build. 1141 examples pass on Ruby 3.3.8.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rogulia
rogulia merged commit 9693d13 into main Sep 19, 2026
3 checks passed
@rogulia
rogulia deleted the feat/closed-up-symbol-ranges branch September 19, 2026 09:57
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