Replace raw UTF8 parser with String parser (#6)

* Replace UTF8 parser with String based one

* swift format

* Add parsing errors that include context about where error is

* Remove old error tests
This commit is contained in:
Adam Fowler
2021-03-18 17:26:42 +00:00
committed by GitHub
parent a602593b5d
commit 05740bd7bc
8 changed files with 421 additions and 622 deletions

View File

@@ -47,8 +47,14 @@ public final class HBMustacheLibrary {
return template.render(object)
}
public enum Error: Swift.Error {
case failedToLoad(String, Swift.Error)
/// Error returned by init() when parser fails
public struct ParserError: Swift.Error {
/// File error occurred in
public let filename: String
/// Context (line, linenumber and column number)
public let context: HBParser.Context
/// Actual error that occurred
public let error: Error
}
private var templates: [String: HBMustacheTemplate]