-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 61d6928.
- Loading branch information
Showing
103 changed files
with
5,768 additions
and
11,912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// MARK: Subject to change prior to 1.0.0 release | ||
// MARK: - | ||
|
||
extension LeafRenderer { | ||
/// Deprecated in Leaf-Kit 1.0.0rc-1.2 | ||
@available(*, deprecated, message: "Use files instead of fileio") | ||
public var fileio: NonBlockingFileIO { | ||
guard let source = self.sources.sources["default"], | ||
let nio = source as? NIOLeafFiles else { | ||
fatalError("Unexpected non-NIO LeafFiles.") | ||
} | ||
return nio.fileio | ||
} | ||
|
||
/// Deprecated in Leaf-Kit 1.0.0rc-1.2 | ||
@available(*, deprecated, message: "Use files instead of fileio") | ||
public convenience init( | ||
configuration: LeafConfiguration, | ||
cache: LeafCache = DefaultLeafCache(), | ||
fileio: NonBlockingFileIO, | ||
eventLoop: EventLoop | ||
) { | ||
let sources = LeafSources() | ||
try! sources.register(using: NIOLeafFiles(fileio: fileio)) | ||
|
||
self.init( | ||
configuration: configuration, | ||
cache: cache, | ||
sources: sources, | ||
eventLoop: eventLoop | ||
) | ||
} | ||
} | ||
|
||
extension LeafSource { | ||
/// Default implementation for non-adhering protocol implementations mimicing older LeafRenderer expansion | ||
/// This wrapper will be removed in a future release. | ||
@available(*, deprecated, message: "Update to adhere to `file(template, escape, eventLoop)`") | ||
func file(template: String, escape: Bool, on eventLoop: EventLoop) throws -> EventLoopFuture<ByteBuffer> { | ||
var path = template | ||
if path.split(separator: "/").last?.split(separator: ".").count ?? 1 < 2, | ||
!path.hasSuffix(".leaf") { path += ".leaf" } | ||
if !path.hasPrefix("/") { path = "/" + path } | ||
return try self.file(path: path, on: eventLoop) | ||
} | ||
|
||
/// Deprecated in Leaf-Kit 1.0.0rc-1.11 | ||
/// Default implementation for newer adherants to allow older adherents to be called until upgraded | ||
@available(*, deprecated, message: "This default implementation should never be called") | ||
public func file(path: String, on eventLoop: EventLoop) throws -> EventLoopFuture<ByteBuffer> { | ||
fatalError("This default implementation should never be called") | ||
} | ||
} | ||
|
||
/// Deprecated in Leaf-Kit 1.0.0rc-1.11 | ||
@available(*, deprecated, renamed: "LeafSource") | ||
typealias LeafFiles = LeafSource |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// MARK: Subject to change prior to 1.0.0 release | ||
// MARK: - | ||
|
||
@_exported import NIO | ||
|
||
/// Various helper identities for convenience | ||
extension Character { | ||
// MARK: - Leaf-Kit specific static identities (Public) | ||
|
||
/// Global setting of `tagIndicator` for Leaf-Kit - by default, `#` | ||
public internal(set) static var tagIndicator: Character = .octothorpe | ||
|
||
// MARK: - LeafToken specific identities (Internal) | ||
|
||
var isValidInTagName: Bool { | ||
return self.isLowercaseLetter | ||
|| self.isUppercaseLetter | ||
} | ||
|
||
var isValidInParameter: Bool { | ||
return self.isValidInTagName | ||
|| self.isValidOperator | ||
|| self.isValidInNumeric | ||
} | ||
|
||
var canStartNumeric: Bool { | ||
return (.zero ... .nine) ~= self | ||
} | ||
|
||
var isValidInNumeric: Bool { | ||
return self.canStartNumeric | ||
|| self == .underscore | ||
|| self == .binaryNotation | ||
|| self == .octalNotation | ||
|| self == .hexNotation | ||
|| self.isHexadecimal | ||
|| self == .period | ||
} | ||
|
||
var isValidOperator: Bool { | ||
switch self { | ||
case .plus, | ||
.minus, | ||
.star, | ||
.forwardSlash, | ||
.equals, | ||
.exclamation, | ||
.lessThan, | ||
.greaterThan, | ||
.ampersand, | ||
.vertical: return true | ||
default: return false | ||
} | ||
} | ||
|
||
// MARK: - General group-membership identities (Internal) | ||
|
||
var isHexadecimal: Bool { | ||
return (.zero ... .nine).contains(self) | ||
|| (.A ... .F).contains(self.uppercased().first!) | ||
|| self == .hexNotation | ||
} | ||
|
||
var isOctal: Bool { | ||
return (.zero ... .seven).contains(self) | ||
|| self == .octalNotation | ||
} | ||
|
||
var isBinary: Bool { | ||
return (.zero ... .one).contains(self) | ||
|| self == .binaryNotation | ||
} | ||
|
||
var isUppercaseLetter: Bool { | ||
return (.A ... .Z).contains(self) | ||
} | ||
|
||
var isLowercaseLetter: Bool { | ||
return (.a ... .z).contains(self) | ||
} | ||
|
||
// MARK: - General static identities (Internal) | ||
|
||
static let newLine = "\n".first! | ||
static let quote = "\"".first! | ||
static let octothorpe = "#".first! | ||
static let leftParenthesis = "(".first! | ||
static let backSlash = "\\".first! | ||
static let rightParenthesis = ")".first! | ||
static let comma = ",".first! | ||
static let space = " ".first! | ||
static let colon = ":".first! | ||
static let period = ".".first! | ||
static let A = "A".first! | ||
static let F = "F".first! | ||
static let Z = "Z".first! | ||
static let a = "a".first! | ||
static let z = "z".first! | ||
|
||
static let zero = "0".first! | ||
static let one = "1".first! | ||
static let seven = "7".first! | ||
static let nine = "9".first! | ||
static let binaryNotation = "b".first! | ||
static let octalNotation = "o".first! | ||
static let hexNotation = "x".first! | ||
|
||
static let plus = "+".first! | ||
static let minus = "-".first! | ||
static let star = "*".first! | ||
static let forwardSlash = "/".first! | ||
static let equals = "=".first! | ||
static let exclamation = "!".first! | ||
static let lessThan = "<".first! | ||
static let greaterThan = ">".first! | ||
static let ampersand = "&".first! | ||
static let vertical = "|".first! | ||
static let underscore = "_".first! | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.