@@ -79,6 +79,7 @@ pub enum Token {
79
79
LIT_FLOAT ( ast:: Ident , ast:: float_ty ) ,
80
80
LIT_FLOAT_UNSUFFIXED ( ast:: Ident ) ,
81
81
LIT_STR ( ast:: Ident ) ,
82
+ LIT_STR_RAW ( ast:: Ident , uint ) , /* raw str delimited by n hash symbols */
82
83
83
84
/* Name components */
84
85
// an identifier contains an "is_mod_name" boolean,
@@ -194,6 +195,10 @@ pub fn to_str(input: @ident_interner, t: &Token) -> ~str {
194
195
body
195
196
}
196
197
LIT_STR ( ref s) => { format ! ( "\" {}\" " , ident_to_str( s) . escape_default( ) ) }
198
+ LIT_STR_RAW ( ref s, n) => {
199
+ format ! ( "r{delim}\" {string}\" {delim}" ,
200
+ delim="#" . repeat( n) , string=ident_to_str( s) )
201
+ }
197
202
198
203
/* Name components */
199
204
IDENT ( s, _) => input. get ( s. name ) . to_owned ( ) ,
@@ -243,6 +248,7 @@ pub fn can_begin_expr(t: &Token) -> bool {
243
248
LIT_FLOAT ( _, _) => true ,
244
249
LIT_FLOAT_UNSUFFIXED ( _) => true ,
245
250
LIT_STR ( _) => true ,
251
+ LIT_STR_RAW ( _, _) => true ,
246
252
POUND => true ,
247
253
AT => true ,
248
254
NOT => true ,
@@ -284,6 +290,7 @@ pub fn is_lit(t: &Token) -> bool {
284
290
LIT_FLOAT ( _, _) => true ,
285
291
LIT_FLOAT_UNSUFFIXED ( _) => true ,
286
292
LIT_STR ( _) => true ,
293
+ LIT_STR_RAW ( _, _) => true ,
287
294
_ => false
288
295
}
289
296
}
0 commit comments