fix: distribute mixed-width lookbehinds; maybe() over any item - #13
Merged
Merged
Conversation
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.
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.
Follows #12. Two more conformance classes:
Mixed-width lookbehinds. Python
rerequires fixed-width lookbehinds; Onigmo doesn't. odni-kor'sbefore 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 writefrom 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 (RubyRepeat#max_length= inner).Direct corpus sweep through the engine: 216 failures / 46 maps → 173 / 33; suite 41 passed / 1 xpassed.