summary refs log tree commit diff
path: root/src/libsyntax/ext/concat_idents.rs
blob: 94b22d68ceabcaa78e157e8705c5c6adb409fdf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use base::*;

fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
                     _body: ast::mac_body) -> @ast::expr {
    let args = get_mac_args_no_max(cx,sp,arg,1u,~"concat_idents");
    let mut res_str = ~"";
    for args.each |e| {
        res_str += *cx.parse_sess().interner.get(
            expr_to_ident(cx, *e, ~"expected an ident"));
    }
    let res = cx.parse_sess().interner.intern(@res_str);

    return @{id: cx.next_id(),
          callee_id: cx.next_id(),
          node: ast::expr_path(@{span: sp, global: false, idents: ~[res],
                                 rp: None, types: ~[]}),
          span: sp};
}