Skip to content

RegexBuilder module #227

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
Mar 25, 2022
Merged

RegexBuilder module #227

merged 1 commit into from
Mar 25, 2022

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Mar 24, 2022

Move the regex builder DSL (except RegexComponent) to a new module named RegexBuilder. The DSL depends on DSLTree and a few other supporting types, so those types have been made _spi(RegexBuilder) public. The SPI establishes an ABI between _StringProcessing and RegexBuilder, but I don't think it's a concern because the two modules will co-evolve and both will be rebuilt for every release.

@rxwei rxwei requested a review from milseman March 24, 2022 06:13
@rxwei
Copy link
Contributor Author

rxwei commented Mar 24, 2022

@swift-ci please test

@rxwei rxwei force-pushed the regex-builder-module branch from b78683f to f6c5cbb Compare March 24, 2022 19:41
@rxwei rxwei requested review from itingliu and natecook1000 March 24, 2022 19:41
@rxwei
Copy link
Contributor Author

rxwei commented Mar 24, 2022

I didn't move CharacterClass due to its dependency on AST. It might make sense to make it use DSLTree instead. I or someone else (@natecook1000?) can probably do it in a separate patch.

@rxwei
Copy link
Contributor Author

rxwei commented Mar 24, 2022

@swift-ci please test

1 similar comment
@rxwei
Copy link
Contributor Author

rxwei commented Mar 24, 2022

@swift-ci please test

Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

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

LGTM! I think we may want to talk a bit further about where things like extension String: RegexComponent {} should live, but this should be good for now. It's not ideal that myString.firstMatch(of: "[0-9]+") will work out of the box, and resolve to the regex method, even though it's evaluating as a string literal search.

I'll extricate CharacterClass in a follow-up with some API revisions.

@@ -10,6 +10,16 @@
//===----------------------------------------------------------------------===//

import _MatchingEngine
@_spi(RegexBuilder) import _StringProcessing
import _StringProcessing
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this given we already have line 13?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Removed.

Move the regex builder DSL (except `RegexComponent`) to a new module named RegexBuilder. The DSL depends on `DSLTree` and a few other supporting types, so those types have been made `_spi(RegexBuilder) public`. The SPI establishes an ABI between `_StringProcessing` and `RegexBuilder`, but I don't think it's a concern because the two modules will co-evolve and both will be rebuilt for every release.
@rxwei rxwei force-pushed the regex-builder-module branch from f6c5cbb to b2b35df Compare March 24, 2022 22:28
@rxwei
Copy link
Contributor Author

rxwei commented Mar 24, 2022

@swift-ci please test

@rxwei rxwei merged commit bb1f34a into swiftlang:main Mar 25, 2022
@rxwei rxwei deleted the regex-builder-module branch March 25, 2022 00:33
rxwei added a commit to rxwei/swift that referenced this pull request Mar 28, 2022
The [regex builder DSL](https://forums.swift.org/t/pitch-regex-builder-dsl/56007) proposal adds regex builder to a new module named `RegexBuilder`.

Friend PR: swiftlang/swift-experimental-string-processing#227
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