2015-12-10 14:23:14 +00:00
|
|
|
use syntax::ext::base;
|
|
|
|
use syntax::feature_gate;
|
|
|
|
use syntax::print;
|
2016-06-20 15:49:33 +00:00
|
|
|
use syntax::tokenstream;
|
2016-06-21 22:08:13 +00:00
|
|
|
use syntax_pos;
|
2012-12-23 22:41:37 +00:00
|
|
|
|
2014-08-28 01:46:52 +00:00
|
|
|
pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
|
2016-06-21 22:08:13 +00:00
|
|
|
sp: syntax_pos::Span,
|
2016-06-20 15:49:33 +00:00
|
|
|
tts: &[tokenstream::TokenTree])
|
2018-07-12 09:58:16 +00:00
|
|
|
-> Box<dyn base::MacResult + 'cx> {
|
2015-02-15 22:49:55 +00:00
|
|
|
if !cx.ecfg.enable_log_syntax() {
|
2016-09-24 16:42:54 +00:00
|
|
|
feature_gate::emit_feature_err(&cx.parse_sess,
|
2015-02-15 22:49:55 +00:00
|
|
|
"log_syntax",
|
|
|
|
sp,
|
2015-09-04 23:37:22 +00:00
|
|
|
feature_gate::GateIssue::Language,
|
2015-02-15 22:49:55 +00:00
|
|
|
feature_gate::EXPLAIN_LOG_SYNTAX);
|
|
|
|
return base::DummyResult::any(sp);
|
|
|
|
}
|
2012-08-07 00:50:45 +00:00
|
|
|
|
2014-10-22 05:37:20 +00:00
|
|
|
println!("{}", print::pprust::tts_to_string(tts));
|
2011-08-08 21:17:33 +00:00
|
|
|
|
2014-03-18 12:14:08 +00:00
|
|
|
// any so that `log_syntax` can be invoked as an expression and item.
|
2014-04-15 12:00:14 +00:00
|
|
|
base::DummyResult::any(sp)
|
2011-08-12 14:15:18 +00:00
|
|
|
}
|