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