From 2915a81edc8ccc80fd22b58bdece94fa11941a98 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 3 Sep 2023 16:08:17 -0400 Subject: [PATCH] Cleanup. --- src/context/parser_context.rs | 88 ----------------------------------- 1 file changed, 88 deletions(-) diff --git a/src/context/parser_context.rs b/src/context/parser_context.rs index 34623b4..8b21c50 100644 --- a/src/context/parser_context.rs +++ b/src/context/parser_context.rs @@ -12,94 +12,6 @@ use crate::error::Res; use crate::parser::OrgSource; use crate::types::Object; -// type Matcher = -// dyn for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res, OrgSource<'s>>; - -// #[derive(Debug, Clone)] -// pub struct ContextTree<'r, 's> { -// tree: List>, -// } - -// impl<'r, 's> ContextTree<'r, 's> { -// pub fn new() -> Self { -// ContextTree { tree: List::new() } -// } - -// pub fn branch_from(trunk: &Rc>>) -> Self { -// ContextTree { -// tree: List::branch_from(trunk), -// } -// } - -// #[allow(dead_code)] -// pub fn ptr_eq<'x, 'y>(&self, other: &ContextTree<'x, 'y>) -> bool { -// self.tree.ptr_eq(&other.tree) -// } - -// pub fn with_additional_node(&self, data: ContextElement<'r, 's>) -> ContextTree<'r, 's> { -// let new_list = self.tree.push_front(data); -// ContextTree { tree: new_list } -// } - -// pub fn iter(&self) -> impl Iterator>>> { -// self.tree.iter() -// } - -// #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] -// pub fn check_exit_matcher( -// &'r self, -// i: OrgSource<'s>, -// ) -> IResult, OrgSource<'s>, CustomError>> { -// // Special check for EOF. We don't just make this a document-level exit matcher since the IgnoreParent ChainBehavior could cause early exit matchers to not run. -// let at_end_of_file = eof(i); -// if at_end_of_file.is_ok() { -// return at_end_of_file; -// } - -// let mut current_class_filter = ExitClass::Gamma; -// for current_node in self.iter() { -// let context_element = current_node.get_data(); -// match context_element { -// ContextElement::ExitMatcherNode(exit_matcher) => { -// if exit_matcher.class as u32 <= current_class_filter as u32 { -// current_class_filter = exit_matcher.class; -// let local_context = ContextTree::branch_from(current_node); -// let local_result = (exit_matcher.exit_matcher)(&local_context, i); -// if local_result.is_ok() { -// return local_result; -// } -// } -// } -// _ => {} -// }; -// } -// // TODO: Make this a specific error instead of just a generic MyError -// return Err(nom::Err::Error(CustomError::MyError(MyError( -// "NoExit".into(), -// )))); -// } - -// /// Indicates if elements should consume the whitespace after them. -// /// -// /// Defaults to true. -// pub fn should_consume_trailing_whitespace(&self) -> bool { -// self._should_consume_trailing_whitespace().unwrap_or(true) -// } - -// fn _should_consume_trailing_whitespace(&self) -> Option { -// for current_node in self.iter() { -// let context_element = current_node.get_data(); -// match context_element { -// ContextElement::ConsumeTrailingWhitespace(should) => { -// return Some(*should); -// } -// _ => {} -// } -// } -// None -// } -// } - #[derive(Debug)] pub enum ContextElement<'r, 's> { /// Stores a parser that indicates that children should exit upon matching an exit matcher.