Tekkon // Remove redundant data from documentation.

This commit is contained in:
ShikiSuen 2022-05-20 17:40:12 +08:00
parent 6ef9e59c7f
commit e77d67370b
1 changed files with 33 additions and 27 deletions

View File

@ -96,7 +96,7 @@ public struct Tekkon {
] ]
/// ///
public static let allowedsemivowels = ["", "", ""] public static let allowedSemivowels = ["", "", ""]
/// ///
public static let allowedVowels = [ public static let allowedVowels = [
@ -109,7 +109,7 @@ public struct Tekkon {
/// 調 /// 調
public static var allowedPhonabets: [String] { public static var allowedPhonabets: [String] {
allowedConsonants + allowedsemivowels + allowedVowels + allowedIntonations allowedConsonants + allowedSemivowels + allowedVowels + allowedIntonations
} }
// MARK: - Phonabet Structure // MARK: - Phonabet Structure
@ -132,18 +132,7 @@ public struct Tekkon {
if !input.isEmpty { if !input.isEmpty {
if allowedPhonabets.contains(String(input.reversed()[0])) { if allowedPhonabets.contains(String(input.reversed()[0])) {
valueStorage = String(input.reversed()[0]) valueStorage = String(input.reversed()[0])
if Tekkon.allowedConsonants.contains(value) { ensureType()
type = .consonant
} else if Tekkon.allowedsemivowels.contains(value) {
type = .semivowel
} else if Tekkon.allowedVowels.contains(value) {
type = .vowel
} else if Tekkon.allowedIntonations.contains(value) {
type = .intonation
} else {
type = .null
valueStorage = ""
}
} }
} }
} }
@ -159,6 +148,23 @@ public struct Tekkon {
/// - strWith: /// - strWith:
mutating func selfReplace(_ strOf: String, _ strWith: String = "") { mutating func selfReplace(_ strOf: String, _ strWith: String = "") {
valueStorage = valueStorage.replacingOccurrences(of: strOf, with: strWith) valueStorage = valueStorage.replacingOccurrences(of: strOf, with: strWith)
ensureType()
}
///
mutating func ensureType() {
if Tekkon.allowedConsonants.contains(value) {
type = .consonant
} else if Tekkon.allowedSemivowels.contains(value) {
type = .semivowel
} else if Tekkon.allowedVowels.contains(value) {
type = .vowel
} else if Tekkon.allowedIntonations.contains(value) {
type = .intonation
} else {
type = .null
valueStorage = ""
}
} }
// MARK: - Misc Definitions // MARK: - Misc Definitions
@ -192,7 +198,7 @@ public struct Tekkon {
/// Syllable Composer /// Syllable Composer
/// 使 Struct /// 使 Struct
/// 調 /// 調
/// @--DISCUSSION--@ ///
/// String Literal @input /// String Literal @input
/// @arrange .ofDachen /// @arrange .ofDachen
@frozen public struct Composer: Equatable, Hashable, ExpressibleByStringLiteral { @frozen public struct Composer: Equatable, Hashable, ExpressibleByStringLiteral {
@ -303,7 +309,7 @@ public struct Tekkon {
// MARK: - Public Functions // MARK: - Public Functions
/// ///
/// @--DISCUSSION--@ ///
/// parser /// parser
/// - Parameters: /// - Parameters:
/// - key: UniChar /// - key: UniChar
@ -338,7 +344,7 @@ public struct Tekkon {
/// String /// String
/// UniChar /// UniChar
/// @--DISCUSSION--@ ///
/// 調 /// 調
/// - Parameters: /// - Parameters:
/// - fromString: String /// - fromString: String
@ -364,7 +370,7 @@ public struct Tekkon {
/// UniChar /// UniChar
/// UniChar String /// UniChar String
/// @--DISCUSSION--@ ///
/// 調 /// 調
/// - Parameters: /// - Parameters:
/// - fromCharCode: UniChar /// - fromCharCode: UniChar
@ -446,7 +452,7 @@ public struct Tekkon {
/// 使 BackSpace /// 使 BackSpace
/// 調 /// 調
/// @--DISCUSSION--@ ///
/// ///
public mutating func doBackSpace() { public mutating func doBackSpace() {
if [.ofHanyuPinyin, .ofSecondaryPinyin, .ofYalePinyin, .ofHualuoPinyin, .ofUniversalPinyin].contains(parser), if [.ofHanyuPinyin, .ofSecondaryPinyin, .ofYalePinyin, .ofHualuoPinyin, .ofUniversalPinyin].contains(parser),
@ -490,7 +496,7 @@ public struct Tekkon {
// //
/// String /// String
/// @--DISCUSSION--@ ///
/// ///
/// - Parameters: /// - Parameters:
/// - key: String /// - key: String
@ -521,7 +527,7 @@ public struct Tekkon {
} }
/// ///
/// @--DISCUSSION--@ ///
/// ///
/// - Parameters: /// - Parameters:
/// - key: String /// - key: String
@ -605,7 +611,7 @@ public struct Tekkon {
} }
/// ///
/// @--DISCUSSION--@ ///
/// ///
/// - Parameters: /// - Parameters:
/// - key: String /// - key: String
@ -726,7 +732,7 @@ public struct Tekkon {
} }
/// ///
/// @--DISCUSSION--@ ///
/// ///
/// - Parameters: /// - Parameters:
/// - key: String /// - key: String
@ -1237,7 +1243,7 @@ public struct Tekkon {
// MARK: - Maps for Keyboard-to-Phonabet parsers // MARK: - Maps for Keyboard-to-Phonabet parsers
/// ///
/// @--DISCUSSION--@ ///
/// macOS 使 Ukelele /// macOS 使 Ukelele
/// 使 /// 使
static let mapQwertyDachen: [String: String] = [ static let mapQwertyDachen: [String: String] = [
@ -1248,7 +1254,7 @@ public struct Tekkon {
] ]
/// ///
/// @--DISCUSSION--@ ///
/// 便 validity check /// 便 validity check
/// ///
static let mapDachenCP26StaticKeys: [String: String] = [ static let mapDachenCP26StaticKeys: [String: String] = [
@ -1258,7 +1264,7 @@ public struct Tekkon {
] ]
/// ///
/// @--DISCUSSION--@ ///
/// 便 validity check /// 便 validity check
/// ///
static let mapHsuStaticKeys: [String: String] = [ static let mapHsuStaticKeys: [String: String] = [
@ -1268,7 +1274,7 @@ public struct Tekkon {
] ]
/// ///
/// @--DISCUSSION--@ ///
/// 便 validity check /// 便 validity check
/// //// /// ////
static let mapEten26StaticKeys: [String: String] = [ static let mapEten26StaticKeys: [String: String] = [