diff --git a/Modules/Parser/Sources/SAX/HTMLEntityDecoder.swift b/Modules/Parser/Sources/SAX/HTMLEntityDecoder.swift
index 5f37fe593..4dd12242b 100644
--- a/Modules/Parser/Sources/SAX/HTMLEntityDecoder.swift
+++ b/Modules/Parser/Sources/SAX/HTMLEntityDecoder.swift
@@ -18,8 +18,8 @@ public final class HTMLEntityDecoder {
while true {
- var scannedString = nil
- if scanner.scanUpToString("&" intoString: &scannedString) {
+ var scannedString: NSString? = nil
+ if scanner.scanUpTo("&", into: &scannedString) {
result.append(scannedString)
}
if scanner.isAtEnd {
@@ -37,7 +37,7 @@ public final class HTMLEntityDecoder {
result.append("&")
scanner.scanLocation = savedScanLocation + 1
}
-
+
if scanner.isAtEnd {
break
}
@@ -49,3 +49,43 @@ public final class HTMLEntityDecoder {
return result
}
}
+
+/// Purpose-built version of NSScanner, which has deprecated the parts we want to use.
+final class RSScanner {
+
+ let string: String
+ let count: Int
+ var scanLocation = 0
+
+ var isAtEnd {
+ scanLocation >= count - 1
+ }
+
+ init(string: String) {
+ self.string = string
+ self.count = string.count
+ }
+
+ /// Scans up to `characterToFind` and returns the characters up to (and not including) `characterToFind`.
+ /// - Returns: nil when there were no characters accumulated (next character was `characterToFind` or already at end of string)
+ func scanUpTo(_ characterToFind: Character) -> String? {
+
+ if isAtEnd {
+ return nil
+ }
+
+ while true {
+
+
+ }
+ }
+
+ private func currentCharacter() -> Character? {
+
+
+
+ }
+
+ private func
+
+}