Skip to content

Commit b8c30d6

Browse files
committed
Number cleanup: Attributes, Translator.
1 parent 71c3948 commit b8c30d6

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

Sources/DiffableTextKitXNumber/Reader/Attributes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ import DiffableTextKit
1414
//*============================================================================*
1515

1616
@usableFromInline struct Attributes {
17-
@usableFromInline typealias Map = [Character: Attribute]
1817

1918
//=------------------------------------------------------------------------=
2019
// MARK: State
2120
//=------------------------------------------------------------------------=
2221

23-
@usableFromInline private(set) var map = Map(minimumCapacity: 13)
22+
@usableFromInline private(set) var map = [Character: Attribute](minimumCapacity: 13)
2423

2524
//=------------------------------------------------------------------------=
2625
// MARK: Initializers

Sources/DiffableTextKitXNumber/Reader/Translator.swift

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,22 @@ import DiffableTextKit
1414
//*============================================================================*
1515

1616
@usableFromInline struct Translator {
17-
@usableFromInline typealias Map = [Character: Character]
1817

1918
//=------------------------------------------------------------------------=
2019
// MARK: State
2120
//=------------------------------------------------------------------------=
2221

23-
@usableFromInline private(set) var map = Map()
22+
@usableFromInline private(set) var map = [Character: Character]()
2423

2524
//=------------------------------------------------------------------------=
2625
// MARK: Initializers
2726
//=------------------------------------------------------------------------=
2827

2928
@inlinable init(_ local: Components) {
30-
self.insert(from: .ascii, to: local, all: \.digits, as: { $0 })
31-
self.insert(from: .ascii, to: local, all: \.separators, as: { _ in .fraction })
32-
self.insert(from: local, to: local, all: \.separators, as: { _ in .fraction })
33-
self.insert(from: .ascii, to: local, all: \.signs, as: { $0 })
29+
self.insert(\.digits, from: .ascii, to: local, as: { $0 })
30+
self.insert(\.separators, from: .ascii, to: local, as: { _ in .fraction })
31+
self.insert(\.separators, from: local, to: local, as: { _ in .fraction })
32+
self.insert(\.signs, from: .ascii, to: local, as: { $0 })
3433
}
3534

3635
//=------------------------------------------------------------------------=
@@ -58,9 +57,8 @@ import DiffableTextKit
5857
// MARK: Helpers
5958
//=------------------------------------------------------------------------=
6059

61-
@inlinable mutating func insert<T>(
62-
from source: Components, to destination: Components,
63-
all elements: (Components) -> Links<T>, as key: (T) -> T) {
60+
@inlinable mutating func insert<T>(_ elements: (Components) -> Links<T>,
61+
from source: Components, to destination: Components, as key: (T) -> T) {
6462
//=--------------------------------------=
6563
// Values
6664
//=--------------------------------------=

0 commit comments

Comments
 (0)