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
#![feature(extract_if)]
#![allow(dead_code)]

use proc_macro::TokenStream;

mod util;

mod archetype;
mod comp;
mod comps;
mod discrim;
mod entity_ref;
mod global;
mod system;
mod tracer;
mod tracer_def;
mod zip;

#[proc_macro]
pub fn zip(input: TokenStream) -> TokenStream {
    zip::imp(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro]
pub fn archetype(input: TokenStream) -> TokenStream {
    archetype::imp(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_attribute]
pub fn comp(args: TokenStream, input: TokenStream) -> TokenStream {
    comp::imp(args.into(), input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro]
pub fn comps(input: TokenStream) -> TokenStream {
    comps::imp(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_attribute]
pub fn global(args: TokenStream, input: TokenStream) -> TokenStream {
    global::imp(args.into(), input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_derive(EntityRef, attributes(entity, not_entity))]
pub fn entity_ref(input: TokenStream) -> TokenStream {
    entity_ref::derive(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_derive(Discrim, attributes(dynec))]
pub fn discrim(input: TokenStream) -> TokenStream {
    discrim::derive(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_attribute]
pub fn system(args: TokenStream, input: TokenStream) -> TokenStream {
    system::imp(args.into(), input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_attribute]
pub fn tracer(args: TokenStream, input: TokenStream) -> TokenStream {
    tracer::api(args.into(), input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro]
pub fn polyfill_tracer_proc(input: TokenStream) -> TokenStream {
    tracer::polyfill(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}

#[proc_macro_attribute]
pub fn tracer_def(args: TokenStream, input: TokenStream) -> TokenStream {
    tracer_def::imp(args.into(), input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}