Skip to content

Commit

Permalink
Merge pull request #683 from zesterer/input-trait-overhaul
Browse files Browse the repository at this point in the history
Overhauled Input trait to improve versatility, added IterInput
  • Loading branch information
zesterer authored Oct 22, 2024
2 parents 0217021 + 9d31654 commit 3c75963
Show file tree
Hide file tree
Showing 15 changed files with 1,071 additions and 894 deletions.
127 changes: 64 additions & 63 deletions src/combinator.rs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//! E: extra::ParserExtra<'a, I>,
//! {
//! fn parse(&self, inp: &mut InputRef<'a, '_, I, E>) -> Result<(), E::Error> {
//! let before = inp.offset();
//! let before = inp.cursor();
//! match inp.next_maybe().as_deref() {
//! // The next token was a null byte, meaning that parsing was successful
//! Some(b'\0') => Ok(()),
Expand All @@ -38,7 +38,7 @@
//! // Found whatever the token was instead
//! found.copied().map(Into::into),
//! // The span of the error is the span of the token that was found instead
//! inp.span_since(before),
//! inp.span_since(&before),
//! )),
//! }
//! }
Expand Down Expand Up @@ -153,11 +153,11 @@ mod current {
{
#[inline(always)]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.offset();
let before = inp.cursor();
match M::choose(&mut *inp, |inp| self.0.parse(inp), |inp| self.0.check(inp)) {
Ok(out) => Ok(out),
Err(err) => {
inp.add_alt_err(before.offset, err);
inp.add_alt_err(&before.inner, err);
Err(())
}
}
Expand Down
Loading

0 comments on commit 3c75963

Please sign in to comment.