performance fix
This commit is contained in:
parent
3e52bb3023
commit
8b37965bbf
|
@ -12,6 +12,7 @@ import Foundation
|
||||||
CharacterReader consumes tokens off a string. To replace the old TokenQueue.
|
CharacterReader consumes tokens off a string. To replace the old TokenQueue.
|
||||||
*/
|
*/
|
||||||
public final class CharacterReader {
|
public final class CharacterReader {
|
||||||
|
private let empty = ""
|
||||||
public static let EOF: UnicodeScalar = "\u{FFFF}"//65535
|
public static let EOF: UnicodeScalar = "\u{FFFF}"//65535
|
||||||
private static let maxCacheLen: Int = 12
|
private static let maxCacheLen: Int = 12
|
||||||
private let input: [UnicodeScalar]
|
private let input: [UnicodeScalar]
|
||||||
|
@ -214,7 +215,7 @@ public final class CharacterReader {
|
||||||
}
|
}
|
||||||
pos += 1
|
pos += 1
|
||||||
}
|
}
|
||||||
return pos > start ? cacheString(start, pos-start) : ""
|
return pos > start ? cacheString(start, pos-start) : empty
|
||||||
}
|
}
|
||||||
|
|
||||||
public func consumeToEnd() -> String {
|
public func consumeToEnd() -> String {
|
||||||
|
|
Loading…
Reference in New Issue