summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2012-07-13 22:57:48 -0700
committerMichael Sullivan <sully@msully.net>2012-07-14 01:03:43 -0700
commit92743dc2a6a14d042d4b278e4a4dde5ca198c886 (patch)
tree2626211c99906387257880f127f96fee66a0bb4e /src/libsyntax/ext/tt
parent5c5065e8bdd1a7b28810fea4b940577ff17c112c (diff)
downloadrust-92743dc2a6a14d042d4b278e4a4dde5ca198c886.tar.gz
rust-92743dc2a6a14d042d4b278e4a4dde5ca198c886.zip
Move the world over to using the new style string literals and types. Closes #2907.
Diffstat (limited to 'src/libsyntax/ext/tt')
-rw-r--r--src/libsyntax/ext/tt/earley_parser.rs40
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs18
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs10
3 files changed, 34 insertions, 34 deletions
diff --git a/src/libsyntax/ext/tt/earley_parser.rs b/src/libsyntax/ext/tt/earley_parser.rs
index f830330e182..3f604aafb3d 100644
--- a/src/libsyntax/ext/tt/earley_parser.rs
+++ b/src/libsyntax/ext/tt/earley_parser.rs
@@ -83,7 +83,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@arb_depth])
           }
           {node: mtc_bb(bind_name, _, idx), span: sp} {
             if ret_val.contains_key(bind_name) {
-                p_s.span_diagnostic.span_fatal(sp, "Duplicated bind name: "
+                p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "
                                                + *bind_name)
             }
             ret_val.insert(bind_name, res[idx]);
@@ -97,7 +97,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@arb_depth])
 
 enum parse_result {
     success(hashmap<ident, @arb_depth>),
-    failure(codemap::span, str)
+    failure(codemap::span, ~str)
 }
 
 fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
@@ -207,9 +207,9 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                     nameize(sess, ms,
                             vec::map(eof_eis[0u].matches, |dv| dv.pop())));
             } else if eof_eis.len() > 1u {
-                ret failure(sp, "Ambiguity: multiple successful parses");
+                ret failure(sp, ~"Ambiguity: multiple successful parses");
             } else {
-                ret failure(sp, "Unexpected end of macro invocation");
+                ret failure(sp, ~"Unexpected end of macro invocation");
             }
         } else {
             if (bb_eis.len() > 0u && next_eis.len() > 0u)
@@ -217,13 +217,13 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                 let nts = str::connect(vec::map(bb_eis, |ei| {
                     alt ei.elts[ei.idx].node
                         { mtc_bb(_,name,_) { *name } _ { fail; } }
-                }), " or ");
+                }), ~" or ");
                 ret failure(sp, #fmt[
                     "Local ambiguity: multiple parsing options: \
                      built-in NTs %s or %u other options.",
                     nts, next_eis.len()]);
             } else if (bb_eis.len() == 0u && next_eis.len() == 0u) {
-                ret failure(sp, "No rules expected the token "
+                ret failure(sp, ~"No rules expected the token "
                             + to_str(*rdr.interner(), tok));
             } else if (next_eis.len() > 0u) {
                 /* Now process the next token */
@@ -259,32 +259,32 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
     }
 }
 
-fn parse_nt(p: parser, name: str) -> whole_nt {
+fn parse_nt(p: parser, name: ~str) -> whole_nt {
     alt name {
-      "item" { alt p.parse_item(~[], ast::public) {
+      ~"item" { alt p.parse_item(~[], ast::public) {
         some(i) { token::w_item(i) }
-        none { p.fatal("expected an item keyword") }
+        none { p.fatal(~"expected an item keyword") }
       }}
-      "block" { token::w_block(p.parse_block()) }
-      "stmt" { token::w_stmt(p.parse_stmt(~[])) }
-      "pat" { token::w_pat(p.parse_pat()) }
-      "expr" { token::w_expr(p.parse_expr()) }
-      "ty" { token::w_ty(p.parse_ty(false /* no need to disambiguate*/)) }
+      ~"block" { token::w_block(p.parse_block()) }
+      ~"stmt" { token::w_stmt(p.parse_stmt(~[])) }
+      ~"pat" { token::w_pat(p.parse_pat()) }
+      ~"expr" { token::w_expr(p.parse_expr()) }
+      ~"ty" { token::w_ty(p.parse_ty(false /* no need to disambiguate*/)) }
       // this could be handled like a token, since it is one
-      "ident" { alt copy p.token {
+      ~"ident" { alt copy p.token {
           token::IDENT(sn,b) { p.bump(); token::w_ident(sn,b) }
-          _ { p.fatal("expected ident, found "
+          _ { p.fatal(~"expected ident, found "
                       + token::to_str(*p.reader.interner(), copy p.token)) }
       } }
-      "path" { token::w_path(p.parse_path_with_tps(false)) }
-      "tt" {
+      ~"path" { token::w_path(p.parse_path_with_tps(false)) }
+      ~"tt" {
         p.quote_depth += 1u; //but in theory, non-quoted tts might be useful
         let res = token::w_tt(@p.parse_token_tree());
         p.quote_depth -= 1u;
         res
       }
-      "mtcs" { token::w_mtcs(p.parse_matchers()) }
-      _ { p.fatal("Unsupported builtin nonterminal parser: " + name)}
+      ~"mtcs" { token::w_mtcs(p.parse_matchers()) }
+      _ { p.fatal(~"Unsupported builtin nonterminal parser: " + name)}
     }
 }
 
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index b454dcfc0be..7bed3107f53 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -18,9 +18,9 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
 
     let argument_gram = ~[
         ms(mtc_rep(~[
-            ms(mtc_bb(@"lhs"/~,@"mtcs"/~, 0u)),
+            ms(mtc_bb(@~"lhs",@~"mtcs", 0u)),
             ms(mtc_tok(FAT_ARROW)),
-            ms(mtc_bb(@"rhs"/~,@"tt"/~, 1u)),
+            ms(mtc_bb(@~"rhs",@~"tt", 1u)),
         ], some(SEMI), false))];
 
     let arg_reader = new_tt_reader(cx.parse_sess().span_diagnostic,
@@ -31,20 +31,20 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
       failure(sp, msg) { cx.span_fatal(sp, msg); }
     };
 
-    let lhses = alt arguments.get(@"lhs"/~) {
+    let lhses = alt arguments.get(@~"lhs") {
       @seq(s, sp) { s }
-      _ { cx.span_bug(sp, "wrong-structured lhs") }
+      _ { cx.span_bug(sp, ~"wrong-structured lhs") }
     };
-    let rhses = alt arguments.get(@"rhs"/~) {
+    let rhses = alt arguments.get(@~"rhs") {
       @seq(s, sp) { s }
-      _ { cx.span_bug(sp, "wrong-structured rhs") }
+      _ { cx.span_bug(sp, ~"wrong-structured rhs") }
     };
 
     fn generic_extension(cx: ext_ctxt, sp: span, arg: ~[ast::token_tree],
                          lhses: ~[@arb_depth], rhses: ~[@arb_depth])
     -> mac_result {
         let mut best_fail_spot = {lo: 0u, hi: 0u, expn_info: none};
-        let mut best_fail_msg = "internal error: ran no matchers";
+        let mut best_fail_msg = ~"internal error: ran no matchers";
 
         let s_d = cx.parse_sess().span_diagnostic;
         let itr = cx.parse_sess().interner;
@@ -57,7 +57,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                   success(m) {
                     let rhs = alt rhses[i] {
                       @leaf(w_tt(@tt)) { tt }
-                      _ { cx.span_bug(sp, "bad thing in rhs") }
+                      _ { cx.span_bug(sp, ~"bad thing in rhs") }
                     };
                     let trncbr = new_tt_reader(s_d, itr, some(m), ~[rhs]);
                     let p = parser(cx.parse_sess(), cx.cfg(),
@@ -71,7 +71,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                   }
                 }
               }
-              _ { cx.bug("non-matcher found in parsed lhses"); }
+              _ { cx.bug(~"non-matcher found in parsed lhses"); }
             }
         }
         cx.span_fatal(best_fail_spot, best_fail_msg);
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index df0c39bb266..a9bc124b605 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -25,7 +25,7 @@ type tt_frame = @{
 
 type tt_reader = @{
     sp_diag: span_handler,
-    interner: @interner<@str/~>,
+    interner: @interner<@~str>,
     mut cur: tt_frame,
     /* for MBE-style macro transcription */
     interpolations: std::map::hashmap<ident, @arb_depth>,
@@ -39,7 +39,7 @@ type tt_reader = @{
 /** This can do Macro-By-Example transcription. On the other hand, if
  *  `src` contains no `tt_dotdotdot`s and `tt_interpolate`s, `interp` can (and
  *  should) be none. */
-fn new_tt_reader(sp_diag: span_handler, itr: @interner<@str/~>,
+fn new_tt_reader(sp_diag: span_handler, itr: @interner<@~str>,
                  interp: option<std::map::hashmap<ident,@arb_depth>>,
                  src: ~[ast::token_tree])
     -> tt_reader {
@@ -93,7 +93,7 @@ fn lookup_cur_ad(r: tt_reader, name: ident) -> @arb_depth {
     lookup_cur_ad_by_ad(r, r.interpolations.get(name))
 }
 enum lis {
-    lis_unconstrained, lis_constraint(uint, ident), lis_contradiction(str)
+    lis_unconstrained, lis_constraint(uint, ident), lis_contradiction(~str)
 }
 
 fn lockstep_iter_size(&&t: token_tree, &&r: tt_reader) -> lis {
@@ -183,7 +183,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
               lis_unconstrained {
                 r.sp_diag.span_fatal(
                     sp, /* blame macro writer */
-                    "attempted to repeat an expression containing no syntax \
+                    ~"attempted to repeat an expression containing no syntax \
                      variables matched as repeating at this depth");
               }
               lis_contradiction(msg) { /* FIXME #2887 blame macro invoker
@@ -200,7 +200,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
                     if !zerok {
                         r.sp_diag.span_fatal(sp, /* FIXME #2887 blame invoker
                                                   */
-                                             "this must repeat at least \
+                                             ~"this must repeat at least \
                                               once");
                     }
                     /* we need to pop before we proceed, so recur */