Skip to content

Throwing matches and update to CustomMatchingRegexComponent #273

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
Apr 18, 2022

Conversation

itingliu
Copy link
Contributor

@itingliu itingliu commented Apr 13, 2022

  • Update the name CustomRegexComponent to CustomMatchingRegexComponent per pitch
  • Adopt throws for CustomMatchingRegexComponent as added in Throwing customization hooks #261. Errors thrown by CustomMatchingRegexComponent's conformers will be bubbled up to the engine and surfaced at client-side.

@itingliu itingliu requested a review from milseman April 13, 2022 15:23
@itingliu
Copy link
Contributor Author

Could anyone call out to @swift-ci for me?

@rxwei
Copy link
Contributor

rxwei commented Apr 13, 2022

@swift-ci please test

@itingliu
Copy link
Contributor Author

Tests are failing because I was still using the old function names before Michael's renaming cleanup

@rxwei
Copy link
Contributor

rxwei commented Apr 14, 2022

@swift-ci please test

@@ -293,13 +293,15 @@ extension Compiler.ByteCodeGen {
mutating func emitMatcher(
_ matcher: @escaping _MatcherInterface,
into capture: CaptureRegister? = nil
) {
) throws {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm why does the compiler need to throw? It's only the underlying matcher that throws, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm you're right that it doesn't. I didn't understand how this works well so I thought it was needed. For my information why does the compiler need to throw in the case like emitTransform and emitCharacter?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's because they call emitNode which throws. emitNode throws because emitReference throws. emitReference throws because it needs to check the validity of references and throw RegexCompilationError.

- Update the name `CustomRegexComponent` to `CustomMatchingRegexComponent` per pitch
- Adopt `throws` for `CustomMatchingRegexComponent` as added in swiftlang#261. Errors thrown by
`CustomMatchingRegexComponent`'s conformers will be bubbled up to the engine and
surfaced at client-side.
@itingliu
Copy link
Contributor Author

@swift-ci please test

@rxwei
Copy link
Contributor

rxwei commented Apr 18, 2022

We need this in ASAP to make 5.7. Merging.

@rxwei rxwei merged commit b959d0a into swiftlang:main Apr 18, 2022
Azoy pushed a commit to Azoy/swift-experimental-string-processing that referenced this pull request Apr 19, 2022
Throwing matches and update to CustomMatchingRegexComponent
@itingliu itingliu deleted the throwing-hooks branch April 21, 2022 18:06
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