imperative_rs_derive/
lib.rs

1extern crate proc_macro;
2extern crate proc_macro2;
3#[macro_use]
4extern crate lazy_static;
5use crate::proc_macro::TokenStream;
6use quote::quote;
7use syn::*;
8
9mod instruction;
10mod instructionset;
11mod matcher;
12
13use instructionset::InstructionSet;
14
15#[proc_macro_derive(InstructionSet, attributes(opcode, variable))]
16pub fn derive_instructionset(input: TokenStream) -> TokenStream {
17    let instruction_set = parse_macro_input!(input as InstructionSet);
18    let tokens = quote! {#instruction_set};
19    tokens.into()
20}