mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 14:25:18 +01:00
rename rtfm! to app! and adapt to changes in rtfm-syntax
This commit is contained in:
parent
98596554b3
commit
e9788ff9b6
4 changed files with 27 additions and 28 deletions
|
|
@ -6,21 +6,20 @@ extern crate error_chain;
|
|||
extern crate proc_macro;
|
||||
#[macro_use]
|
||||
extern crate quote;
|
||||
extern crate rtfm_syntax;
|
||||
extern crate rtfm_syntax as syntax;
|
||||
extern crate syn;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use rtfm_syntax::App;
|
||||
use syntax::App;
|
||||
|
||||
use error::*;
|
||||
use syntax::error::*;
|
||||
|
||||
mod analyze;
|
||||
mod check;
|
||||
mod error;
|
||||
mod trans;
|
||||
|
||||
#[proc_macro]
|
||||
pub fn rtfm(ts: TokenStream) -> TokenStream {
|
||||
pub fn app(ts: TokenStream) -> TokenStream {
|
||||
match run(ts) {
|
||||
Err(e) => panic!("{}", error_chain::ChainedError::display(&e)),
|
||||
Ok(ts) => ts,
|
||||
|
|
@ -30,10 +29,9 @@ pub fn rtfm(ts: TokenStream) -> TokenStream {
|
|||
fn run(ts: TokenStream) -> Result<TokenStream> {
|
||||
let input = format!("{}", ts);
|
||||
|
||||
let app = check::app(App::parse(&input)
|
||||
.chain_err(|| "parsing the `rtfm!` macro")?).chain_err(
|
||||
|| "checking the application specification",
|
||||
)?;
|
||||
let app = App::parse(&input).chain_err(|| "parsing")?;
|
||||
let app = syntax::check::app(app).chain_err(|| "checking the AST")?;
|
||||
let app = check::app(app)?;
|
||||
|
||||
let ownerships = analyze::app(&app);
|
||||
let tokens = trans::app(&app, &ownerships);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue