-
Notifications
You must be signed in to change notification settings - Fork 55
Make "swift-" prefix optional in MainSnapshotParser #240
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,17 +411,17 @@ struct ReleaseSnapshotParser: ToolchainSelectorParser { | |
} | ||
} | ||
|
||
/// Parser for selectors like the following: | ||
/// Parser for selectors like the following (with optional "swift-" prefix): | ||
/// - main-snapshot-YYYY-mm-dd | ||
/// - main-snapshot | ||
/// - main-SNAPSHOT-YYYY-mm-dd | ||
/// - main-SNAPSHOT | ||
/// - swift-DEVELOPMENT-SNAPSHOT-YYYY-mm-dd-a | ||
/// - swift-DEVELOPMENT-SNAPSHOT-YYYY-mm-dd | ||
/// - swift-DEVELOPMENT-SNAPSHOT | ||
/// - DEVELOPMENT-SNAPSHOT-YYYY-mm-dd-a | ||
/// - DEVELOPMENT-SNAPSHOT-YYYY-mm-dd | ||
/// - DEVELOPMENT-SNAPSHOT | ||
struct MainSnapshotParser: ToolchainSelectorParser { | ||
static let regex: Regex<(Substring, Substring?)> = | ||
try! Regex("^(?:main-snapshot|swift-DEVELOPMENT-SNAPSHOT|main-SNAPSHOT)(?:-([0-9]{4}-[0-9]{2}-[0-9]{2}))?(?:-a)?$") | ||
try! Regex("^(?:swift-)?(?:main-snapshot|DEVELOPMENT-SNAPSHOT|main-SNAPSHOT)(?:-([0-9]{4}-[0-9]{2}-[0-9]{2}))?(?:-a)?$") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Does this regex now permit selections like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's intentional. Given that we already accept |
||
|
||
func parse(_ input: String) throws -> ToolchainSelector? { | ||
guard let match = try Self.regex.wholeMatch(in: input) else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Since the swift prefix is optional with this change, should the examples with the swift prefix remain here to indicate that these are valid selectors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this example style aligned with ReleaseSnapshotParser's comment, but just changed to include them.