Skip to content

Add the CustomRegexComponent protocol #173

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 1 commit into from
Feb 21, 2022

Conversation

timvermeulen
Copy link

Adds the CustomRegexComponent protocol that inherits from RegexProtocol, and modifies _MatcherInterface to also take an index that is separate from the given index range.

@timvermeulen
Copy link
Author

@swift-ci Please test Linux platform

})
}
public protocol CustomRegexComponent: RegexProtocol {
func match(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be firstMatch?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so, because it's not doing a search to find the first match. It has to match at the index provided. I'm open to better names though.

Copy link
Author

Choose a reason for hiding this comment

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

Happy to tweak this name, I just needed something that was at least somewhat fitting. But there's really no need for it to be terse.

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.

LGTM, though we could bike shed match more if we want to.

})
}
public protocol CustomRegexComponent: RegexProtocol {
func match(
Copy link
Member

Choose a reason for hiding this comment

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

I don't think so, because it's not doing a search to find the first match. It has to match at the index provided. I'm open to better names though.

@timvermeulen timvermeulen merged commit c35c30a into swiftlang:main Feb 21, 2022
@timvermeulen timvermeulen deleted the custom-regex-component branch February 21, 2022 12:10
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