Removed macro facets

Macros, placeholders, etc. will all be handled by std eventually so they shouldn't appear in the protocol or the host
This commit is contained in:
2024-08-22 18:05:57 +02:00
parent 3a63894de2
commit 84cbcdd4fe
37 changed files with 210 additions and 350 deletions

View File

@@ -9,4 +9,3 @@ edition = "2021"
ordered-float = "4.2.0"
orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" }
orchid-api-derive = { version = "0.1.0", path = "../orchid-api-derive" }
derive_more = "0.99.17"

View File

@@ -36,4 +36,4 @@ pub struct OrcError {
}
/// If this is an [`Err`] then the [`Vec`] must not be empty.
pub type OrcResult<T> = Result<T, Vec<OrcError>>;
pub type OrcResult<T> = Result<T, Vec<OrcError>>;

View File

@@ -75,8 +75,6 @@ pub enum Clause {
/// the atom must be trivial. This is always a newly constructed atom, if you
/// want to reference an existing atom, use the corresponding [ExprTicket].
/// Because the atom is newly constructed, it also must belong to this system.
/// For convenience, [SysId::MAX] is also accepted as referring to this
/// system.
NewAtom(Atom),
/// An atom, specifically an atom that already exists. This form is only ever
/// returned from [Inspect], and it's borrowed from the expression being

View File

@@ -1,7 +1,7 @@
mod atom;
pub use atom::{
Atom, AtomData, AtomDrop, AtomId, AtomPrint, AtomReq, AtomSame, CallRef, Command, FinalCall, Fwd,
Fwded, LocalAtom, NextStep, DeserAtom, SerializeAtom
Atom, AtomData, AtomDrop, AtomId, AtomPrint, AtomReq, AtomSame, CallRef, Command, DeserAtom,
FinalCall, Fwd, Fwded, LocalAtom, NextStep, SerializeAtom,
};
mod error;
pub use error::{ErrId, ErrLocation, OrcError, OrcResult};
@@ -25,11 +25,11 @@ pub use proto::{
HostExtNotif, HostExtReq, HostHeader, HostMsgSet, Ping,
};
mod system;
pub use system::{SysReq, NewSystem, SysDeclId, SysId, SystemDecl, SystemDrop, SystemInst};
pub use system::{NewSystem, SysDeclId, SysId, SysReq, SystemDecl, SystemDrop, SystemInst};
mod tree;
pub use tree::{
CompName, GetMember, Item, ItemKind, Macro, Member, MemberKind, Module, Paren, Placeholder,
PlaceholderKind, Token, TokenTree, TreeId, TreeTicket,
CompName, GetMember, Item, ItemKind, Member, MemberKind, Module, Paren, Token, TokenTree, TreeId,
TreeTicket,
};
mod vfs;
pub use vfs::{EagerVfs, GetVfs, Loaded, VfsId, VfsRead, VfsReq};

View File

@@ -146,7 +146,7 @@ impl MsgSet for HostMsgSet {
#[cfg(test)]
mod tests {
use orchid_api_traits::enc_vec;
use ordered_float::NotNan;
use ordered_float::NotNan;
use system::{SysDeclId, SystemDecl};
use super::*;

View File

@@ -77,4 +77,4 @@ pub struct SystemDrop(pub SysId);
#[extendable]
pub enum SysReq {
NewSystem(NewSystem),
}
}

View File

@@ -4,7 +4,6 @@ use std::sync::Arc;
use orchid_api_derive::{Coding, Hierarchy};
use orchid_api_traits::Request;
use ordered_float::NotNan;
use crate::error::OrcError;
use crate::interner::{TStr, TStrv};
@@ -41,9 +40,6 @@ pub enum Token {
BR,
/// ( Round parens ), [ Square brackets ] or { Curly braces }
S(Paren, Vec<TokenTree>),
/// A placeholder in a macro. This variant is forbidden everywhere outside
/// line parser output
Ph(Placeholder),
/// A new atom
Atom(Atom),
/// Anchor to insert a subtree
@@ -55,19 +51,6 @@ pub enum Token {
Comment(Arc<String>),
}
#[derive(Clone, Debug, Coding)]
pub struct Placeholder {
pub name: TStr,
pub kind: PlaceholderKind,
}
#[derive(Clone, Debug, Coding)]
pub enum PlaceholderKind {
Scalar,
Name,
Vector { nz: bool, prio: u8 },
}
#[derive(Clone, Debug, Hash, PartialEq, Eq, Coding)]
pub enum Paren {
Round,
@@ -75,13 +58,6 @@ pub enum Paren {
Curly,
}
#[derive(Clone, Debug, Coding)]
pub struct Macro {
pub pattern: Vec<TokenTree>,
pub priority: NotNan<f64>,
pub template: Vec<TokenTree>,
}
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Coding)]
pub struct TreeId(pub NonZeroU64);
@@ -97,7 +73,6 @@ pub enum ItemKind {
Member(Member),
Raw(Vec<TokenTree>),
Export(TStr),
Rule(Macro),
Import(CompName),
}