From 97878725532c4d1dd1af07e88175462178d78cdb Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Wed, 2 Oct 2013 03:32:29 +0200 Subject: add token::LIT_STR_RAW(ident, num of # symbols) Treat it as a synonym for LIT_STR for now. --- src/libsyntax/ext/base.rs | 3 ++- src/libsyntax/ext/quote.rs | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 3b4be1de3e8..5a3c3a86fed 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -437,7 +437,8 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt, } match tts[0] { - ast::tt_tok(_, token::LIT_STR(ident)) => cx.str_of(ident), + ast::tt_tok(_, token::LIT_STR(ident)) + | ast::tt_tok(_, token::LIT_STR_RAW(ident, _)) => cx.str_of(ident), _ => cx.span_fatal(sp, format!("{} requires a string.", name)), } } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index bfd1e9cc994..59d55933fa3 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -464,6 +464,13 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { ~[mk_ident(cx, sp, ident)]); } + LIT_STR_RAW(ident, n) => { + return cx.expr_call_ident(sp, + id_ext("LIT_STR_RAW"), + ~[mk_ident(cx, sp, ident), + cx.expr_uint(sp, n)]); + } + IDENT(ident, b) => { return cx.expr_call_ident(sp, id_ext("IDENT"), -- cgit 1.4.1-3-g733a5