Added support for defining macros in Rust within the macro system

Also fixed a lot of bugs
This commit is contained in:
2025-09-30 21:23:16 +02:00
parent 7971a2b4eb
commit b77653f841
52 changed files with 849 additions and 502 deletions

View File

@@ -1,8 +1,8 @@
use std::mem;
use async_lock::RwLockWriteGuard;
use bound::Bound;
use futures::FutureExt;
use futures_locks::{RwLockWriteGuard, TryLockError};
use orchid_base::error::OrcErrv;
use orchid_base::format::{FmtCtxImpl, Format, take_first};
use orchid_base::location::Pos;
@@ -12,7 +12,7 @@ use crate::ctx::Ctx;
use crate::expr::{Expr, ExprKind, PathSet, Step};
use crate::tree::Root;
type ExprGuard = Bound<RwLockWriteGuard<'static, ExprKind>, Expr>;
type ExprGuard = Bound<RwLockWriteGuard<ExprKind>, Expr>;
/// The stack operation associated with a transform
enum StackOp {
@@ -76,13 +76,13 @@ impl ExecCtx {
#[must_use]
pub async fn unpack_ident(&self, ex: &Expr) -> Expr {
match ex.kind().try_write().as_deref_mut() {
Some(ExprKind::Identity(ex)) => {
Ok(ExprKind::Identity(ex)) => {
let val = self.unpack_ident(ex).boxed_local().await;
*ex = val.clone();
val
},
Some(_) => ex.clone(),
None => panic!("Cycle encountered!"),
Ok(_) => ex.clone(),
Err(TryLockError) => panic!("Cycle encountered!"),
}
}
pub async fn execute(&mut self) {