Skip to content

Commit

Permalink
Merge pull request #556 from epage/recognize
Browse files Browse the repository at this point in the history
docs(comb): Suggest how to recognize an Accumulator
  • Loading branch information
epage authored Jul 11, 2024
2 parents 341f1ec + a45dbe0 commit 22766b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dne = "dne"
hel = "hel"
ba = "ba"
nd = "nd"
rror = "rror"
2 changes: 1 addition & 1 deletion src/_topic/nom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! 1. Ensure everything compiles and tests pass, ignoring deprecation messages (see [migration
//! notes](https://github.com/winnow-rs/winnow/blob/v0.5.0/CHANGELOG.md))
//! 1. Commit
//! 1. Resolve deprecation messagess
//! 1. Resolve deprecation messages
//! 1. Commit
//!
//! For example migrations, see
Expand Down
12 changes: 10 additions & 2 deletions src/combinator/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use crate::Parser;
/// This stops before `n` when the parser returns [`ErrMode::Backtrack`]. To instead chain an error up, see
/// [`cut_err`][crate::combinator::cut_err].
///
/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`].
/// To recognize a series of tokens, [`Accumulate`] into a `()`
/// (e.g. with [`.map(|()| ())`][Parser::map])
/// and then [`Parser::recognize`].
///
/// **Warning:** If the parser passed to `repeat` accepts empty inputs
/// (like `alpha0` or `digit0`), `repeat` will return an error,
Expand Down Expand Up @@ -450,7 +452,9 @@ where
///
/// `f` keeps going so long as `g` produces [`ErrMode::Backtrack`]. To instead chain an error up, see [`cut_err`][crate::combinator::cut_err].
///
/// To recognize a series of tokens, [`Accumulate`] into a `()` and then [`Parser::recognize`].
/// To recognize a series of tokens, [`Accumulate`] into a `()`
/// (e.g. with [`.map(|()| ())`][Parser::map])
/// and then [`Parser::recognize`].
///
/// See also
/// - [`take_till`][crate::token::take_till] for recognizing up-to a member of a [set of tokens][crate::stream::ContainsToken]
Expand Down Expand Up @@ -608,6 +612,10 @@ where
/// This stops when either parser returns [`ErrMode::Backtrack`]. To instead chain an error up, see
/// [`cut_err`][crate::combinator::cut_err].
///
/// To recognize a series of tokens, [`Accumulate`] into a `()`
/// (e.g. with [`.map(|()| ())`][Parser::map])
/// and then [`Parser::recognize`].
///
/// **Warning:** If the separator parser accepts empty inputs
/// (like `alpha0` or `digit0`), `separated` will return an error,
/// to prevent going into an infinite loop.
Expand Down

0 comments on commit 22766b1

Please sign in to comment.