-
Notifications
You must be signed in to change notification settings - Fork 50
[DO NOT MERGE] main -> 5.7 diffs #362
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
Conversation
A quick pass to flip `/.../` out of the alternatives and into the main syntax. Still needs a bunch of work. Also add some commentary on a regex with `]` as the starting character.
…n. Split out Proposed solution from Detailed design. Parallelize the structure a bit better.
This isn't actually used, as we convert to a DSL custom character class, and then use that consumer logic.
Convert AST escape sequences that represent a scalar value (e.g `\f`, `n`, `\a`) into scalars in the DSL tree. This allows the matching engine to match against them.
The "motivation tests" still aren't working on macOS CI
* Number captures consistently * Proper indentation
Co-authored-by: Nate Cook <[email protected]>
@swift-ci please test |
@@ -76,7 +76,7 @@ let package = Package( | |||
.unsafeFlags(["-Xfrontend", "-enable-experimental-pairwise-build-block"]), | |||
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"]) | |||
]), | |||
.target( | |||
.testTarget( |
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.
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import _StringProcessing |
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.
case .endOfLine: fatalError("Not yet supported") | ||
case .wordBoundary: return .notWordBoundary | ||
} | ||
var baseAssertion: DSLTree._AST.AssertionKind { |
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.
@natecook1000 can you get this (f8e1dc2) and others cherry-picked onto 5.7?
"C\($0+1)\(opt)" | ||
}.joined(separator: ", ") | ||
} | ||
|
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.
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.
@@ -1,116 +0,0 @@ | |||
//===----------------------------------------------------------------------===// | |||
// | |||
// This source file is part of the Swift.org open source project |
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.
@Azoy can you make sure to get everything cherry-picked onto 5.7?
/// Returns `nil` otherwise. | ||
public func `as`<Output>(_ type: Output.Type) -> Regex<Output>? { | ||
fatalError("FIXME: Not implemented") | ||
} |
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.
@@ -133,10 +133,55 @@ func customTest<Match: Equatable>( | |||
} | |||
} | |||
|
|||
// Test support | |||
struct Concat : Equatable { |
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.
Optionally { | ||
Capture(as: value) { | ||
OneOrMore(.digit) | ||
} transform: { Int($0)! } |
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.
@natecook1000 can you get this (d0598b7) and others cherry-picked onto 5.7?
"a|a|||a|a|||a|a|||".split(separator: "|||", maxSplits: 2), | ||
["a|a", "a|a", "a|a|||"]) | ||
|
||
XCTAssertEqual( |
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.
@natecook1000 can you get this (d6a01e7) and others cherry-picked onto 5.7?
XCTFail() | ||
case try! Regex("abc"): | ||
XCTFail() | ||
|
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.
@rxwei can you make sure the ~=
overloads and tests get onto 5.7?
Confirmed (using the command below) that this branch now contains only changes to doc comments, changes to // comments where content was moved into or out of a doc comment, and one spelling correction to code. % git diff origin/main... | grep -v '^+ *///\|- *///' | grep -v '^@@' | grep -v '^ ' | grep -v '^+++\|^---' | grep -v '^diff --git' | grep -v '^index ' + // Individual public API functions are in the generated Variadics.swift file. +// For now, we use String as the source while prototyping... + + // NOTE: Currently, this means we have raw quotes. + // Better would be to have real Swift string delimiter parsing logic. + + // NOTE: traditional comments are not nested. Currently, we are neither. + // Traditional comments can't have `)`, not even escaped in them either, we + // can. Traditional comments can have `*/` in them, we can't without + // escaping. We don't currently do escaping. + - // Finish, flush, and clear. Returns the rendered output + // Finish, flush, and clear. + // + // - Returns: The rendered output. + // Note: The `Script` enum includes the "meta" script type "Katakana_Or_Hiragana", which + // isn't defined by https://www.unicode.org/Public/UCD/latest/ucd/Scripts.txt, + // but is defined by https://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt. + // We may want to split it out, as it's the only case that is a union of + // other script types. + +// TODO: These should become aliases for the Block (blk) Unicode character +// property. + - // Ensures `.0` always refers to the whole match. - // Allows `.0` when `Match` is not a tuple. - func withInversion(_ invertion: Bool) -> Self { + func withInversion(_ inversion: Bool) -> Self { - if invertion { + if inversion {
Revise doc comments for API reference style.
Add the SPI interface `swiftCompilerLexRegexLiteral` and `swiftCompilerParseRegexLiteral` for the Swift compiler to call into. This allows us to avoid depending on other library API on the compiler side, while letting it keep the bridging gunk. While we're here, add an extra `String` return for the parsing function that could allow us to change the regex emission format in the future. This still needs to be plumbed through on the complier side though.
Update PatternConverter
…wiftlang#367) Work around the compiler bug rdar://92459215 by using generic parameters instead of opaque result types for a couple of methods.
Introduce CaptureList, make CaptureStructure semi-vestigial
This is defined in UAX#44 as being equivalent to `Lu | Ll | Lt`.
This is a PCRE spelling for a cased letter.
* Add tests for AnyRegexOutput Fix a few missing areas of functionality while we're at it
This is not intended for merging, it's for showing what the remaining diffs and un-cherry-picked changes are between main and 5.7