Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve IndexOf handling in regex source generator / compiler #77925

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

stephentoub
Copy link
Member

This PR does a few related things:

  1. Consolidates most (but not all) use of IndexOf variants into a single helper that can then be used from multiple locations to avoid code duplication and make it easier for us to extend in the future with additional IndexOf variants.
  2. Stops using IndexOf when doing lazy backtracking in an optional.
  3. Special-cases "any" repeaters to not do any character checking.
  4. Adds use of IndexOf (via the new helper) into repeaters.

Fixes #77905 (mostly)

This PR does a few related things:
1. Consolidates _most_ (but not all) use of IndexOf variants into a single helper that can then be used from multiple locations to avoid code duplication and make it easier for us to extend in the future with additional IndexOf variants.
2. Stops using IndexOf when doing lazy backtracking in an optional.
3. Special-cases "any" repeaters to not do any character checking.
4. Adds use of IndexOf (via the new helper) into repeaters.
@ghost
Copy link

ghost commented Nov 4, 2022

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR does a few related things:

  1. Consolidates most (but not all) use of IndexOf variants into a single helper that can then be used from multiple locations to avoid code duplication and make it easier for us to extend in the future with additional IndexOf variants.
  2. Stops using IndexOf when doing lazy backtracking in an optional.
  3. Special-cases "any" repeaters to not do any character checking.
  4. Adds use of IndexOf (via the new helper) into repeaters.

Fixes #77905 (mostly)

Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: 8.0.0

@stephentoub stephentoub merged commit 62e06de into dotnet:main Nov 7, 2022
@stephentoub stephentoub deleted the regexindexof branch November 7, 2022 15:23
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate IndexOf variations into helper in regex source generator and compiler
2 participants