diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-22 16:00:07 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-23 14:46:24 -0800 |
| commit | 154488df1999e4c42f96ebaa6ee6c08be3f999a6 (patch) | |
| tree | a40399560573d6d8709fceae1bc2ffcc2df230c8 /src/libsyntax/parse | |
| parent | 54b2cad8b341434c7c0edb153a0fa662fb2981f1 (diff) | |
| download | rust-154488df1999e4c42f96ebaa6ee6c08be3f999a6.tar.gz rust-154488df1999e4c42f96ebaa6ee6c08be3f999a6.zip | |
libsyntax: Implement `assert` as a macro (called `fail_unless!` on a transitionary basis to avoid conflicting with the keyword right now). r=brson
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 93c03063623..2136499f8f0 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -200,19 +200,24 @@ fn to_str(in: @ident_interner, t: Token) -> ~str { DOC_COMMENT(s) => *in.get(s), EOF => ~"<eof>", INTERPOLATED(ref nt) => { - ~"an interpolated " + - match (*nt) { - nt_item(*) => ~"item", - nt_block(*) => ~"block", - nt_stmt(*) => ~"statement", - nt_pat(*) => ~"pattern", - nt_expr(*) => ~"expression", - nt_ty(*) => ~"type", - nt_ident(*) => ~"identifier", - nt_path(*) => ~"path", - nt_tt(*) => ~"tt", - nt_matchers(*) => ~"matcher sequence" + match nt { + &nt_expr(e) => ::print::pprust::expr_to_str(e, in), + _ => { + ~"an interpolated " + + match (*nt) { + nt_item(*) => ~"item", + nt_block(*) => ~"block", + nt_stmt(*) => ~"statement", + nt_pat(*) => ~"pattern", + nt_expr(*) => fail ~"should have been handled above", + nt_ty(*) => ~"type", + nt_ident(*) => ~"identifier", + nt_path(*) => ~"path", + nt_tt(*) => ~"tt", + nt_matchers(*) => ~"matcher sequence" + } } + } } } } |
