performance fix

This commit is contained in:
Nabil Chatbi 2017-03-26 21:18:00 +02:00
parent 3e52bb3023
commit 8b37965bbf
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import Foundation
CharacterReader consumes tokens off a string. To replace the old TokenQueue.
*/
public final class CharacterReader {
private let empty = ""
public static let EOF: UnicodeScalar = "\u{FFFF}"//65535
private static let maxCacheLen: Int = 12
private let input: [UnicodeScalar]
@ -214,7 +215,7 @@ public final class CharacterReader {
}
pos += 1
}
return pos > start ? cacheString(start, pos-start) : ""
return pos > start ? cacheString(start, pos-start) : empty
}
public func consumeToEnd() -> String {