2017-07-07 06:25:29 +02:00
|
|
|
#![deny(warnings)]
|
2017-07-12 06:44:54 +02:00
|
|
|
#![feature(proc_macro)]
|
2017-07-04 18:26:11 +02:00
|
|
|
#![recursion_limit = "128"]
|
|
|
|
|
|
|
|
extern crate proc_macro;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate quote;
|
|
|
|
extern crate syn;
|
|
|
|
|
|
|
|
mod check;
|
|
|
|
mod syntax;
|
|
|
|
mod trans;
|
|
|
|
mod util;
|
|
|
|
|
2017-07-12 06:44:54 +02:00
|
|
|
use proc_macro::TokenStream;
|
|
|
|
|
|
|
|
#[proc_macro]
|
|
|
|
pub fn rtfm(ts: TokenStream) -> TokenStream {
|
2017-07-04 18:26:11 +02:00
|
|
|
let input = format!("{}", ts);
|
|
|
|
|
|
|
|
let app = syntax::parse::app(&input);
|
|
|
|
let ceilings = util::compute_ceilings(&app);
|
|
|
|
check::resources(&app.resources, &ceilings);
|
|
|
|
|
2017-07-12 06:44:54 +02:00
|
|
|
format!("{}", trans::app(&app, &ceilings)).parse().unwrap()
|
2017-07-04 18:26:11 +02:00
|
|
|
}
|