2012-12-04 00:48:01 +00:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-12-23 22:41:37 +00:00
|
|
|
use ast;
|
|
|
|
use codemap;
|
|
|
|
use ext::base;
|
2015-02-15 22:49:55 +00:00
|
|
|
use feature_gate;
|
2012-12-23 22:41:37 +00:00
|
|
|
use print;
|
|
|
|
|
2014-08-28 01:46:52 +00:00
|
|
|
pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
|
|
|
|
sp: codemap::Span,
|
2014-10-22 05:37:20 +00:00
|
|
|
tts: &[ast::TokenTree])
|
2014-08-28 01:46:52 +00:00
|
|
|
-> Box<base::MacResult+'cx> {
|
2015-02-15 22:49:55 +00:00
|
|
|
if !cx.ecfg.enable_log_syntax() {
|
|
|
|
feature_gate::emit_feature_err(&cx.parse_sess.span_diagnostic,
|
|
|
|
"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
|
|
|
}
|