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

@@ -17,8 +17,8 @@ extension HBMustacheLibrary {
let template: HBMustacheTemplate
do {
template = try HBMustacheTemplate(string: string)
} catch {
throw Error.failedToLoad(path, error)
} catch let error as HBMustacheTemplate.ParserError {
throw ParserError(filename: path, context: error.context, error: error.error)
}
// drop ".mustache" from path to get name
let name = String(path.dropLast(extWithDot.count))