Skip to content

[Integration] main (39c54d3) -> swift/main #214

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 59 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
05ce1d3
build: add a CMake based build
compnerd Jan 23, 2022
04ad64a
Add a couple of quoted test cases
hamishknight Feb 17, 2022
9d5529e
Update \DDD parsing
hamishknight Feb 17, 2022
1beb1f0
Start of Regex Syntax Pitch
hamishknight Feb 18, 2022
93cc5ca
Update RegexSyntax.md
hamishknight Feb 18, 2022
dbdef62
Update RegexSyntax.md
hamishknight Feb 18, 2022
b7dfa1e
Update RegexSyntax.md
hamishknight Feb 18, 2022
8dc2b4b
Update RegexSyntax.md
hamishknight Feb 21, 2022
c913eea
Update RegexSyntax.md
hamishknight Feb 21, 2022
bbb7756
Update RegexSyntax.md
hamishknight Feb 22, 2022
fb7f380
Update RegexSyntax.md
hamishknight Feb 22, 2022
5a2517f
Update RegexSyntax.md
hamishknight Feb 22, 2022
ff717a3
Update RegexSyntax.md
hamishknight Feb 23, 2022
74acaa8
Update RegexSyntax.md
hamishknight Feb 23, 2022
b83c4e7
Update RegexSyntax.md
hamishknight Feb 23, 2022
31c5cf5
Update RegexSyntax.md
hamishknight Feb 23, 2022
1b12385
Update RegexSyntax.md
hamishknight Feb 25, 2022
3f24f5b
Internalize declarations
milseman Feb 24, 2022
75d4931
Initial custom-component test infrastructure
milseman Feb 22, 2022
34bd8df
Trim prose slightly and reorganize
milseman Feb 26, 2022
2eb7e4e
Cleanup/simplify Executor codepaths (#190)
milseman Feb 26, 2022
6bed883
Quick bug fix / workaround for whole-match values (#191)
milseman Feb 27, 2022
ccc2a7b
Provide alternatives considered
milseman Feb 28, 2022
cc314a2
Update RegexSyntax.md
hamishknight Feb 28, 2022
2ec3187
Merge pull request #169 from hamishknight/back-to-the-future
hamishknight Feb 28, 2022
11bb57d
Update RegexSyntax.md
hamishknight Feb 28, 2022
f64e6ae
Update RegexSyntax.md - grammar convention
milseman Feb 28, 2022
4dab8d8
Merge pull request #125 from compnerd/cmake
rxwei Feb 28, 2022
3ab3b17
Document specially integrated modules and integration process.
rxwei Feb 17, 2022
a443967
Update RegexSyntax.md
hamishknight Feb 28, 2022
9572f99
Update RegexSyntax.md
hamishknight Mar 1, 2022
4d6244e
RegexSyntax.md: Shorten canonical syntax
milseman Mar 1, 2022
bafe039
Intra-doc links
hamishknight Mar 1, 2022
a206f99
Update RegexSyntax.md
hamishknight Mar 1, 2022
cebf4a6
Fix crash on lone backslash
hamishknight Mar 2, 2022
c48fb1c
Separate out DelimiterLexing.swift
hamishknight Mar 2, 2022
0cbb9af
Rename LexError -> DelimiterLexError
hamishknight Mar 2, 2022
7e82082
Refactor delimiter lexing logic
hamishknight Mar 2, 2022
8b3e2ef
Diagnose unprintable ASCII characters
hamishknight Mar 2, 2022
56414b8
Allow lexer recovery for missing closing delimiter
hamishknight Mar 2, 2022
61450e8
Add lexing heuristic to handle single quotes in re'...'
hamishknight Mar 2, 2022
2325cef
Add support for rx'...' for experimental syntax
hamishknight Mar 2, 2022
688f1d8
Change script property default to use Script Extension
hamishknight Mar 2, 2022
5c64747
Rework: syntax for both literals and run time
milseman Mar 2, 2022
d191d8e
Merge pull request #194 from hamishknight/quoted-in-context
hamishknight Mar 2, 2022
f11cda8
Merge pull request #195 from hamishknight/to-some-extent
hamishknight Mar 2, 2022
e667436
Update RegexSyntax.md
hamishknight Mar 2, 2022
9e2828f
Update RegexSyntax.md
hamishknight Mar 2, 2022
f79fb92
Update into
milseman Mar 2, 2022
e8c84a1
Add CustomRegexComponent example (#196)
natecook1000 Mar 2, 2022
996c6d3
Merge pull request #170 from rxwei/integration-doc
rxwei Mar 2, 2022
b315dd0
Update RegexSyntax.md
hamishknight Mar 3, 2022
7b26028
Support text segment boundary anchors (#178)
natecook1000 Mar 3, 2022
0461fa8
Update Documentation/Evolution/RegexSyntax.md
hamishknight Mar 3, 2022
a4d89ec
Merge pull request #140 from hamishknight/regex-syntax
hamishknight Mar 3, 2022
971cccc
Fix negative lookbehind syntax in RegexSyntax.md
hamishknight Mar 3, 2022
b234d9d
Merge pull request #197 from hamishknight/fix-syntax
hamishknight Mar 3, 2022
695cf99
Tweak a few generic signatures to work around a bug in the Requiremen…
slavapestov Mar 4, 2022
39c54d3
Merge pull request #199 from slavapestov/rqm-workaround-rdar89791117
slavapestov Mar 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

cmake_minimum_required(VERSION 3.18)
project(SwiftExperimentalStringProcessing
LANGUAGES Swift)

if(CMAKE_SYSTEM_NAME STREQUAL Windows OR CMAKE_SYSTEM_NAME STREQUAL Darwin)
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
endif()

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)

find_package(ArgumentParser CONFIG)

add_subdirectory(Sources)
845 changes: 845 additions & 0 deletions Documentation/Evolution/RegexSyntax.md

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,65 @@ See [Declarative String Processing Overview][decl-string]
## Requirements

- [Swift Trunk Development Snapshot](https://www.swift.org/download/#snapshots) DEVELOPMENT-SNAPSHOT-2022-02-03 or later.

## Integration with Swift

`_MatchingEngine`, `_CUnicode` and `_StringProcessing` are specially integrated modules that are built as part of apple/swift.

Specifically, `_MatchingEngine` 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 |
| ------------------- | ------------------------------------------------------------------------------------ |
| `_MatchingEngine` | `SwiftCompilerSources/Sources/ExperimentalRegex` and `stdlib/public/_MatchingEngine` |
| `_CUnicode` | `stdlib/public/_StringProcessing` |
| `_StringProcessing` | `stdlib/public/_StringProcessing` |

### Branching scheme

#### Development branch

The `main` branch is the branch for day-to-day development. Generally, you should create PRs against this branch.

#### Swift integration branches

Branches whose name starts with `swift/` are Swift integration branches similar to those in [apple/llvm-project](https://github.com/apple/llvm-project). For each branch, dropping the `swift/` prefix is the corresponding branch in [apple/swift](https://github.com/apple/swift).

| apple/swift branch | apple/swift-experimental-string-processing branch |
| ------------------- | ----------------------------------------------------- |
| main | swift/main |
| release/5.7 | swift/release/5.7 |
| ... | swift/... |

A pair of corresponding branches are expected to build successfully together and pass all tests.

### Integration workflow

To integrate the latest changes in apple/swift-experimental-string-processing to apple/swift, carefully follow the workflow:

- Create pull requests.
- Create a pull request in apple/swift-experimental-string-processing from `main` to `swift/main`, e.g. "[Integration] main -> swift/main".
- If apple/swift needs to be modified to work with the latest `main` in apple/swift-experimental-string-processing, create a pull request in apple/swift.
- Trigger CI.
- In the apple/swift-experimental-string-processing pull request, trigger CI using the following command (replacing `<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
```
- In the apple/swift pull request (if any), trigger CI using the following command (replacing `<PR NUMBER>` with the apple/swift-experimental-string-processing pull request number):
```
apple/swift-experimental-string-processing#<PR NUMBER>
@swift-ci please test
```
- Merge when approved.
- Merge the pull request in apple/swift-experimental-string-processing as a **merge commit**.
- Merge the pull request in apple/swift (if any).

### Development notes

Compiler integration can be tricky. Use special caution when developing `_MatchingEngine`, `_CUnicode` and `_StringProcessing` modules.

- Do not change the names of these modules without due approval from compiler and infrastructure teams.
- Do not modify the existing ABI (e.g. C API, serialization format) between the regular expression parser and the Swift compiler unless absolutely necessary.
- Always minimize the number of lockstep integrations, i.e. when apple/swift-experimental-string-processing and apple/swift have to change together. Whenever possible, introduce new API first, migrate Swift compiler onto it, and then deprecate old API. Use versioning if helpful.
- In `_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.
- In `_MatchingEngine`, do not write fully qualified references to `_MatchingEngine` itself. This is because `_MatchingEngine` is built as `ExperimentalRegex` in `SwiftCompilerSources/` with CMake.
6 changes: 6 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

add_subdirectory(_Unicode)
add_subdirectory(_MatchingEngine)
add_subdirectory(_StringProcessing)
add_subdirectory(Prototypes)
add_subdirectory(VariadicsGenerator)
18 changes: 18 additions & 0 deletions Sources/Prototypes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

add_library(Prototypes
Combinators/Combinators.swift
PEG/PEG.swift
PEG/PEGCode.swift
PEG/PEGCompile.swift
PEG/PEGCore.swift
PEG/PEGInterpreter.swift
PEG/PEGTranspile.swift
PEG/PEGVM.swift
PEG/PEGVMExecute.swift
PEG/Printing.swift
PTCaRet/Interpreter.swift
PTCaRet/PTCaRet.swift
TourOfTypes/CharacterClass.swift
TourOfTypes/Literal.swift)
target_link_libraries(Prototypes PUBLIC
_MatchingEngine)
2 changes: 1 addition & 1 deletion Sources/Prototypes/PEG/PEGCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

import _StringProcessing
@testable import _StringProcessing

extension PEG.VM {
struct Code {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Prototypes/PEG/PEGCompile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

import _StringProcessing
@testable import _StringProcessing

extension PEG.VM {
typealias InIndex = Input.Index
Expand Down
2 changes: 1 addition & 1 deletion Sources/Prototypes/PEG/PEGCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

import _StringProcessing
@testable import _StringProcessing
let emitComments = true

struct PEGCore<
Expand Down
3 changes: 1 addition & 2 deletions Sources/Prototypes/PEG/PEGTranspile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
//
//===----------------------------------------------------------------------===//

import _MatchingEngine
import _StringProcessing
@testable import _StringProcessing

extension PEG.VM where Input == String {
typealias MEProg = MEProgram<String>
Expand Down
3 changes: 2 additions & 1 deletion Sources/Prototypes/PEG/PEGVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
//
//===----------------------------------------------------------------------===//

import _StringProcessing

@testable import _StringProcessing

extension PEG {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Prototypes/PEG/Printing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

import _StringProcessing
@testable import _StringProcessing

extension PEGCore.Instruction: InstructionProtocol {
var operandPC: InstructionAddress? { self.pc }
Expand Down
7 changes: 7 additions & 0 deletions Sources/VariadicsGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

add_executable(VariadicsGenerator
VariadicsGenerator.swift)
target_compile_options(VariadicsGenerator PRIVATE
-parse-as-library)
target_link_libraries(VariadicsGenerator PUBLIC
ArgumentParser)
46 changes: 46 additions & 0 deletions Sources/_MatchingEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

add_library(_MatchingEngine
Engine/Backtracking.swift
Engine/Builder.swift
Engine/Capture.swift
Engine/Consume.swift
Engine/Engine.swift
Engine/InstPayload.swift
Engine/Instruction.swift
Engine/Processor.swift
Engine/Program.swift
Engine/Registers.swift
Engine/Tracing.swift
Regex/AST/AST.swift
Regex/AST/ASTAction.swift
Regex/AST/ASTProtocols.swift
Regex/AST/Atom.swift
Regex/AST/Conditional.swift
Regex/AST/CustomCharClass.swift
Regex/AST/Group.swift
Regex/AST/MatchingOptions.swift
Regex/AST/Quantification.swift
Regex/Parse/CaptureStructure.swift
Regex/Parse/CharacterPropertyClassification.swift
Regex/Parse/Diagnostics.swift
Regex/Parse/LexicalAnalysis.swift
Regex/Parse/Mocking.swift
Regex/Parse/Parse.swift
Regex/Parse/Source.swift
Regex/Parse/SourceLocation.swift
Regex/Parse/SyntaxOptions.swift
Regex/Printing/DumpAST.swift
Regex/Printing/PrettyPrinter.swift
Regex/Printing/PrintAsCanonical.swift
Regex/Printing/PrintAsPattern.swift
Regex/Printing/RenderRanges.swift
Utility/AllScalars.swift
Utility/Formatting.swift
Utility/Misc.swift
Utility/MissingUnicode.swift
Utility/Protocols.swift
Utility/TypeConstruction.swift
Utility/TypedIndex.swift
Utility/TypedInt.swift)
target_compile_options(_MatchingEngine PRIVATE
-enable-library-evolution)
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ extension Source {
return .generalCategory(cat)
}
if let script = classifyScriptProperty(value) {
return .script(script)
return .scriptExtension(script)
}
if let posix = classifyPOSIX(value) {
return .posix(posix)
Expand Down
Loading