diff options
| author | bors <bors@rust-lang.org> | 2013-10-07 23:01:39 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-10-07 23:01:39 -0700 |
| commit | c9196290af3934481bd413e11057725f248fd104 (patch) | |
| tree | 64e4d5fed93cfedb791ac3abddb9cc703d337f75 /src/libsyntax/parse/token.rs | |
| parent | 6ddd011ce8875c6c5b119e5a8957a51d524a95da (diff) | |
| parent | d7dfe0ae34eb9a818dcbdb5646e21e721ffb3c33 (diff) | |
| download | rust-c9196290af3934481bd413e11057725f248fd104.tar.gz rust-c9196290af3934481bd413e11057725f248fd104.zip | |
auto merge of #9674 : ben0x539/rust/raw-str, r=alexcrichton
This branch parses raw string literals as in #9411.
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index d0faf917688..ba4c2637d10 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -79,6 +79,7 @@ pub enum Token { LIT_FLOAT(ast::Ident, ast::float_ty), LIT_FLOAT_UNSUFFIXED(ast::Ident), LIT_STR(ast::Ident), + LIT_STR_RAW(ast::Ident, uint), /* raw str delimited by n hash symbols */ /* Name components */ // an identifier contains an "is_mod_name" boolean, @@ -194,6 +195,10 @@ pub fn to_str(input: @ident_interner, t: &Token) -> ~str { body } LIT_STR(ref s) => { format!("\"{}\"", ident_to_str(s).escape_default()) } + LIT_STR_RAW(ref s, n) => { + format!("r{delim}\"{string}\"{delim}", + delim="#".repeat(n), string=ident_to_str(s)) + } /* Name components */ IDENT(s, _) => input.get(s.name).to_owned(), @@ -243,6 +248,7 @@ pub fn can_begin_expr(t: &Token) -> bool { LIT_FLOAT(_, _) => true, LIT_FLOAT_UNSUFFIXED(_) => true, LIT_STR(_) => true, + LIT_STR_RAW(_, _) => true, POUND => true, AT => true, NOT => true, @@ -284,6 +290,7 @@ pub fn is_lit(t: &Token) -> bool { LIT_FLOAT(_, _) => true, LIT_FLOAT_UNSUFFIXED(_) => true, LIT_STR(_) => true, + LIT_STR_RAW(_, _) => true, _ => false } } |
