Break string for loop when the parser is erroring

This commit is contained in:
Florian Schroedl
2022-08-26 16:49:57 +02:00
parent 9cdcef6d71
commit fd0382f3a0

View File

@@ -108,6 +108,7 @@ proc str*(expectedString: string): parserFnT {.inline.} =
return proc(parser: Parser): ParserResult =
var res: ParserResult = parser.ok()
for c in expectedString.items:
if res.isErr: break
res = res.flatMap(ch(c))
return res