slicey-derive 0.1.2

Contains procedural macros for the parsey crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use proc_macro::TokenStream;
use quote::{format_ident, quote};
use syn::{parse_macro_input, DeriveInput};

pub fn impl_spanned(input: TokenStream) -> TokenStream {
    let input = parse_macro_input!(input as DeriveInput);

    let name = input.ident;
    let spanned_name = format_ident!("Sliced{}", name);

    // Generate the new Kind type and the alias type
    let expanded = quote! {
        // Generate the alias
        type #spanned_name = slicey::Spanned<#name>;
    };

    TokenStream::from(expanded)
}