wip: fix(dsl): maybe getting somewhere?
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-06-21 13:48:45 +03:00
parent 91dc77cfea
commit 11f686650f
19 changed files with 964 additions and 918 deletions

View file

@ -84,7 +84,7 @@ impl ToTokens for CommandDef {
let mut out = TokenStream2::new();
for (arg, _ty) in arm.args() {
write_quote_to(&mut out, quote! {
#arg: Dsl::try_provide(self, words)?,
#arg: DslFrom::dsl_from(self, words, ||"command error")?,
});
}
out
@ -93,7 +93,7 @@ impl ToTokens for CommandDef {
out
};
write_quote(quote! {
Some(::tengri::dsl::Token { value: ::tengri::dsl::Value::Key(#key), .. }) => {
Some(::tengri::dsl::Token { value: ::tengri::dsl::DslVal::Key(#key), .. }) => {
let mut words = words.clone();
Some(#command_enum::#variant)
},
@ -149,10 +149,12 @@ impl ToTokens for CommandDef {
}
}
/// Generated by [tengri_proc::command].
impl ::tengri::dsl::Dsl<#state> for #command_enum {
fn try_provide (state: &#state, mut words: ::tengri::dsl::Ast) -> Perhaps<Self> {
let mut words = words.clone();
let token = words.next();
impl ::tengri::dsl::DslFrom<#state> for #command_enum {
fn try_dsl_from (
state: &#state,
value: &impl ::tengri::dsl::Dsl
) -> Perhaps<Self> {
use ::tengri::dsl::DslVal::*;
todo!()//Ok(match token { #(#matchers)* _ => None })
}
}