Starting to separate the context and parsed tokens into their own modules.

This commit is contained in:
Tom Alexander 2023-09-02 18:46:45 -04:00
parent 25b8c80d4e
commit b47029fdbb
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
8 changed files with 13 additions and 10 deletions

11
src/context/mod.rs Normal file
View File

@ -0,0 +1,11 @@
mod exiting;
mod list;
mod parser_context;
mod parser_with_context;
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;

View File

@ -15,5 +15,7 @@ pub use compare::get_emacs_version;
#[cfg(feature = "compare")] #[cfg(feature = "compare")]
pub use compare::get_org_mode_version; pub use compare::get_org_mode_version;
mod context;
mod error; mod error;
pub mod parser; pub mod parser;
mod types;

View File

@ -26,14 +26,11 @@ mod latex_fragment;
mod lesser_block; mod lesser_block;
mod lesser_element; mod lesser_element;
mod line_break; mod line_break;
mod list;
mod object; mod object;
mod object_parser; mod object_parser;
mod org_macro; mod org_macro;
mod org_source; mod org_source;
mod paragraph; mod paragraph;
mod parser_context;
mod parser_with_context;
mod plain_link; mod plain_link;
mod plain_list; mod plain_list;
mod plain_text; mod plain_text;
@ -114,10 +111,3 @@ pub use source::Source;
use self::org_source::OrgSource; use self::org_source::OrgSource;
use self::parser_context::Context; use self::parser_context::Context;
use crate::error::Res; use crate::error::Res;
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;

0
src/types/mod.rs Normal file
View File