Skip to content

Keep track of initial options in compiled program #412

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

Merged
merged 4 commits into from
May 16, 2022

Conversation

natecook1000
Copy link
Member

This allows us to fix an issue where searching via firstMatch or matches(of:) would only start searches at a character index, even when a regex has Unicode scalar semantics.

The initial options are stored in the lower program, and include
all options that are set before the first attempted match. Note that
not all initial options are global - a leading option-setting group
is included in initial options, even though it applies only to a
portion of the overall regex.
Previously, searching via firstMatch or matches(of:) would only
_start_ searches at a character index, even when a regex has
Unicode scalar semantics.
@natecook1000 natecook1000 requested a review from milseman May 13, 2022 16:43
Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this! I think we can do this in a way that avoids adding temporal variance.

@natecook1000
Copy link
Member Author

@swift-ci Please test

@natecook1000 natecook1000 merged commit a4d7be0 into swiftlang:main May 16, 2022
natecook1000 added a commit to natecook1000/swift-experimental-string-processing that referenced this pull request May 16, 2022
The initial options are stored in the lowered program, and include
all options that are set before the first attempted match. Note that
not all initial options are global - a leading option-setting group
is included in initial options, even though it applies only to a
portion of the overall regex.

Previously, searching via firstMatch or matches(of:) would only
_start_ searches at a character index, even when a regex has
Unicode scalar semantics.
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.

2 participants