2011-08-03 13:46:32 -05:00
|
|
|
import std::option;
|
|
|
|
import base::*;
|
|
|
|
import syntax::ast;
|
|
|
|
|
|
|
|
fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
|
2011-08-18 03:01:39 -05:00
|
|
|
_body: option::t<str>) -> @ast::expr {
|
2011-08-04 18:20:09 -05:00
|
|
|
let args: [@ast::expr] = alt arg.node {
|
2011-08-18 13:37:19 -05:00
|
|
|
ast::expr_vec(elts, _) { elts }
|
2011-08-03 13:46:32 -05:00
|
|
|
_ { cx.span_fatal(sp, "#concat_idents requires a vector argument .") }
|
|
|
|
};
|
|
|
|
let res: ast::ident = "";
|
|
|
|
for e: @ast::expr in args {
|
|
|
|
res += expr_to_ident(cx, e, "expected an ident");
|
|
|
|
}
|
|
|
|
|
|
|
|
ret @{id: cx.next_id(),
|
|
|
|
node: ast::expr_path( {
|
|
|
|
node: {global: false, idents: ~[res], types: ~[]},
|
|
|
|
span: sp}),
|
|
|
|
span: sp};
|
2011-08-04 18:20:09 -05:00
|
|
|
}
|