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-09-04 18:37:29 +00:00
|
|
|
use base::*;
|
2011-08-03 18:46:32 +00:00
|
|
|
|
2012-02-01 06:50:12 +00:00
|
|
|
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
|
2012-02-01 03:30:26 +00:00
|
|
|
_body: ast::mac_body) -> @ast::expr {
|
2012-07-14 05:57:48 +00:00
|
|
|
let args = get_mac_args_no_max(cx,sp,arg,1u,~"concat_idents");
|
2012-07-18 23:18:02 +00:00
|
|
|
let mut res_str = ~"";
|
2012-06-30 23:19:07 +00:00
|
|
|
for args.each |e| {
|
2012-07-18 23:18:02 +00:00
|
|
|
res_str += *cx.parse_sess().interner.get(
|
2012-09-19 23:55:01 +00:00
|
|
|
expr_to_ident(cx, *e, ~"expected an ident"));
|
2011-08-03 18:46:32 +00:00
|
|
|
}
|
2012-07-18 23:18:02 +00:00
|
|
|
let res = cx.parse_sess().interner.intern(@res_str);
|
2011-08-03 18:46:32 +00:00
|
|
|
|
2012-08-02 00:30:05 +00:00
|
|
|
return @{id: cx.next_id(),
|
2012-07-11 21:31:35 +00:00
|
|
|
callee_id: cx.next_id(),
|
2012-07-18 23:18:02 +00:00
|
|
|
node: ast::expr_path(@{span: sp, global: false, idents: ~[res],
|
2012-08-20 19:23:37 +00:00
|
|
|
rp: None, types: ~[]}),
|
2011-08-03 18:46:32 +00:00
|
|
|
span: sp};
|
2011-08-04 23:20:09 +00:00
|
|
|
}
|