]> git.proxmox.com Git - rustc.git/blame - src/libsyntax/ext/log_syntax.rs
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / libsyntax / ext / log_syntax.rs
CommitLineData
223e47cc
LB
1// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
223e47cc
LB
11use ast;
12use codemap;
223e47cc 13use ext::base;
85aaf69f 14use feature_gate;
223e47cc 15use print;
970d7e83 16
1a4d82fc
JJ
17pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
18 sp: codemap::Span,
19 tts: &[ast::TokenTree])
20 -> Box<base::MacResult+'cx> {
85aaf69f
SL
21 if !cx.ecfg.enable_log_syntax() {
22 feature_gate::emit_feature_err(&cx.parse_sess.span_diagnostic,
23 "log_syntax",
24 sp,
e9174d1e 25 feature_gate::GateIssue::Language,
85aaf69f
SL
26 feature_gate::EXPLAIN_LOG_SYNTAX);
27 return base::DummyResult::any(sp);
28 }
223e47cc 29
1a4d82fc
JJ
30 println!("{}", print::pprust::tts_to_string(tts));
31
32 // any so that `log_syntax` can be invoked as an expression and item.
33 base::DummyResult::any(sp)
223e47cc 34}