diff --git a/Cargo.toml b/Cargo.toml index 8b80d249..fe79b453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chumsky" -version = "0.11.1" +version = "0.12.0" description = "A parser library for humans with powerful error recovery" authors = ["Joshua Barretto ", "Elijah Hartvigsen "] repository = "https://github.com/zesterer/chumsky" diff --git a/src/combinator.rs b/src/combinator.rs index e895a6f9..7018d205 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -1157,15 +1157,15 @@ where } /// See [`Parser::nested_in`]. -pub struct NestedIn { +pub struct NestedIn { pub(crate) parser_a: A, pub(crate) parser_b: B, #[allow(dead_code)] - pub(crate) phantom: EmptyPhantom<(J, F, O, E)>, + pub(crate) phantom: EmptyPhantom<(J, O, E)>, } -impl Copy for NestedIn {} -impl Clone for NestedIn { +impl Copy for NestedIn {} +impl Clone for NestedIn { fn clone(&self) -> Self { Self { parser_a: self.parser_a.clone(), @@ -1175,14 +1175,32 @@ impl Clone for NestedIn { } } -impl<'src, I, J, E, F, A, B, O> Parser<'src, I, O, E> for NestedIn +impl<'src, I, J, E, A, B, O> Parser<'src, I, O, E> for NestedIn where I: Input<'src>, E: ParserExtra<'src, I>, + // These bounds looks silly, but they basically just ensure that the extra type of the inner parser is compatible with the extra of the outer parser + E: ParserExtra< + 'src, + J, + Error = >::Error, + State = >::State, + Context = >::Context, + >, + >::Error: Error<'src, J>, + >::State: Inspector<'src, J>, B: Parser<'src, I, J, E>, J: Input<'src>, - F: ParserExtra<'src, J, State = E::State, Context = E::Context, Error = E::Error>, - A: Parser<'src, J, O, F>, + A: Parser< + 'src, + J, + O, + extra::Full< + >::Error, + >::State, + >::Context, + >, + >, { #[inline(always)] fn go(&self, inp: &mut InputRef<'src, '_, I, E>) -> PResult { diff --git a/src/lib.rs b/src/lib.rs index 47faa5d3..8a4ee4a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1087,7 +1087,7 @@ pub trait Parser<'src, I: Input<'src>, O, E: ParserExtra<'src, I> = extra::Defau /// /// assert_eq!(tl.parse(&tokens).into_result(), Ok(vec![("foo", vec!["a", "b"])])); /// ``` - fn nested_in, J, F>(self, other: B) -> NestedIn + fn nested_in, J, F>(self, other: B) -> NestedIn where Self: Sized, I: 'src,