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

@@ -15,6 +15,9 @@ pub struct LocalAtom {
pub drop: bool,
pub data: AtomData,
}
impl LocalAtom {
pub fn associate(self, owner: SysId) -> Atom { Atom { owner, drop: self.drop, data: self.data } }
}
/// An atom representation that can be serialized and sent around. Atoms
/// represent the smallest increment of work.
@@ -101,6 +104,7 @@ impl Request for Command {
#[extends(HostExtNotif)]
pub struct AtomDrop(pub Atom);
/// Requests that apply to an existing atom instance
#[derive(Clone, Debug, Hash, PartialEq, Eq, Coding, Hierarchy)]
#[extends(HostExtReq)]
#[extendable]
@@ -111,3 +115,16 @@ pub enum AtomReq {
Fwded(Fwded),
Command(Command),
}
impl AtomReq {
/// Obtain the first [Atom] argument of the request. All requests in this
/// subclass have at least one atom argument.
pub fn get_atom(&self) -> &Atom {
match self {
Self::AtomSame(AtomSame(a, ..))
| Self::CallRef(CallRef(a, ..))
| Self::Command(Command(a))
| Self::FinalCall(FinalCall(a, ..))
| Self::Fwded(Fwded(a, ..)) => a,
}
}
}