From dff107573729ebed349c4a1e66ada5f947d52264 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sun, 29 Aug 2021 09:05:52 +0200 Subject: [PATCH] support permanent suffixes --- macros/src/isa.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/macros/src/isa.rs b/macros/src/isa.rs index 10bbaeb..c8e0cc6 100644 --- a/macros/src/isa.rs +++ b/macros/src/isa.rs @@ -194,7 +194,8 @@ impl Isa { .iter() .map(|opcode| { let variant = opcode.variant_identifier()?; - let literal = Literal::string(&opcode.name); + let literal = + Literal::string(&opcode.name.strip_suffix(".").unwrap_or(&opcode.name)); Ok(quote! { Opcode::#variant => #literal, }) @@ -307,6 +308,20 @@ impl Isa { } }) } + for modifier in &opcode.side_effects { + set_modifiers.extend(match modifier.as_str() { + "OE" => quote! { m.oe = true; }, + "Rc" => quote! { m.rc = true; }, + "AA" => quote! { m.aa = true; }, + "LK" => quote! { m.lk = true; }, + _ => { + return Err(syn::Error::new( + Span::call_site(), + format!("unsupported modifier {}", modifier), + )) + } + }) + } let set_modifiers = token_stream!(set_modifiers); modifier_match_arms.push(quote! { Opcode::#ident => {