Skip to content

Conversation

@shilangyu
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the look-behind processing logic within the PikeVM by consolidating duplicated looping code into a new helper function, fast_forward_lookbehinds, and updating its usage in matching and prefilter branches.

  • Replaces manual loops with a dedicated fast_forward_lookbehinds function.
  • Updates both the initial matching and the pre-filter branch to leverage the new helper.
  • Improves maintainability by reducing code duplication in look-behind thread processing.
Comments suppressed due to low confidence (1)

regex-automata/src/nfa/thompson/pikevm.rs:1480

  • [nitpick] Consider adding or updating tests to cover edge cases for fast_forward_lookbehinds, such as when input.start is 0 or when the forward span covers the entire valid range.
for lb_at in forward_span.start..forward_span.end {

Copy link
Collaborator

@Multimodcrafter Multimodcrafter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a clean fix to me. Of course, the prefiltering might not be so relevant if the look-behind threads have to be stepped through but on the other hand, look-behind expressions might be much simpler than the main regex and in that case, it could have a performance benefit.

@shilangyu shilangyu merged commit cb8d7ea into captureless-lookbehinds May 8, 2025
16 checks passed
@Multimodcrafter Multimodcrafter deleted the fix/prefilter branch May 10, 2025 20:32
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.

3 participants