Skip to content

Move off of RegexBuilder for URL.Template #1273

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

danieleggert
Copy link
Contributor

This fixes #1269

This uses try! Regex("…") instead of RegexBuilder to create regular expressions used by the URL Template implementation.

@itingliu
Copy link
Contributor

@swift-ci please test

}
}
}
self.operatorRegex = try! Regex(#"([\+#.\/;\?&])?"#)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if it makes a difference whether you create a Regex this way or the other one that specifies the output type?

init(
    _ pattern: String,
    as outputType: Output.Type = Output.self
) throws

For example would it help the performance since we can bypass parsing the result from AnyOutputRegex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea if that makes any difference. Happy to change it, if that helps. These are only every created once, though.

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.

Make URI template's regex parsing available in swift-foundation
2 participants