Add support for proper lambdas (#48)

* Add support for proper lambdas

* Get rid of recursion

Remove renderSectionLambda as I can use renderUnescapedLambda for that.
This commit is contained in:
Adam Fowler
2024-09-19 17:17:50 +01:00
committed by GitHub
parent 8fba85e28c
commit 933fa3d60f
9 changed files with 249 additions and 44 deletions

View File

@@ -100,6 +100,15 @@ extension Parser {
return subString
}
/// Read until we hit string index
/// - Parameter until: Read until position
/// - Returns: The string read from the buffer
mutating func read(until: String.Index) -> Substring {
let string = self.buffer[self.position..<until]
self.position = until
return string
}
/// Read from buffer until we hit a character. Position after this is of the character we were checking for
/// - Parameter until: Character to read until
/// - Throws: .overflow if we hit the end of the buffer before reading character