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