extern crate proc_macro;
mod renderer;
use syn::parse_macro_input;

#[proc_macro_attribute]
pub fn honeycomb_context(
    args: proc_macro::TokenStream,
    input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
    let context = parse_macro_input!(input as syn::ItemStruct);
    let args = args.to_string();

    let is_compression = args.contains("compression");

    renderer::HoneycombContext::new(
        context,
        renderer::HoneycombContextFlags {
            global: args.contains("global"),
            compression_program: is_compression,
            noop_program: is_compression || args.contains("noop"),
        },
    )
    .render()
}
