add: parser combinators.

This commit is contained in:
2024-11-17 22:56:47 +08:00
parent 0e9684c32e
commit 8a9c58966b
9 changed files with 1177 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ impl<TToken, T1, T2, TContext, P, P2, F> Parser<TToken, T2, TContext> for BindPa
where
TToken: Debug + Clone,
P: Parser<TToken, T1, TContext>,
F: Fn(&T1) -> P2,
F: Fn(T1) -> P2,
P2: Parser<TToken, T2, TContext>,
{
fn parse<'a>(
@@ -47,7 +47,7 @@ where
) -> ParserResult<'a, TToken, T2> {
let (input, middle) = self.parser.parse(context.clone(), input)?;
(self.binder)(&middle).parse(context, input)
(self.binder)(middle).parse(context, input)
}
}