Implement anti-quotes.

This commit is contained in:
Kevin Atkinson 2012-01-27 01:50:57 -07:00
parent 477714f08e
commit 67e961c17f
3 changed files with 93 additions and 12 deletions

View file

@ -630,8 +630,19 @@ fn parse_seq<T: copy>(bra: token::token, ket: token::token,
fn have_dollar(p: parser) -> option::t<ast::mac_> {
alt p.token {
token::DOLLAR_NUM(num) {p.bump(); some(ast::mac_var(num))}
_ {none}
token::DOLLAR_NUM(num) {
p.bump();
some(ast::mac_var(num))
}
token::DOLLAR_LPAREN {
let lo = p.span.lo;
p.bump();
let e = parse_expr(p);
expect(p, token::RPAREN);
let hi = p.last_span.hi;
some(ast::mac_aq(ast_util::mk_sp(lo,hi), e))
}
_ {none}
}
}