1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Crate not intended for direct use.
//! Use https:://docs.rs/nougat instead.
// Templated by `cargo-generate` using https://github.com/danielhenrymantilla/proc-macro-template
#![allow(nonstandard_style, unused_imports)]

use ::core::{
    mem,
    ops::Not as _,
};
use ::proc_macro::{
    TokenStream,
};
use ::proc_macro2::{
    Span,
    TokenStream as TokenStream2,
    TokenTree as TT,
};
use ::quote::{
    format_ident,
    quote,
    quote_spanned,
    ToTokens,
};
use ::syn::{*,
    parse::{Parse, Parser, ParseStream},
    punctuated::{Pair, Punctuated},
    Result, // Explicitly shadow it
    spanned::Spanned,
};

#[path = "adju-gat-e.rs"]
mod adjugate;

#[path = "Gat-bang.rs"]
mod Gat;

use self::utils::*;
mod utils;

// Documentation located in the frontend crate.
#[proc_macro_attribute] pub
fn gat (
    attrs: TokenStream,
    input: TokenStream,
) -> TokenStream
{
    unwrap("#[::nougat::gat]", {
        #[path = "gat-attr/_mod.rs"]
        mod implementation;
        implementation::gat(attrs.into(), input.into())
    })
}

// Documentation located in the frontend crate.
#[proc_macro] pub
fn Gat (
    input: TokenStream,
) -> TokenStream
{
    unwrap("::nougat::Gat!", {
        parse(input).and_then(Gat::Gat::<Error>)
    })
}

fn combine_trait_name_and_assoc_type (
    trait_name: &'_ Ident,
    assoc_type: &'_ Ident,
) -> Ident
{
    Ident::new(
        &format!("{}ඞ{}", trait_name, assoc_type),
        assoc_type.span(), // .located_at(trait_name.span()),
    )
}