Skip to content
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

Specify versions for mint dependencies #51

Merged
merged 2 commits into from Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Mintfile
@@ -1,2 +1,2 @@
realm/SwiftLint
nicklockwood/SwiftFormat
realm/SwiftLint@0.52.4
nicklockwood/SwiftFormat@0.52.3
20 changes: 10 additions & 10 deletions Sources/ScreamURITemplate/Internal/CharacterSets.swift
Expand Up @@ -14,15 +14,15 @@

import Foundation

internal let unreservedCharacterSet = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "-._~"))
let unreservedCharacterSet = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "-._~"))
private let genDelimsCharacterSet = CharacterSet(charactersIn: ":/?#[]@")
private let subDelimsCharacterSet = CharacterSet(charactersIn: "!$&'()*+,;=")
internal let reservedCharacterSet = genDelimsCharacterSet.union(subDelimsCharacterSet)
internal let reservedAndUnreservedCharacterSet = reservedCharacterSet.union(unreservedCharacterSet)
internal let invertedLiteralCharacterSet = CharacterSet.illegalCharacters.union(CharacterSet.controlCharacters).union(CharacterSet(charactersIn: " \"%<>\\^`{|}"))
internal let literalCharacterSet = invertedLiteralCharacterSet.inverted
internal let hexCharacterSet = CharacterSet(charactersIn: "0123456789abcdefABCDEF")
internal let varnameCharacterSet = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "_%."))
internal let invertedVarnameCharacterSet = varnameCharacterSet.inverted
internal let expressionOperatorCharacterSet = CharacterSet(charactersIn: "+#./;?&=,!@|")
internal let invertedDecimalDigitsCharacterSet = CharacterSet.decimalDigits.inverted
let reservedCharacterSet = genDelimsCharacterSet.union(subDelimsCharacterSet)
let reservedAndUnreservedCharacterSet = reservedCharacterSet.union(unreservedCharacterSet)
let invertedLiteralCharacterSet = CharacterSet.illegalCharacters.union(CharacterSet.controlCharacters).union(CharacterSet(charactersIn: " \"%<>\\^`{|}"))
let literalCharacterSet = invertedLiteralCharacterSet.inverted
let hexCharacterSet = CharacterSet(charactersIn: "0123456789abcdefABCDEF")
let varnameCharacterSet = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "_%."))
let invertedVarnameCharacterSet = varnameCharacterSet.inverted
let expressionOperatorCharacterSet = CharacterSet(charactersIn: "+#./;?&=,!@|")
let invertedDecimalDigitsCharacterSet = CharacterSet.decimalDigits.inverted
12 changes: 6 additions & 6 deletions Sources/ScreamURITemplate/Internal/Components.swift
Expand Up @@ -15,12 +15,12 @@
import Foundation

#if swift(>=5.5)
internal typealias ComponentBase = Sendable
typealias ComponentBase = Sendable
#else
internal protocol ComponentBase {}
protocol ComponentBase {}
#endif

internal protocol Component: ComponentBase {
protocol Component: ComponentBase {
func expand(variables: [String: VariableValue]) throws -> String
var variableNames: [String] { get }
}
Expand All @@ -31,7 +31,7 @@ extension Component {
}
}

internal struct LiteralComponent: Component {
struct LiteralComponent: Component {
let literal: Substring
init(_ string: Substring) {
literal = string
Expand All @@ -46,7 +46,7 @@ internal struct LiteralComponent: Component {
}
}

internal struct LiteralPercentEncodedTripletComponent: Component {
struct LiteralPercentEncodedTripletComponent: Component {
let literal: Substring
init(_ string: Substring) {
literal = string
Expand All @@ -57,7 +57,7 @@ internal struct LiteralPercentEncodedTripletComponent: Component {
}
}

internal struct ExpressionComponent: Component {
struct ExpressionComponent: Component {
let expressionOperator: ExpressionOperator
let variableList: [VariableSpec]
let templatePosition: String.Index
Expand Down
Expand Up @@ -14,7 +14,7 @@

import Foundation

internal struct ExpansionConfiguration {
struct ExpansionConfiguration {
let percentEncodingAllowedCharacterSet: CharacterSet
let allowPercentEncodedTriplets: Bool
let prefix: String?
Expand Down
Expand Up @@ -14,7 +14,7 @@

import Foundation

internal enum ExpressionOperator: Unicode.Scalar {
enum ExpressionOperator: Unicode.Scalar {
case simple = "\0"
case reserved = "+"
case fragment = "#"
Expand Down
2 changes: 1 addition & 1 deletion Sources/ScreamURITemplate/Internal/Scanner.swift
Expand Up @@ -18,7 +18,7 @@ private func ~= (lhs: CharacterSet, rhs: Unicode.Scalar) -> Bool {
return lhs.contains(rhs)
}

internal struct Scanner {
struct Scanner {
let string: String
let unicodeScalars: String.UnicodeScalarView
var currentIndex: String.Index
Expand Down
10 changes: 5 additions & 5 deletions Sources/ScreamURITemplate/Internal/ValueFormatting.swift
Expand Up @@ -14,11 +14,11 @@

import Foundation

internal enum FormatError: Error {
enum FormatError: Error {
case failure(reason: String)
}

internal func percentEncode(string: String, withAllowedCharacters allowedCharacterSet: CharacterSet, allowPercentEncodedTriplets: Bool) throws -> String {
func percentEncode(string: String, withAllowedCharacters allowedCharacterSet: CharacterSet, allowPercentEncodedTriplets: Bool) throws -> String {
guard var encoded = string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) else {
throw FormatError.failure(reason: "Percent Encoding Failed")
}
Expand All @@ -45,7 +45,7 @@ internal func percentEncode(string: String, withAllowedCharacters allowedCharact
return encoded
}

internal extension StringProtocol {
extension StringProtocol {
func formatForTemplateExpansion(variableSpec: VariableSpec, expansionConfiguration: ExpansionConfiguration) throws -> String {
let modifiedValue: String
if let prefixLength = variableSpec.prefixLength() {
Expand All @@ -64,7 +64,7 @@ internal extension StringProtocol {
}
}

internal extension Array where Element: StringProtocol {
extension Array where Element: StringProtocol {
func formatForTemplateExpansion(variableSpec: VariableSpec, expansionConfiguration: ExpansionConfiguration) throws -> String? {
let separator = ","
let encodedExpansions = try map { element -> String in
Expand Down Expand Up @@ -102,7 +102,7 @@ internal extension Array where Element: StringProtocol {
}
}

internal extension Dictionary where Key: StringProtocol, Value: StringProtocol {
extension Dictionary where Key: StringProtocol, Value: StringProtocol {
func formatForTemplateExpansion(variableSpec: VariableSpec, expansionConfiguration: ExpansionConfiguration) throws -> String? {
let encodedExpansions = try map { key, value -> String in
let encodedKey = try percentEncode(string: String(key), withAllowedCharacters: expansionConfiguration.percentEncodingAllowedCharacterSet, allowPercentEncodedTriplets: expansionConfiguration.allowPercentEncodedTriplets)
Expand Down
2 changes: 1 addition & 1 deletion Sources/ScreamURITemplate/Internal/VariableSpec.swift
Expand Up @@ -14,7 +14,7 @@

import Foundation

internal struct VariableSpec {
struct VariableSpec {
enum Modifier {
case prefix(length: Int)
case explode
Expand Down