50 lines
1.6 KiB
Rust
50 lines
1.6 KiB
Rust
use never::Never;
|
|
use orchid_base::interner::Interner;
|
|
use orchid_base::name::Sym;
|
|
use orchid_base::reqnot::Receipt;
|
|
use orchid_extension::atom::{AtomDynfo, AtomicFeatures};
|
|
use orchid_extension::entrypoint::ExtReq;
|
|
use orchid_extension::lexer::LexerObj;
|
|
use orchid_extension::other_system::SystemHandle;
|
|
use orchid_extension::parser::ParserObj;
|
|
use orchid_extension::system::{System, SystemCard};
|
|
use orchid_extension::system_ctor::SystemCtor;
|
|
use orchid_extension::tree::GenMember;
|
|
|
|
use crate::macros::instantiate_tpl::InstantiateTplCall;
|
|
use crate::macros::let_line::LetLine;
|
|
use crate::macros::macro_lib::gen_macro_lib;
|
|
use crate::macros::macro_line::{Macro, MacroLine};
|
|
use crate::macros::mactree_lexer::MacTreeLexer;
|
|
use crate::macros::recur_state::RecurState;
|
|
use crate::{MacTree, StdSystem};
|
|
|
|
#[derive(Default)]
|
|
pub struct MacroSystem;
|
|
impl SystemCtor for MacroSystem {
|
|
type Deps = StdSystem;
|
|
type Instance = Self;
|
|
const NAME: &'static str = "macros";
|
|
const VERSION: f64 = 0.00_01;
|
|
fn inst(_: SystemHandle<StdSystem>) -> Self::Instance { Self }
|
|
}
|
|
impl SystemCard for MacroSystem {
|
|
type Ctor = Self;
|
|
type Req = Never;
|
|
fn atoms() -> impl IntoIterator<Item = Option<Box<dyn AtomDynfo>>> {
|
|
[
|
|
Some(InstantiateTplCall::dynfo()),
|
|
Some(MacTree::dynfo()),
|
|
Some(RecurState::dynfo()),
|
|
Some(Macro::dynfo()),
|
|
]
|
|
}
|
|
}
|
|
impl System for MacroSystem {
|
|
async fn request(_: ExtReq<'_>, req: Self::Req) -> Receipt<'_> { match req {} }
|
|
async fn prelude(_: &Interner) -> Vec<Sym> { vec![] }
|
|
fn lexers() -> Vec<LexerObj> { vec![&MacTreeLexer] }
|
|
fn parsers() -> Vec<ParserObj> { vec![&LetLine, &MacroLine] }
|
|
fn env() -> Vec<GenMember> { gen_macro_lib() }
|
|
}
|