diff --git a/src/parser/document.rs b/src/parser/document.rs index 6e03cc9..aaadfbb 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -34,6 +34,7 @@ use crate::context::GlobalSettings; use crate::context::List; use crate::context::RefContext; use crate::error::CustomError; +use crate::error::MyError; use crate::error::Res; use crate::parser::comment::comment; use crate::parser::element_parser::element; @@ -88,6 +89,11 @@ fn document_org_source<'b, 'g, 'r, 's>( .file_access .read_file(Into::<&str>::into(setup_file)) .map_err(|err| nom::Err::>>::Failure(err.into()))?; + let parsed_setup_file = _document(context, setup_file_contents.as_str().into()); + if parsed_setup_file.is_err() { + return Err(nom::Err::Error(CustomError::MyError(MyError("Failed to parse the setup file.".into())))); + } + let (_remaining, parsed_setup_file) = parsed_setup_file.expect("The if-statement proves this is ok."); println!("TODO: Process setup_file: {}", setup_file); }