bizzle
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
i do not exist 2026-08-19 18:21:42 +03:00
parent e50c4a5eef
commit e6984915e4
22 changed files with 1002 additions and 294 deletions

View file

@ -233,7 +233,7 @@ attribute!(commands {
append(disp, quote! { #command::#variant { #params } => state.#ident(#params), });
append(exps, quote! {
let tail_base = tail;
if head.src()? == Some(#keyword) {
if head == Some(#keyword) {
let tail = tail_base;
#obtain
return Ok(Some(#command::#variant { #params }))
@ -261,19 +261,13 @@ attribute!(commands {
let tys = Punctuated::<_, Comma>::from_iter(generics.type_params());
quote! {
impl<#tys> dizzle::Namespace<#command> for #state {
//def_namespace_symbols!('n |state: Self| -> #command {
//#syms
//});
//def_namespace_exps!('n |state: Self| -> #command {
//#exps
//});
fn namespace_symbol (&self, word: impl Symbol) -> Perhaps<#command> {
fn namespace_symbol <L: Language> (&self, word: &L) -> Perhaps<#command> {
if let Some(word) = word.word()? {
#syms
}
Ok(None)
}
fn namespace_expression (&self, expr: impl Expression) -> Perhaps<#command> {
fn namespace_expression <L: Language> (&self, expr: &L) -> Perhaps<#command> {
let state = self;
if let Some(expr) = expr.expr()? {
let head = expr.head()?;
@ -303,13 +297,13 @@ attribute!(commands {
) -> TokenStream2 {
quote! {
impl<T: #state> dizzle::Namespaced<T> for #command {
fn namespaced_symbol <L: Symbol> (state: &T, word: L) -> Perhaps<#command> {
fn namespaced_symbol <L: Language> (state: &T, word: &L) -> Perhaps<Self> {
if let Some(word) = word.word()? {
#syms
}
Ok(None)
}
fn namespaced_expression <L: Expression> (state: &T, expr: L) -> Perhaps<#command> {
fn namespaced_expression <L: Language> (state: &T, expr: &L) -> Perhaps<Self> {
if let Some(expr) = expr.expr()? {
let head = expr.head()?;
let tail = expr.tail()?;