Lexer test mode works

This commit is contained in:
2024-08-04 23:24:32 +02:00
parent 9d35ba8040
commit 11951ede43
36 changed files with 687 additions and 115 deletions

View File

@@ -1,4 +1,4 @@
use orchid_extension::entrypoint::{extension_main, ExtensionData};
use orchid_extension::entrypoint::ExtensionData;
use orchid_std::StdSystem;
pub fn main() { extension_main(ExtensionData { systems: &[&StdSystem] }) }
pub fn main() { ExtensionData::new("orchid-std::main", &[&StdSystem]).main() }

View File

@@ -9,7 +9,7 @@ use orchid_extension::system_ctor::SystemCtor;
use orchid_extension::tree::{cnst, module, root_mod, GenMemberKind};
use crate::number::num_atom::{Float, Int};
use crate::string::str_atom::StrAtom;
use crate::string::str_atom::{IntStrAtom, StrAtom};
use crate::string::str_lexer::StringLexer;
use crate::OrcString;
@@ -25,7 +25,7 @@ impl SystemCtor for 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(Int::INFO), Some(Float::INFO), Some(StrAtom::INFO), Some(IntStrAtom::INFO)];
}
impl System for StdSystem {
fn lexers() -> Vec<orchid_extension::lexer::LexerObj> { vec![&StringLexer] }

View File

@@ -61,6 +61,7 @@ impl From<Tok<String>> for IntStrAtom {
impl OwnedAtom for IntStrAtom {
fn val(&self) -> Cow<'_, Self::Data> { Cow::Owned(self.0.marker()) }
fn handle_req(&self, _ctx: SysCtx, pck: impl ReqPck<Self>) { pck.never() }
fn print(&self, _ctx: SysCtx) -> String { format!("{:?}i", self.0.as_str()) }
}
#[derive(Clone)]