salsa/components/salsa-2022-macros/src/lib.rs

69 lines
1.5 KiB
Rust
Raw Normal View History

2022-08-01 05:32:47 +00:00
//! This crate provides salsa's macros and attributes.
#![recursion_limit = "256"]
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
use proc_macro::TokenStream;
macro_rules! parse_quote {
($($inp:tt)*) => {
syn::parse2(quote!{$($inp)*}).unwrap_or_else(|err| {
panic!("failed to parse at {}:{}:{}: {}", file!(), line!(), column!(), err)
})
}
}
macro_rules! parse_quote_spanned {
($($inp:tt)*) => {
syn::parse2(quote_spanned!{$($inp)*}).unwrap_or_else(|err| {
panic!("failed to parse at {}:{}:{}: {}", file!(), line!(), column!(), err)
})
}
}
mod accumulator;
mod configuration;
mod db;
2022-08-03 04:31:50 +00:00
mod input;
2022-08-01 05:32:47 +00:00
mod interned;
mod jar;
mod options;
2022-08-03 12:53:27 +00:00
mod salsa_struct;
mod tracked;
mod tracked_fn;
mod tracked_struct;
2022-08-01 05:32:47 +00:00
#[proc_macro_attribute]
pub fn accumulator(args: TokenStream, input: TokenStream) -> TokenStream {
accumulator::accumulator(args, input)
}
#[proc_macro_attribute]
pub fn jar(args: TokenStream, input: TokenStream) -> TokenStream {
jar::jar(args, input)
}
#[proc_macro_attribute]
pub fn db(args: TokenStream, input: TokenStream) -> TokenStream {
db::db(args, input)
}
#[proc_macro_attribute]
pub fn interned(args: TokenStream, input: TokenStream) -> TokenStream {
interned::interned(args, input)
}
#[proc_macro_attribute]
pub fn input(args: TokenStream, input: TokenStream) -> TokenStream {
input::input(args, input)
}
#[proc_macro_attribute]
pub fn tracked(args: TokenStream, input: TokenStream) -> TokenStream {
tracked::tracked(args, input)
}