partway through fixes, macro system needs resdesign
Some checks failed
Rust / build (push) Has been cancelled

This commit is contained in:
2026-04-08 18:02:20 +02:00
parent 0909524dee
commit 9b4c7fa7d7
76 changed files with 1391 additions and 1065 deletions

View File

@@ -5,7 +5,6 @@ use orchid_extension::tree::{GenMember, fun, prefix};
use orchid_extension::{Expr, TAtom, ToExpr, exec};
use crate::macros::match_macros::MatcherAtom;
use crate::macros::resolve::resolve;
use crate::macros::utils::{build_macro, mactree, mactreev};
use crate::{OrcOpt, Tpl};
@@ -26,19 +25,16 @@ pub async fn gen_option_macro_lib() -> Vec<GenMember> {
),
build_macro(None, ["some", "none"])
.rule(mactreev!(pattern::match_rule ( std::option::some "...$" sub_pattern 0)), [
|[sub]: [_; _]| {
exec(async move |mut h| {
let sub = h
.exec::<TAtom<MatcherAtom>>(resolve(mactree!(pattern::match_rule "push" sub;)).await)
.await?;
Ok(new_atom(MatcherAtom {
keys: sub.keys().collect().await,
matcher: call(sym!(std::option::is_some_body), sub).await.create().await,
}))
})
async |mut cx, [sub]| {
let sub: TAtom<MatcherAtom> =
cx.exec(cx.recur(mactree!(pattern::match_rule "push" sub;))).await?;
Ok(new_atom(MatcherAtom {
keys: sub.keys().collect().await,
matcher: call(sym!(std::option::is_some_body), sub).await.create().await,
}))
},
])
.rule(mactreev!(pattern::match_rule(std::option::none)), [async |[]: [_; _]| {
.rule(mactreev!(pattern::match_rule(std::option::none)), [async |_cx, []| {
new_atom(MatcherAtom {
keys: vec![],
matcher: sym!(std::option::is_none_body).to_expr().await,