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:
2024-07-28 23:59:55 +02:00
parent cc3699bbe7
commit 9d35ba8040
46 changed files with 1236 additions and 642 deletions

View File

@@ -9,9 +9,10 @@ use std::path::Path;
use std::{fmt, slice, vec};
use itertools::Itertools;
use orchid_api::interner::TStr;
use trait_set::trait_set;
use crate::interner::{intern, InternMarker, Tok};
use crate::interner::{deintern, intern, InternMarker, Tok};
trait_set! {
/// Traits that all name iterators should implement
@@ -226,6 +227,9 @@ impl VName {
let data: Vec<_> = items.into_iter().collect();
if data.is_empty() { Err(EmptyNameError) } else { Ok(Self(data)) }
}
pub fn deintern(items: impl IntoIterator<Item = TStr>) -> Result<Self, EmptyNameError> {
Self::new(items.into_iter().map(deintern))
}
/// Unwrap the enclosed vector
pub fn into_vec(self) -> Vec<Tok<String>> { self.0 }
/// Get a reference to the enclosed vector