replaced Token with Lexeme protocol on TemplateSyntaxError

This commit is contained in:
Ilya Puchka
2017-10-07 20:54:42 +02:00
parent 6300dbc7bf
commit 69cd8e4d3b
6 changed files with 52 additions and 69 deletions

View File

@@ -17,3 +17,29 @@ public class TemplateDoesNotExist: Error, CustomStringConvertible {
return "Template named `\(templates)` does not exist. No loaders found"
}
}
public struct TemplateSyntaxError : Error, Equatable, CustomStringConvertible {
public let description:String
var lexeme: Lexeme?
public init(_ description:String) {
self.description = description
}
public static func ==(lhs:TemplateSyntaxError, rhs:TemplateSyntaxError) -> Bool {
return lhs.description == rhs.description
}
}
extension Range where Bound == String.Index {
internal static var unknown: Range {
return "".range
}
}
extension String {
var range: Range<String.Index> {
return startIndex..<endIndex
}
}