Break string for loop when the parser is erroring
This commit is contained in:
@@ -108,6 +108,7 @@ proc str*(expectedString: string): parserFnT {.inline.} =
|
|||||||
return proc(parser: Parser): ParserResult =
|
return proc(parser: Parser): ParserResult =
|
||||||
var res: ParserResult = parser.ok()
|
var res: ParserResult = parser.ok()
|
||||||
for c in expectedString.items:
|
for c in expectedString.items:
|
||||||
|
if res.isErr: break
|
||||||
res = res.flatMap(ch(c))
|
res = res.flatMap(ch(c))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user