From 154488df1999e4c42f96ebaa6ee6c08be3f999a6 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 22 Jan 2013 16:00:07 -0800 Subject: libsyntax: Implement `assert` as a macro (called `fail_unless!` on a transitionary basis to avoid conflicting with the keyword right now). r=brson --- src/libsyntax/parse/token.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/libsyntax/parse/token.rs') 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 => ~"", 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" + } } + } } } } -- cgit 1.4.1-3-g733a5