-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Anchor coding, Tag coding and redundancy auto-aliasing
- Loading branch information
Adora Lynch
committed
Sep 20, 2024
1 parent
53d8b3b
commit aa983d8
Showing
22 changed files
with
1,541 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Anchor.swift | ||
// Yams | ||
// | ||
// Created by Adora Lynch on 8/9/24. | ||
// Copyright (c) 2024 Yams. All rights reserved. | ||
|
||
import Foundation | ||
|
||
public final class Anchor: RawRepresentable, ExpressibleByStringLiteral, Codable, Hashable { | ||
|
||
public static let permittedCharacters = CharacterSet.lowercaseLetters | ||
.union(.uppercaseLetters) | ||
.union(.decimalDigits) | ||
.union(.init(charactersIn: "-_")) | ||
|
||
public static func is_cyamlAlpha(_ string: String) -> Bool { | ||
Anchor.permittedCharacters.isSuperset(of: .init(charactersIn: string)) | ||
} | ||
|
||
|
||
public let rawValue: String | ||
|
||
public init(rawValue: String) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
public init(stringLiteral value: String) { | ||
rawValue = value | ||
} | ||
} | ||
|
||
extension Anchor: CustomStringConvertible { | ||
public var description: String { rawValue } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.