Skip to content

For Reference: Update swift/release/6.0 with main #742

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 15 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ let package = Package(
.executable(
name: "VariadicsGenerator",
targets: ["VariadicsGenerator"]),
.executable(
name: "RegexBenchmark",
targets: ["RegexBenchmark"])
// Disable to work around rdar://126877024
// .executable(
// name: "RegexBenchmark",
// targets: ["RegexBenchmark"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
Expand Down Expand Up @@ -142,17 +143,17 @@ let package = Package(
"_StringProcessing"
],
swiftSettings: [availabilityDefinition]),
.executableTarget(
name: "RegexBenchmark",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"_RegexParser",
"_StringProcessing",
"RegexBuilder"
],
swiftSettings: [
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"]),
]),
// .executableTarget(
// name: "RegexBenchmark",
// dependencies: [
// .product(name: "ArgumentParser", package: "swift-argument-parser"),
// "_RegexParser",
// "_StringProcessing",
// "RegexBuilder"
// ],
// swiftSettings: [
// .unsafeFlags(["-Xfrontend", "-disable-availability-checking"]),
// ]),

// MARK: Exercises
.target(
Expand Down
21 changes: 21 additions & 0 deletions Sources/_RegexParser/Regex/Printing/PrettyPrinter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public struct PrettyPrinter {

// The current default quantification behavior
public var quantificationBehavior: AST.Quantification.Kind = .eager

// A stack of the current added inline matching options, e.g. (?s) and a
// boolean indicating true = added (?s) and false = removed (?-s).
public var inlineMatchingOptions: [([AST.MatchingOption], Bool)] = []
}

// MARK: - Raw interface
Expand Down Expand Up @@ -142,4 +146,21 @@ extension PrettyPrinter {
printIndented(f)
print(endDelimiter)
}

/// Pushes the list of matching options to the current stack of other matching
/// options and increases the indentation level by 1.
public mutating func pushMatchingOptions(
_ options: [AST.MatchingOption],
isAdded: Bool
) {
indentLevel += 1
inlineMatchingOptions.append((options, isAdded))
}

/// Pops the most recent list of matching options from the printer and
/// decreases the indentation level by 1.
public mutating func popMatchingOptions() -> ([AST.MatchingOption], Bool) {
indentLevel -= 1
return inlineMatchingOptions.removeLast()
}
}
Loading