2019-10-16 03:59:30 -05:00
|
|
|
#![feature(crate_visibility_modifier)]
|
2019-10-18 16:54:17 -05:00
|
|
|
#![feature(decl_macro)]
|
2019-10-16 03:59:30 -05:00
|
|
|
#![feature(proc_macro_diagnostic)]
|
|
|
|
#![feature(proc_macro_internals)]
|
|
|
|
#![feature(proc_macro_span)]
|
|
|
|
|
|
|
|
extern crate proc_macro as pm;
|
|
|
|
|
|
|
|
// A variant of 'try!' that panics on an Err. This is used as a crutch on the
|
|
|
|
// way towards a non-panic!-prone parser. It should be used for fatal parsing
|
|
|
|
// errors; eventually we plan to convert all code using panictry to just use
|
|
|
|
// normal try.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! panictry {
|
2019-12-22 16:42:04 -06:00
|
|
|
($e:expr) => {{
|
2019-10-16 03:59:30 -05:00
|
|
|
use errors::FatalError;
|
2019-12-22 16:42:04 -06:00
|
|
|
use std::result::Result::{Err, Ok};
|
2019-10-16 03:59:30 -05:00
|
|
|
match $e {
|
|
|
|
Ok(e) => e,
|
|
|
|
Err(mut e) => {
|
|
|
|
e.emit();
|
|
|
|
FatalError.raise()
|
|
|
|
}
|
|
|
|
}
|
2019-12-22 16:42:04 -06:00
|
|
|
}};
|
2019-10-16 03:59:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod placeholders;
|
|
|
|
mod proc_macro_server;
|
|
|
|
|
|
|
|
pub use mbe::macro_rules::compile_declarative_macro;
|
2019-12-31 11:15:40 -06:00
|
|
|
crate use rustc_span::hygiene;
|
2019-10-16 03:59:30 -05:00
|
|
|
pub mod base;
|
|
|
|
pub mod build;
|
|
|
|
pub mod expand;
|
2019-11-19 20:35:11 -06:00
|
|
|
pub use rustc_parse::config;
|
2019-10-16 03:59:30 -05:00
|
|
|
pub mod proc_macro;
|
|
|
|
|
|
|
|
crate mod mbe;
|
2019-10-10 03:26:10 -05:00
|
|
|
|
|
|
|
// HACK(Centril, #64197): These shouldn't really be here.
|
|
|
|
// Rather, they should be with their respective modules which are defined in other crates.
|
|
|
|
// However, since for now constructing a `ParseSess` sorta requires `config` from this crate,
|
|
|
|
// these tests will need to live here in the iterim.
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
#[cfg(test)]
|
|
|
|
mod parse {
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
#[cfg(test)]
|
|
|
|
mod lexer {
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tokenstream {
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
}
|
|
|
|
#[cfg(test)]
|
|
|
|
mod mut_visit {
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
}
|