Fixing up compiler errors.

This commit is contained in:
Tom Alexander 2023-09-02 19:28:33 -04:00
parent 564104f1e8
commit 22e9bc991f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 17 additions and 20 deletions

View File

@ -7,9 +7,14 @@ mod list;
mod parser_context;
mod parser_with_context;
type RefContext<'r, 's> = &'r Context<'r, 's>;
pub type RefContext<'r, 's> = &'r Context<'r, 's>;
trait ContextMatcher =
for<'r, 's> Fn(RefContext<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>>;
type DynContextMatcher<'c> = dyn ContextMatcher + 'c;
trait Matcher = for<'s> Fn(OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>>;
type DynMatcher<'c> = dyn Matcher + 'c;
pub use exiting::ExitClass;
pub use parser_context::ContextElement;
pub use parser_context::ExitMatcherNode;
pub(crate) use parser_with_context::parser_with_context;

View File

@ -1,12 +1,11 @@
use nom::combinator::eof;
use super::exiting::ExitClass;
use super::list::List;
use super::org_source::OrgSource;
use super::DynContextMatcher;
use super::Object;
use crate::error::Res;
use crate::parser::exiting::ExitClass;
use crate::parser::list::ListType;
use crate::parser::OrgSource;
use crate::types::Object;
// type Matcher =
// dyn for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>>;
@ -173,7 +172,7 @@ impl<'r, 's> Context<'r, 's> {
)
}
pub fn push(&self, data: ContextElement<'r, 's>) -> Self {
pub fn with_additional_node(&self, data: ContextElement<'r, 's>) -> Self {
let new_tree = self.tree.push(data);
Self {
global_settings: self.global_settings,
@ -182,18 +181,6 @@ impl<'r, 's> Context<'r, 's> {
}
}
impl<'r, 's> Default for Context<'r, 's> {
fn default() -> Self {
Context::new(
GlobalSettings::default(),
List::new(ContextElement::ExitMatcherNode(ExitMatcherNode {
exit_matcher: &document_end,
class: ExitClass::Document,
})),
)
}
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn document_end<'r, 's>(
_context: Context<'r, 's>,

View File

@ -11,11 +11,16 @@ use nom::multi::many_till;
use nom::sequence::tuple;
use super::org_source::OrgSource;
use super::util::exit_matcher_parser;
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
use super::Context;
use crate::context::parser_with_context;
use crate::context::ContextElement;
use crate::context::ExitClass;
use crate::context::ExitMatcherNode;
use crate::context::RefContext;
use crate::error::Res;
use crate::parser::util::get_consumed;
use crate::parser::Timestamp;
use crate::types::Timestamp;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn timestamp<'r, 's>(