diff --git a/src/combinator/core.rs b/src/combinator/core.rs index bbd383b2..c8c6da97 100644 --- a/src/combinator/core.rs +++ b/src/combinator/core.rs @@ -157,7 +157,9 @@ where }) } -/// Tries to apply its parser without consuming the input. +/// Apply the parser without advancing the input. +/// +/// To lookahead and only advance on success, see [`opt`]. /// /// # Example /// diff --git a/src/parser.rs b/src/parser.rs index 497dc6d4..01f4dd10 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -82,7 +82,18 @@ pub trait Parser { /// Take tokens from the [`Stream`], turning it into the output /// - /// This includes advancing the [`Stream`] to the next location. + /// This returns a copy of the [`Stream`] advanced to the next location. + /// + ///
+ /// + /// Generally, prefer [`Parser::parse_next`]. + /// This is primarily intended for: + /// - Migrating from older versions / `nom` + /// - Testing [`Parser`]s + /// + /// For look-ahead parsing, see instead [`peek`]. + /// + ///
#[inline(always)] fn parse_peek(&mut self, mut input: I) -> IResult { match self.parse_next(&mut input) {