Repository navigation
WO20: megaregexp replacement build, deferred re-only tos, undefined-ref drops — reverse shrink-to-zero - #868
Merged
Merged
Conversation
…ed-ref drops - WO20 reverse shrink-to-zero Three engine fixes closing the ruby side of the WO20 reverse-golden divergence families (rs PR wo20-reverse-shrink-to-zero is the reference side; with these the full 15,321-row reverse replay is 0-delta): - Megaregexp replacements now carry the STRING build (`build_item(:str)` - groups join, captures parenthesize, refs become backrefs), which is what rs `build_replacement` renders over the nth_string collapse. `build_item(:parstr)` demotes to the :par product build and returns ARRAYS for group `to`s, which gsub stringified as Ruby inspect into the output (odni-pus `Aبد[" اللَّه"]`). The WO18 G1 canon - a ref template in a parallel pass fails loud and named - is pinned by an explicit guard (spec/isc/semantics_spec.rb stays green). - Re-only aliases in a reversed `to` (the boundary a word-boundary rule's reversal hoists onto the to side) defer the parstr build to match time: rs renders replacements lazily, so a rule that never fires must not poison the whole pass (bgnpcgn-per / un-prs "Can't use boundary in a par context" nulls). - A from-pattern backreference to a group the pattern does not itself define drops the rule from the alternation: rs match_item fails a ref on an unparticipated group (never matches), while the combined named-group compile refused numbered refs outright (bgnpcgn-zho RegexpError nulls). ruby gsub semantics for unmatched/out-of-range refs (empty insertion) were already correct here.
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.
Summary
The ruby side of the WO20 reverse-golden shrink-to-zero (rs PR wo20-reverse-shrink-to-zero is the reference side; merge that first — it carries the grown golden this replay consumes).
Three engine fixes in the megaregexp parallel pass, each closing a divergence family:
:strsemantics (rsbuild_replacementparity) instead of the:parstrarray product build that stringified arrays into the output (odni-pus family). The WO18 G1 canon (ref template in parallel fails loud and named) is pinned by an explicit guard —spec/isc/semantics_spec.rbunchanged and green.tos: rs renders replacements lazily (only when a rule fires); a boundary hoisted onto a reversedtono longer kills the whole pass when the rule never matches (bgnpcgn-per / un-prs family, 32 null rows).\Nto a group the pattern does not define can never match (rs semantics) — the rule now drops from the alternation instead of failing the combined compile (bgnpcgn-zho family).With this branch plus the rs golden, the full reverse replay is 0 deltas on 15,321 rows / 452 maps.
Test plan
bundle exec rake spec: 546 examples, 106 failures — failure set byte-identical to pristine origin/main (verified by diff; those 106 are pre-existing environment failures)