forked from Orchid/orchid
Changes in api and upwards
- Removed out-of-stack error reporting - Revised module system to match previous Orchid system - Errors are now in a Vec everywhere - Implemented atoms and lexer - Started implementation of line parser - Tree is now ephemeral to avoid copying Atoms held inside - Moved numbers into std and the shared parser into base - Started implementation of Commands
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use orchid_base::interner::Tok;
|
||||
use orchid_extension::atom::{AtomDynfo, AtomicFeatures};
|
||||
use orchid_extension::fs::DeclFs;
|
||||
use orchid_extension::fun::Fun;
|
||||
use orchid_extension::system::{System, SystemCard};
|
||||
use orchid_extension::system_ctor::SystemCtor;
|
||||
use orchid_extension::tree::GenTree;
|
||||
use orchid_extension::tree::{cnst, module, root_mod, GenMemberKind};
|
||||
|
||||
use crate::string::str_atom::StringAtom;
|
||||
use crate::string::str_leer::StringLexer;
|
||||
use crate::number::num_atom::{Float, Int};
|
||||
use crate::string::str_atom::StrAtom;
|
||||
use crate::string::str_lexer::StringLexer;
|
||||
use crate::OrcString;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -22,25 +24,23 @@ impl SystemCtor for StdSystem {
|
||||
}
|
||||
impl SystemCard for StdSystem {
|
||||
type Ctor = Self;
|
||||
const ATOM_DEFS: &'static [Option<&'static dyn AtomDynfo>] = &[Some(StringAtom::INFO)];
|
||||
const ATOM_DEFS: &'static [Option<&'static dyn AtomDynfo>] =
|
||||
&[Some(Int::INFO), Some(Float::INFO), Some(StrAtom::INFO)];
|
||||
}
|
||||
impl System for StdSystem {
|
||||
fn lexers() -> Vec<orchid_extension::lexer::LexerObj> { vec![&StringLexer] }
|
||||
fn vfs() -> DeclFs { DeclFs::Mod(&[]) }
|
||||
fn env() -> GenTree {
|
||||
GenTree::module([(
|
||||
"std",
|
||||
GenTree::module([(
|
||||
"string",
|
||||
GenTree::module([(
|
||||
"concat",
|
||||
GenTree::cnst(Fun::new(|left: OrcString| {
|
||||
fn env() -> Vec<(Tok<String>, GenMemberKind)> {
|
||||
vec![
|
||||
root_mod("std", [], [
|
||||
module(true, "string", [], [
|
||||
cnst(true, "concat", Fun::new(|left: OrcString| {
|
||||
Fun::new(move |right: OrcString| {
|
||||
StringAtom::new(Arc::new(left.get_string().to_string() + &right.get_string()))
|
||||
StrAtom::new(Arc::new(left.get_string().to_string() + &right.get_string()))
|
||||
})
|
||||
})),
|
||||
)]),
|
||||
)]),
|
||||
)])
|
||||
}))
|
||||
]),
|
||||
])
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user