Commit e2235235 authored by Johannes Schriewer's avatar Johannes Schriewer

Remove last traces of foundation

parent 82283da7
Pipeline #1657 failed with stage
Subproject commit 879753c21c6405c7b49623710703c64799706a67
Subproject commit a88c1b643ab403380d768d9c466092df6bd52039
......@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
import atfoundation
public enum TokenType {
case Identifier
......@@ -52,27 +52,25 @@ public struct Token: Equatable {
}
}
func isCharacterPartOfSet(c: Character?, set: NSCharacterSet) -> Bool {
guard let c = c else { return false }
var isMember = true
for utf16Component in String(c).utf16 {
if !set.characterIsMember(utf16Component) { isMember = false; break }
}
return isMember
}
func isValidIdentifierSignalCharacter(c: Character?) -> Bool {
return isCharacterPartOfSet(c: c, set: NSCharacterSet.letters())
guard let c = c else {
return false
}
return Charset.isLetter(character: c)
}
func isValidIdenitifierCharacter(c: Character?) -> Bool {
return isCharacterPartOfSet(c: c, set: NSCharacterSet.letters()) || c == "-" || c == "." || c == "/"
guard let c = c else {
return false
}
return Charset.isLetter(character: c) || c == "-" || c == "." || c == "/"
}
func isWhitespace(c: Character?) -> Bool {
return isCharacterPartOfSet(c: c, set: NSCharacterSet.whitespaces())
guard let c = c else {
return false
}
return Charset.isWhitespace(character: c)
}
final public class Lexer {
......
// Copyright (c) 2016 Anarchy Tools Contributors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
//SR-138
extension String {
var toNSString: NSString {
#if os(Linux)
return self.bridge()
#elseif os(OSX)
return (self as NSString)
#endif
}
}
extension NSString {
var toString: String {
#if os(Linux)
return self.bridge()
#elseif os(OSX)
return (self as String)
#endif
}
}
//these parts of the Swift 3 API changes are not yet implemented on Linux
#if os(Linux)
extension String {
public func replacingOccurrences(of target: String, with replacement: String, options: NSStringCompareOptions = [], range searchRange: Range<Index>? = nil) -> String {
return self.stringByReplacingOccurrencesOfString(target, withString: replacement, options: options, range: searchRange)
}
}
#endif
\ No newline at end of file
......@@ -13,7 +13,7 @@
// limitations under the License.
// NOTE: This is the crappiest test thing ever... but it works for now.
import Foundation
import atfoundation
extension String : ErrorProtocol {}
......
......@@ -13,7 +13,7 @@
// limitations under the License.
import Foundation
import atfoundation
import atpkg
func outputBaseline(lexer: Lexer) {
......
......@@ -13,7 +13,7 @@
// limitations under the License.
import Foundation
import atfoundation
import atpkg
func outputBaseline(scanner: Scanner) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment