support permanent suffixes

This commit is contained in:
Richard Patel 2021-08-29 09:05:52 +02:00
parent 40142dcd9b
commit dff1075737
1 changed files with 16 additions and 1 deletions

View File

@ -194,7 +194,8 @@ impl Isa {
.iter() .iter()
.map(|opcode| { .map(|opcode| {
let variant = opcode.variant_identifier()?; 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! { Ok(quote! {
Opcode::#variant => #literal, 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); let set_modifiers = token_stream!(set_modifiers);
modifier_match_arms.push(quote! { modifier_match_arms.push(quote! {
Opcode::#ident => { Opcode::#ident => {