Skip to content

fix: distribute mixed-width lookbehinds; maybe() over any item - #13

Merged
ronaldtse merged 1 commit into
mainfrom
fix/lookbehind-branches-and-maybe
Oct 1, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
fix/lookbehind-branches-and-maybe

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Follows #12. Two more conformance classes:

Mixed-width lookbehinds. Python re requires fixed-width lookbehinds; Onigmo doesn't. odni-kor's before any([line_start, " "]) (widths 0 and 1) crashed pattern compilation. Guard expressions now expand into fixed-width branches by cross product over alternations and optionals — (?<=A|B) → (?:(?<=A)|(?<=B)), (?<!A|B) → (?<!A)(?<!B) — shared by the parallel path and the subst path.

maybe() over any item. alalc-aze and odni-pus write from maybe(any("ُ")) + "او"; the renderer rejected non-string inners and the maps failed to load. The maybe token now recurses as a full expression in regex, literal, and max_length (Ruby Repeat#max_length = inner).

Direct corpus sweep through the engine: 216 failures / 46 maps → 173 / 33; suite 41 passed / 1 xpassed.

Python re requires fixed-width lookbehinds; Ruby's Onigmo does not.
Guards like odni-kor's before any([line_start, " "]) — alternatives
of width 0 and 1 — crashed compilation. Lookbehind guards now expand
their expression into fixed-width branches by cross product over
alternations and optionals: (?<=A|B) becomes (?:(?<=A)|(?<=B)) and
(?<!A|B) becomes (?<!A)(?<!B). Both the parallel path and the subst
path share the helpers.

maybe() now accepts any item, not only strings — alalc-aze and
odni-pus use from maybe(any("...")) + ... and previously failed to
load. Its token recurses like any other expression in regex, literal
and max_length.

Direct corpus sweep: 216 failures / 46 maps -> 173 / 33.
@ronaldtse
ronaldtse merged commit 88f8c58 into main Oct 1, 2026
6 checks passed
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