use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput, Ident};
mod make_ule;
mod make_varule;
pub(crate) mod ule;
mod utils;
mod varule;
#[proc_macro_derive(ULE)]
pub fn ule_derive(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
TokenStream::from(ule::derive_impl(&input))
}
#[proc_macro_derive(VarULE)]
pub fn varule_derive(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
TokenStream::from(varule::derive_impl(&input, None))
}
#[proc_macro_attribute]
pub fn make_ule(attr: TokenStream, item: TokenStream) -> TokenStream {
let input = parse_macro_input!(item as DeriveInput);
let attr = parse_macro_input!(attr as Ident);
TokenStream::from(make_ule::make_ule_impl(attr, input))
}
#[proc_macro_attribute]
pub fn make_varule(attr: TokenStream, item: TokenStream) -> TokenStream {
let input = parse_macro_input!(item as DeriveInput);
let attr = parse_macro_input!(attr as Ident);
TokenStream::from(make_varule::make_varule_impl(attr, input))
}