Remove OrgSource from the public document parser interface.
This commit is contained in:
parent
5997567233
commit
33091112a5
@ -36,6 +36,7 @@ use crate::error::Res;
|
|||||||
use crate::parser::comment::comment;
|
use crate::parser::comment::comment;
|
||||||
use crate::parser::element_parser::element;
|
use crate::parser::element_parser::element;
|
||||||
use crate::parser::object_parser::standard_set_object;
|
use crate::parser::object_parser::standard_set_object;
|
||||||
|
use crate::parser::org_source::convert_error;
|
||||||
use crate::parser::planning::planning;
|
use crate::parser::planning::planning;
|
||||||
use crate::parser::property_drawer::property_drawer;
|
use crate::parser::property_drawer::property_drawer;
|
||||||
use crate::parser::util::blank_line;
|
use crate::parser::util::blank_line;
|
||||||
@ -54,15 +55,26 @@ pub fn parse<'s>(input: &'s str) -> Result<Document<'s>, String> {
|
|||||||
let initial_context = ContextElement::document_context();
|
let initial_context = ContextElement::document_context();
|
||||||
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
||||||
let wrapped_input = OrgSource::new(input);
|
let wrapped_input = OrgSource::new(input);
|
||||||
let ret = all_consuming(parser_with_context!(document)(&initial_context))(wrapped_input)
|
let ret =
|
||||||
.map_err(|err| err.to_string())
|
all_consuming(parser_with_context!(document_org_source)(&initial_context))(wrapped_input)
|
||||||
.map(|(_remaining, parsed_document)| parsed_document);
|
.map_err(|err| err.to_string())
|
||||||
|
.map(|(_remaining, parsed_document)| parsed_document);
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn document<'b, 'g, 'r, 's>(
|
pub fn document<'b, 'g, 'r, 's>(
|
||||||
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Document<'s>> {
|
||||||
|
let (remaining, doc) = document_org_source(context, input.into()).map_err(convert_error)?;
|
||||||
|
Ok((Into::<&str>::into(remaining), doc))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn document_org_source<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
) -> Res<OrgSource<'s>, Document<'s>> {
|
) -> Res<OrgSource<'s>, Document<'s>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user