2022-10-15 00:01:37 -04:00
|
|
|
use std::cell::RefCell;
|
|
|
|
use std::rc::Rc;
|
|
|
|
|
2022-07-16 17:27:08 -04:00
|
|
|
use nom::branch::alt;
|
2022-10-15 14:04:24 -04:00
|
|
|
use nom::combinator::not;
|
2022-07-15 23:26:49 -04:00
|
|
|
use nom::error::VerboseError;
|
2022-07-16 16:31:00 -04:00
|
|
|
use nom::IResult;
|
2022-10-15 00:01:37 -04:00
|
|
|
use nom::Parser;
|
|
|
|
|
2022-11-24 14:42:05 -05:00
|
|
|
// type ContextReference<'r, T> = Option<ContextLayer<'r, T>>;
|
|
|
|
// type MatcherRef = dyn for<'s> FnMut(&'s str) -> IResult<&'s str, &'s str, VerboseError<&'s str>>;
|
|
|
|
|
|
|
|
// pub struct ContextLayer<'r, T> {
|
|
|
|
// data: T,
|
|
|
|
// parent: ContextReference<'r, T>,
|
|
|
|
// }
|
|
|
|
|
|
|
|
// pub struct TestContext<'r, T> {
|
|
|
|
// head: ContextReference<'r, T>,
|
|
|
|
// }
|
|
|
|
|
|
|
|
// pub struct ContextData<'r> {
|
|
|
|
// fail_matcher: ChainBehavior<'r>,
|
|
|
|
// }
|
|
|
|
|
|
|
|
// impl<'r> TestContext<'r, ContextData<'r>> {
|
|
|
|
// pub fn new() -> Self {
|
|
|
|
// TestContext { head: None }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// pub fn with_additional_fail_matcher<'subr>(
|
|
|
|
// &self,
|
|
|
|
// additional_fail_matcher: &'subr MatcherRef,
|
|
|
|
// ) -> TestContext<'subr, ContextData<'subr>> {
|
|
|
|
// // TestContext {
|
|
|
|
// // head: Some(
|
|
|
|
|
|
|
|
// // )
|
|
|
|
// // }
|
|
|
|
// todo!()
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// enum ChainBehavior<'r> {
|
|
|
|
// AndParent(Option<&'r MatcherRef>),
|
|
|
|
// IgnoreParent(Option<&'r MatcherRef>),
|
|
|
|
// }
|