Skip to content

Commit

Permalink
Merge pull request #709 from epage/repeat
Browse files Browse the repository at this point in the history
fix(comb): Fix repeat().fold(1..) to append errors on first failure
  • Loading branch information
epage authored Jan 23, 2025
2 parents 9156d50 + 21e90db commit b9172d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/combinator/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1397,9 +1397,9 @@ where
E: ParserError<I>,
{
let init = init();
let start = input.checkpoint();
match f.parse_next(input) {
Err(ErrMode::Backtrack(_)) => Err(ErrMode::from_error_kind(input, ErrorKind::Repeat)),
Err(e) => Err(e),
Err(e) => Err(e.append(input, &start, ErrorKind::Repeat)),
Ok(o1) => {
let mut acc = g(init, o1);

Expand Down
2 changes: 1 addition & 1 deletion src/combinator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3712,7 +3712,7 @@ Err(
],
partial: true,
},
kind: Repeat,
kind: Literal,
},
),
)
Expand Down

0 comments on commit b9172d7

Please sign in to comment.