1
//!
2
//! This crate defines several macros to make ATerm data types work.
3
//!
4
//! This crate does not use unsafe code.
5

            
6
#![forbid(unsafe_code)]
7

            
8
mod mcrl2_derive_terms;
9

            
10
use mcrl2_derive_terms::mcrl2_derive_terms_impl;
11

            
12
/// This proc macro can be used to generate implementations for the types stored
13
/// in an ATerm, for example data_expressions, applications, variables. This is
14
/// achieved by adding the proc macro to a module that contains both the
15
/// declaration and implementation of such a type.
16
///
17
/// For every struct containing an ATerm we generate another version for the
18
/// ATermRef implementation, as well as `protect` and `borrow` functions to
19
/// convert between both types. Furthermore, all of these can be converted to
20
/// and from ATerms.
21
///
22
/// # Example
23
#[proc_macro_attribute]
24
7
pub fn mcrl2_derive_terms(
25
7
    _attributes: proc_macro::TokenStream,
26
7
    input: proc_macro::TokenStream,
27
7
) -> proc_macro::TokenStream {
28
7
    mcrl2_derive_terms_impl(
29
7
        proc_macro2::TokenStream::from(_attributes),
30
7
        proc_macro2::TokenStream::from(input),
31
7
    )
32
7
    .into()
33
7
}
34

            
35
/// Marks a struct as a term.
36
#[proc_macro_attribute]
37
28
pub fn mcrl2_term(_attributes: proc_macro::TokenStream, input: proc_macro::TokenStream) -> proc_macro::TokenStream {
38
28
    input
39
28
}
40

            
41
/// Marks a function to be ignored, meaning the Ref term will not have this function
42
#[proc_macro_attribute]
43
24
pub fn mcrl2_ignore(_attributes: proc_macro::TokenStream, input: proc_macro::TokenStream) -> proc_macro::TokenStream {
44
24
    input
45
24
}