]> git.lizzy.rs Git - rust.git/blob - src/libsyntax_ext/log_syntax.rs
Auto merge of #38867 - alexcrichton:ignore-test-on-windows, r=brson
[rust.git] / src / libsyntax_ext / log_syntax.rs
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
11 use syntax::ext::base;
12 use syntax::feature_gate;
13 use syntax::print;
14 use syntax::tokenstream;
15 use syntax_pos;
16
17 pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
18                               sp: syntax_pos::Span,
19                               tts: &[tokenstream::TokenTree])
20                               -> Box<base::MacResult + 'cx> {
21     if !cx.ecfg.enable_log_syntax() {
22         feature_gate::emit_feature_err(&cx.parse_sess,
23                                        "log_syntax",
24                                        sp,
25                                        feature_gate::GateIssue::Language,
26                                        feature_gate::EXPLAIN_LOG_SYNTAX);
27         return base::DummyResult::any(sp);
28     }
29
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)
34 }