Add #env syntax extension for plucking strings out of the compilation environment.

This commit is contained in:
Graydon Hoare
2011-05-04 19:05:16 -07:00
parent a7db032725
commit d55fa2a9a3
3 changed files with 76 additions and 0 deletions

View File

@@ -948,6 +948,13 @@ fn expand_syntax_ext(parser p, ast.span sp,
expanded,
ast.ann_none);
ret newexpr;
} else if (_str.eq(extname, "env")) {
auto expanded = extenv.expand_syntax_ext(p, sp, args, body);
auto newexpr = ast.expr_ext(path, args, body,
expanded,
ast.ann_none);
ret newexpr;
} else {
p.err("unknown syntax extension");