This commit is contained in:
Florian Schroedl
2022-08-26 16:45:07 +02:00
parent e6fff0165e
commit 1a4f665639

View File

@@ -135,7 +135,8 @@ proc ignore*(parserFn: parserFnT): parserFnT {.inline.} =
))
proc manyUntil*(acceptFn: parserFnT, stopFn: parserFnT): parserFnT {.inline.} =
## Parse characters but throw success tokens away
## Creates parser function with a nested `acceptFn` parser function until the `stopFn` parserFunction is met:
## Parses until the `stopFn` is reached or on an errror.
return proc(parser: Parser): ParserResult =
var res: ParserResult = parser.ok()
while res.isOk() and res.flatMap(stopFn).isErr():