scopegraphs_macros/
lib.rs

1// actually, don't warn! We should have the docs on `scopegraphs`
2// re-exports so we can link to other things in `scopegraphs`
3#![allow(missing_docs)]
4//! See <https://docs.rs/scopegraphs> for all documentation
5use crate::label::impl_label;
6use crate::order::OrderInput;
7use crate::regex::RegexInput;
8
9use proc_macro::TokenStream;
10
11use syn::{parse_macro_input, DeriveInput};
12
13mod label;
14mod order;
15mod regex;
16
17#[proc_macro_derive(Label)]
18pub fn label_derive(input: TokenStream) -> TokenStream {
19    let input = parse_macro_input!(input as DeriveInput);
20    impl_label(input)
21}
22
23#[proc_macro]
24pub fn compile_regex(input: TokenStream) -> TokenStream {
25    let input = parse_macro_input!(input as RegexInput);
26    input.compile()
27}
28
29#[proc_macro]
30pub fn label_order(input: TokenStream) -> TokenStream {
31    let input = parse_macro_input!(input as OrderInput);
32    input.compile().into()
33}