biome_diagnostics_macros/
lib.rs

1use proc_macro::TokenStream;
2use proc_macro_error::*;
3use syn::{parse_macro_input, DeriveInput};
4
5mod generate;
6mod parse;
7
8#[proc_macro_derive(
9    Diagnostic,
10    attributes(
11        diagnostic,
12        severity,
13        category,
14        description,
15        message,
16        advice,
17        verbose_advice,
18        location,
19        tags,
20        source
21    )
22)]
23#[proc_macro_error]
24pub fn derive_diagnostic(input: TokenStream) -> TokenStream {
25    let input = parse_macro_input!(input as DeriveInput);
26
27    let input = parse::DeriveInput::parse(input);
28
29    let tokens = generate::generate_diagnostic(input);
30
31    if false {
32        panic!("{tokens}");
33    }
34
35    TokenStream::from(tokens)
36}