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