mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-07 04:06:48 +01:00
This commit is contained in:
parent
91dc77cfea
commit
11f686650f
19 changed files with 964 additions and 918 deletions
|
|
@ -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 })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue