diff --git a/src/context/global_settings.rs b/src/context/global_settings.rs index a3ad30e..b5f818b 100644 --- a/src/context/global_settings.rs +++ b/src/context/global_settings.rs @@ -1,5 +1,6 @@ #[derive(Debug)] pub struct GlobalSettings<'s> { + #[allow(dead_code)] placeholder: Option<&'s str>, } diff --git a/src/context/mod.rs b/src/context/mod.rs index 247b2cf..9d9c362 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -12,6 +12,7 @@ pub trait ContextMatcher = for<'b, 'r, 's> Fn(RefContext<'b, 'r, 's>, OrgSource<'s>) -> Res, OrgSource<'s>>; pub type DynContextMatcher<'c> = dyn ContextMatcher + 'c; pub trait Matcher = for<'s> Fn(OrgSource<'s>) -> Res, OrgSource<'s>>; +#[allow(dead_code)] pub type DynMatcher<'c> = dyn Matcher + 'c; pub use exiting::ExitClass; diff --git a/src/parser/document.rs b/src/parser/document.rs index 5d923d7..4e752a0 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -17,7 +17,6 @@ use nom::multi::many_till; use nom::multi::separated_list1; use nom::sequence::tuple; -use super::org_source::convert_error; use super::org_source::OrgSource; use super::token::AllTokensIterator; use super::token::Token; @@ -54,9 +53,18 @@ pub fn document(input: &str) -> Res<&str, Document> { let initial_context = ContextElement::document_context(); let initial_context = Context::new(&global_settings, List::new(&initial_context)); let wrapped_input = OrgSource::new(input); - let (remaining, document) = _document(&initial_context, wrapped_input) - .map(|(rem, out)| (Into::<&str>::into(rem), out)) - .map_err(convert_error)?; + let _foo = double_pass_document(&initial_context, wrapped_input); + todo!() +} + +#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] +#[allow(dead_code)] +fn double_pass_document<'r, 's>( + context: RefContext<'_, 'r, 's>, + input: OrgSource<'s>, +) -> Res, Document<'s>> { + let (remaining, document) = + _document(context, input).map(|(rem, out)| (Into::<&str>::into(rem), out))?; { // If there are radio targets in this document then we need to parse the entire document again with the knowledge of the radio targets. let all_radio_targets: Vec<&Vec>> = document @@ -73,10 +81,9 @@ pub fn document(input: &str) -> Res<&str, Document> { .collect(); if !all_radio_targets.is_empty() { let parser_context = ContextElement::RadioTarget(all_radio_targets); - let parser_context = initial_context.with_additional_node(&parser_context); - let (remaining, document) = _document(&parser_context, wrapped_input) - .map(|(rem, out)| (Into::<&str>::into(rem), out)) - .map_err(convert_error)?; + let parser_context = context.with_additional_node(&parser_context); + let (remaining, document) = _document(&parser_context, input) + .map(|(rem, out)| (Into::<&str>::into(rem), out))?; return Ok((remaining.into(), document)); } }