use std::sync::Arc; use orchid_base::interner::Tok; use orchid_extension::atom::{AtomDynfo, AtomicFeatures}; use orchid_extension::fs::DeclFs; use orchid_extension::system::{System, SystemCard}; use orchid_extension::system_ctor::SystemCtor; use orchid_extension::tree::{comments, fun, module, root_mod, GenMemberKind}; use crate::number::num_atom::{Float, Int}; use crate::string::str_atom::{IntStrAtom, StrAtom}; use crate::string::str_lexer::StringLexer; use crate::OrcString; #[derive(Default)] pub struct StdSystem; impl SystemCtor for StdSystem { type Deps = (); type Instance = Self; const NAME: &'static str = "orchid::std"; const VERSION: f64 = 0.00_01; fn inst() -> Option { Some(StdSystem) } } impl SystemCard for StdSystem { type Ctor = Self; const ATOM_DEFS: &'static [Option<&'static dyn AtomDynfo>] = &[Some(Int::INFO), Some(Float::INFO), Some(StrAtom::INFO), Some(IntStrAtom::INFO)]; } impl System for StdSystem { fn lexers() -> Vec { vec![&StringLexer] } fn parsers() -> Vec { vec![] } fn vfs() -> DeclFs { DeclFs::Mod(&[]) } fn env() -> Vec<(Tok, GenMemberKind)> { vec![root_mod("std", [], [module(true, "string", [], [comments( ["Concatenate two strings"], fun(true, "concat", |left: OrcString, right: OrcString| { StrAtom::new(Arc::new(left.get_string().to_string() + &right.get_string())) }), )])])] } }