An early experimental general-purpose pattern matching engine for Swift.
Swift
308
1,052 commits
updated Sep 23, 2026
An early experimental general-purpose pattern matching engine for Swift.
See Declarative String Processing Overview
To try out the functionality provided here, download the latest open source development toolchain. Import _StringProcessing in your source file to get access to the API and specify -Xfrontend -enable-experimental-string-processing to get access to the literals.
For example, in a Package.swift file's target declaration:
.target(
name: "foo",
dependencies: ["depA"],
swiftSettings: [.unsafeFlags(["-Xfrontend", "-enable-experimental-string-processing"])]
),
_RegexParser and _StringProcessing are specially integrated modules that are built as part of apple/swift.
Specifically, _RegexParser contains the parser for regular expression literals and is built both as part of the compiler and as a core library. _CUnicode and _StringProcessing are built together as a core library named _StringProcessing.
| Module | Swift toolchain component |
|---|---|
_RegexParser | SwiftCompilerSources/Sources/_RegexParser and stdlib/public/_RegexParser |
_CUnicode | stdlib/public/_StringProcessing |
_StringProcessing | stdlib/public/_StringProcessing |
The main branch is the branch for day-to-day development. Generally, you should create PRs against this branch.
Branches whose name starts with swift/ are Swift integration branches similar to those in apple/llvm-project. For each branch, dropping the swift/ prefix is the corresponding branch in apple/swift.
This package's main branch automatically integrates with Swift's main branch.
| apple/swift branch | apple/swift-experimental-string-processing branch |
|---|---|
| release/5.7 | swift/release/5.7 |
| ... | swift/... |
A pair of corresponding branches are expected to build successfully together and pass all tests.
To integrate the latest changes in apple/swift-experimental-string-processing to apple/swift, carefully follow the workflow:
@swift-ci please test
_RegexParser module.
main in apple/swift-experimental-string-processing, create a pull request in apple/swift. Note: Since CI in apple/swift-experimental-string-processing has not yet been set up to run full toolchain tests, you should create a PR in apple/swift regardless; if the integration does not require changing apple/swift, create a dummy PR in apple/swift by changing the README and close it in the end instead of merging.<PR NUMBER> with the apple/swift pull request number, if any):
apple/swift#<PR NUMBER> # use this line only if there is an corresponding apple/swift PR
@swift-ci please test
<PR NUMBER> with the apple/swift-experimental-string-processing pull request number):
apple/swift-experimental-string-processing#<PR NUMBER>
@swift-ci please test
Compiler integration can be tricky. Use special caution when developing _RegexParser and _StringProcessing modules.
_StringProcessing, do not write fully qualified references to symbols in _CUnicode, and always wrap import _CUnicode in a #if canImport(_CUnicode). This is because _CUnicode is built as part of _StringProcessing with CMake.(top 30 of 37)
Swift
98.8%
An early experimental general-purpose pattern matching engine for Swift.
Swift
308
1,052 commits
updated Sep 23, 2026
An early experimental general-purpose pattern matching engine for Swift.
See Declarative String Processing Overview
To try out the functionality provided here, download the latest open source development toolchain. Import _StringProcessing in your source file to get access to the API and specify -Xfrontend -enable-experimental-string-processing to get access to the literals.
For example, in a Package.swift file's target declaration:
.target(
name: "foo",
dependencies: ["depA"],
swiftSettings: [.unsafeFlags(["-Xfrontend", "-enable-experimental-string-processing"])]
),
_RegexParser and _StringProcessing are specially integrated modules that are built as part of apple/swift.
Specifically, _RegexParser contains the parser for regular expression literals and is built both as part of the compiler and as a core library. _CUnicode and _StringProcessing are built together as a core library named _StringProcessing.
| Module | Swift toolchain component |
|---|---|
_RegexParser | SwiftCompilerSources/Sources/_RegexParser and stdlib/public/_RegexParser |
_CUnicode | stdlib/public/_StringProcessing |
_StringProcessing | stdlib/public/_StringProcessing |
The main branch is the branch for day-to-day development. Generally, you should create PRs against this branch.
Branches whose name starts with swift/ are Swift integration branches similar to those in apple/llvm-project. For each branch, dropping the swift/ prefix is the corresponding branch in apple/swift.
This package's main branch automatically integrates with Swift's main branch.
| apple/swift branch | apple/swift-experimental-string-processing branch |
|---|---|
| release/5.7 | swift/release/5.7 |
| ... | swift/... |
A pair of corresponding branches are expected to build successfully together and pass all tests.
To integrate the latest changes in apple/swift-experimental-string-processing to apple/swift, carefully follow the workflow:
@swift-ci please test
_RegexParser module.
main in apple/swift-experimental-string-processing, create a pull request in apple/swift. Note: Since CI in apple/swift-experimental-string-processing has not yet been set up to run full toolchain tests, you should create a PR in apple/swift regardless; if the integration does not require changing apple/swift, create a dummy PR in apple/swift by changing the README and close it in the end instead of merging.<PR NUMBER> with the apple/swift pull request number, if any):
apple/swift#<PR NUMBER> # use this line only if there is an corresponding apple/swift PR
@swift-ci please test
<PR NUMBER> with the apple/swift-experimental-string-processing pull request number):
apple/swift-experimental-string-processing#<PR NUMBER>
@swift-ci please test
Compiler integration can be tricky. Use special caution when developing _RegexParser and _StringProcessing modules.
_StringProcessing, do not write fully qualified references to symbols in _CUnicode, and always wrap import _CUnicode in a #if canImport(_CUnicode). This is because _CUnicode is built as part of _StringProcessing with CMake.(top 30 of 37)
Swift
98.8%