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