diff --git a/src/parser/document.rs b/src/parser/document.rs index 1cc2fbd..f509414 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -48,19 +48,21 @@ use crate::types::Section; #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] #[allow(dead_code)] -pub fn parse(input: &str) -> Res<&str, Document> { +pub fn parse<'s>(input: &'s str) -> Result, String> { let global_settings = GlobalSettings::default(); let initial_context = ContextElement::document_context(); let initial_context = Context::new(&global_settings, List::new(&initial_context)); let wrapped_input = OrgSource::new(input); - let _foo = document(&initial_context, wrapped_input); - todo!() + let ret = document(&initial_context, wrapped_input) + .map_err(|err| err.to_string()) + .map(|(remaining, parsed_document)| parsed_document); + ret } #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] #[allow(dead_code)] -pub fn document<'r, 's>( - context: RefContext<'_, 'r, 's>, +pub fn document<'b, 'r, 's>( + context: RefContext<'b, 'r, 's>, input: OrgSource<'s>, ) -> Res, Document<'s>> { let (remaining, document) =