diff --git a/src/rcore/modes.rs b/src/rcore/modes.rs index cf8eb40..0286d49 100644 --- a/src/rcore/modes.rs +++ b/src/rcore/modes.rs @@ -14,6 +14,8 @@ pub trait Mode { result: Self::ParseResult, f: impl FnOnce(A0) -> Result, ) -> Self::ParseResult; + + fn seal(result: Self::ParseResult) -> Result; } pub trait ParseMode { @@ -79,6 +81,10 @@ impl Mode for RegularMode { ) -> Self::ParseResult { result.and_then(f) } + + fn seal(result: Self::ParseResult) -> Result { + result + } } pub trait RegularFactory<'a, Ctx: Context<'a>>: diff --git a/src/rstd/inlining/modes.rs b/src/rstd/inlining/modes.rs index 7ac123b..10f3d95 100644 --- a/src/rstd/inlining/modes.rs +++ b/src/rstd/inlining/modes.rs @@ -20,6 +20,10 @@ impl Mode for InliningMode { let a1 = f(a0)?; Ok((a1, i)) } + + fn seal(result: Self::ParseResult) -> Result { + result.map(|(a, _)| a) + } } impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryProxy<'a, Ctx>