diff options
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index e3788801293..2c090d053a3 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -138,32 +138,32 @@ impl fmt::Show for Nonterminal { pub fn binop_to_str(o: BinOp) -> String { match o { - PLUS => "+".to_strbuf(), - MINUS => "-".to_strbuf(), - STAR => "*".to_strbuf(), - SLASH => "/".to_strbuf(), - PERCENT => "%".to_strbuf(), - CARET => "^".to_strbuf(), - AND => "&".to_strbuf(), - OR => "|".to_strbuf(), - SHL => "<<".to_strbuf(), - SHR => ">>".to_strbuf() + PLUS => "+".to_string(), + MINUS => "-".to_string(), + STAR => "*".to_string(), + SLASH => "/".to_string(), + PERCENT => "%".to_string(), + CARET => "^".to_string(), + AND => "&".to_string(), + OR => "|".to_string(), + SHL => "<<".to_string(), + SHR => ">>".to_string() } } pub fn to_str(t: &Token) -> String { match *t { - EQ => "=".to_strbuf(), - LT => "<".to_strbuf(), - LE => "<=".to_strbuf(), - EQEQ => "==".to_strbuf(), - NE => "!=".to_strbuf(), - GE => ">=".to_strbuf(), - GT => ">".to_strbuf(), - NOT => "!".to_strbuf(), - TILDE => "~".to_strbuf(), - OROR => "||".to_strbuf(), - ANDAND => "&&".to_strbuf(), + EQ => "=".to_string(), + LT => "<".to_string(), + LE => "<=".to_string(), + EQEQ => "==".to_string(), + NE => "!=".to_string(), + GE => ">=".to_string(), + GT => ">".to_string(), + NOT => "!".to_string(), + TILDE => "~".to_string(), + OROR => "||".to_string(), + ANDAND => "&&".to_string(), BINOP(op) => binop_to_str(op), BINOPEQ(op) => { let mut s = binop_to_str(op); @@ -172,25 +172,25 @@ pub fn to_str(t: &Token) -> String { } /* Structural symbols */ - AT => "@".to_strbuf(), - DOT => ".".to_strbuf(), - DOTDOT => "..".to_strbuf(), - DOTDOTDOT => "...".to_strbuf(), - COMMA => ",".to_strbuf(), - SEMI => ";".to_strbuf(), - COLON => ":".to_strbuf(), - MOD_SEP => "::".to_strbuf(), - RARROW => "->".to_strbuf(), - LARROW => "<-".to_strbuf(), - FAT_ARROW => "=>".to_strbuf(), - LPAREN => "(".to_strbuf(), - RPAREN => ")".to_strbuf(), - LBRACKET => "[".to_strbuf(), - RBRACKET => "]".to_strbuf(), - LBRACE => "{".to_strbuf(), - RBRACE => "}".to_strbuf(), - POUND => "#".to_strbuf(), - DOLLAR => "$".to_strbuf(), + AT => "@".to_string(), + DOT => ".".to_string(), + DOTDOT => "..".to_string(), + DOTDOTDOT => "...".to_string(), + COMMA => ",".to_string(), + SEMI => ";".to_string(), + COLON => ":".to_string(), + MOD_SEP => "::".to_string(), + RARROW => "->".to_string(), + LARROW => "<-".to_string(), + FAT_ARROW => "=>".to_string(), + LPAREN => "(".to_string(), + RPAREN => ")".to_string(), + LBRACKET => "[".to_string(), + RBRACKET => "]".to_string(), + LBRACE => "{".to_string(), + RBRACE => "}".to_string(), + POUND => "#".to_string(), + DOLLAR => "$".to_string(), /* Literals */ LIT_CHAR(c) => { @@ -205,7 +205,7 @@ pub fn to_str(t: &Token) -> String { ast_util::ForceSuffix), LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u), ast_util::ForceSuffix), - LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() } + LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_string() } LIT_FLOAT(s, t) => { let mut body = String::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { @@ -222,29 +222,29 @@ pub fn to_str(t: &Token) -> String { body } LIT_STR(s) => { - (format!("\"{}\"", get_ident(s).get().escape_default())).to_strbuf() + (format!("\"{}\"", get_ident(s).get().escape_default())).to_string() } LIT_STR_RAW(s, n) => { (format!("r{delim}\"{string}\"{delim}", - delim="#".repeat(n), string=get_ident(s))).to_strbuf() + delim="#".repeat(n), string=get_ident(s))).to_string() } /* Name components */ - IDENT(s, _) => get_ident(s).get().to_strbuf(), + IDENT(s, _) => get_ident(s).get().to_string(), LIFETIME(s) => { - (format!("'{}", get_ident(s))).to_strbuf() + (format!("'{}", get_ident(s))).to_string() } - UNDERSCORE => "_".to_strbuf(), + UNDERSCORE => "_".to_string(), /* Other */ - DOC_COMMENT(s) => get_ident(s).get().to_strbuf(), - EOF => "<eof>".to_strbuf(), + DOC_COMMENT(s) => get_ident(s).get().to_string(), + EOF => "<eof>".to_string(), INTERPOLATED(ref nt) => { match nt { &NtExpr(e) => ::print::pprust::expr_to_str(e), &NtMeta(e) => ::print::pprust::meta_item_to_str(e), _ => { - let mut s = "an interpolated ".to_strbuf(); + let mut s = "an interpolated ".to_string(); match *nt { NtItem(..) => s.push_str("item"), NtBlock(..) => s.push_str("block"), |
