syntax: don't process string/char/byte/binary lits
This shuffles things around a bit so that LIT_CHAR and co store an Ident
which is the original, unaltered literal in the source. When creating the AST,
unescape and postprocess them.
This changes how syntax extensions can work, slightly, but otherwise poses no
visible changes. To get a useful value out of one of these tokens, call
`parse::{char_lit, byte_lit, bin_lit, str_lit}`
[breaking-change]
This commit is contained in:
@@ -579,9 +579,9 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
|
||||
cx.span_err(sp, format!("{} takes 1 argument.", name).as_slice());
|
||||
} else {
|
||||
match tts[0] {
|
||||
ast::TTTok(_, token::LIT_STR(ident))
|
||||
| ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => {
|
||||
return Some(token::get_ident(ident).get().to_string())
|
||||
ast::TTTok(_, token::LIT_STR(ident)) => return Some(parse::str_lit(ident.as_str())),
|
||||
ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => {
|
||||
return Some(parse::raw_str_lit(ident.as_str()))
|
||||
}
|
||||
_ => {
|
||||
cx.span_err(sp,
|
||||
|
||||
Reference in New Issue
Block a user