about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-26 18:48:08 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-27 15:54:45 -0700
commitf09ef6ec66b0a204c52cc67a6c91a69da65a5407 (patch)
treee7cbbe4ccf72c51d25b05be37b1218b6bdbeecbf /src/comp/syntax
parentf603e912ee55c92a40a4b4ea22f20c545b72804f (diff)
downloadrust-f09ef6ec66b0a204c52cc67a6c91a69da65a5407.tar.gz
rust-f09ef6ec66b0a204c52cc67a6c91a69da65a5407.zip
Convert rest of the AST to istrs. Issue #855
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/ast.rs12
-rw-r--r--src/comp/syntax/ext/base.rs6
-rw-r--r--src/comp/syntax/ext/concat_idents.rs2
-rw-r--r--src/comp/syntax/ext/env.rs4
-rw-r--r--src/comp/syntax/ext/fmt.rs4
-rw-r--r--src/comp/syntax/ext/ident_to_str.rs6
-rw-r--r--src/comp/syntax/ext/log_syntax.rs2
-rw-r--r--src/comp/syntax/ext/simplext.rs5
-rw-r--r--src/comp/syntax/parse/parser.rs16
-rw-r--r--src/comp/syntax/print/pprust.rs16
10 files changed, 41 insertions, 32 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
index edbc1f829fc..44ed863351e 100644
--- a/src/comp/syntax/ast.rs
+++ b/src/comp/syntax/ast.rs
@@ -237,7 +237,7 @@ tag blk_sort {
 type mac = spanned<mac_>;
 
 tag mac_ {
-    mac_invoc(path, @expr, option::t<str>);
+    mac_invoc(path, @expr, option::t<istr>);
     mac_embed_type(@ty);
     mac_embed_block(blk);
     mac_ellipsis;
@@ -246,13 +246,13 @@ tag mac_ {
 type lit = spanned<lit_>;
 
 tag lit_ {
-    lit_str(str, seq_kind);
+    lit_str(istr, seq_kind);
     lit_char(char);
     lit_int(int);
     lit_uint(uint);
     lit_mach_int(ty_mach, int);
-    lit_float(str);
-    lit_mach_float(ty_mach, str);
+    lit_float(istr);
+    lit_mach_float(ty_mach, istr);
     lit_nil;
     lit_bool(bool);
 }
@@ -421,7 +421,7 @@ tag native_abi {
 }
 
 type native_mod =
-    {native_name: str,
+    {native_name: istr,
      abi: native_abi,
      view_items: [@view_item],
      items: [@native_item]};
@@ -494,7 +494,7 @@ type native_item =
 
 tag native_item_ {
     native_item_ty;
-    native_item_fn(option::t<str>, fn_decl, [ty_param]);
+    native_item_fn(option::t<istr>, fn_decl, [ty_param]);
 }
 
 //
diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs
index a354aa67090..d9cdb54ad30 100644
--- a/src/comp/syntax/ext/base.rs
+++ b/src/comp/syntax/ext/base.rs
@@ -8,10 +8,10 @@ import std::map::new_str_hash;
 import codemap;
 
 type syntax_expander =
-    fn(&ext_ctxt, span, @ast::expr, option::t<str>) -> @ast::expr;
+    fn(&ext_ctxt, span, @ast::expr, &option::t<istr>) -> @ast::expr;
 type macro_def = {ident: str, ext: syntax_extension};
 type macro_definer =
-    fn(&ext_ctxt, span, @ast::expr, option::t<str>) -> macro_def;
+    fn(&ext_ctxt, span, @ast::expr, &option::t<istr>) -> macro_def;
 
 tag syntax_extension {
     normal(syntax_expander);
@@ -100,7 +100,7 @@ fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: str) -> str {
     alt expr.node {
       ast::expr_lit(l) {
         alt l.node {
-          ast::lit_str(s, _) { ret s; }
+          ast::lit_str(s, _) { ret istr::to_estr(s); }
           _ { cx.span_fatal(l.span, error); }
         }
       }
diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs
index 0b88d09ec4d..0ac2ef0debe 100644
--- a/src/comp/syntax/ext/concat_idents.rs
+++ b/src/comp/syntax/ext/concat_idents.rs
@@ -3,7 +3,7 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: option::t<str>) -> @ast::expr {
+                     _body: &option::t<istr>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs
index 75fca2398eb..f2cd093edae 100644
--- a/src/comp/syntax/ext/env.rs
+++ b/src/comp/syntax/ext/env.rs
@@ -12,7 +12,7 @@ import base::*;
 export expand_syntax_ext;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: option::t<str>) -> @ast::expr {
+                     _body: &option::t<istr>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
@@ -36,7 +36,7 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
 }
 
 fn make_new_str(cx: &ext_ctxt, sp: codemap::span, s: str) -> @ast::expr {
-    ret make_new_lit(cx, sp, ast::lit_str(s, ast::sk_rc));
+    ret make_new_lit(cx, sp, ast::lit_str(istr::from_estr(s), ast::sk_rc));
 }
 //
 // Local Variables:
diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs
index 2a441341f49..2173cfba40f 100644
--- a/src/comp/syntax/ext/fmt.rs
+++ b/src/comp/syntax/ext/fmt.rs
@@ -17,7 +17,7 @@ import codemap::span;
 export expand_syntax_ext;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr,
-                     _body: option::t<str>) -> @ast::expr {
+                     _body: &option::t<istr>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
@@ -52,7 +52,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
         ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp};
     }
     fn make_new_str(cx: &ext_ctxt, sp: span, s: str) -> @ast::expr {
-        let lit = ast::lit_str(s, ast::sk_rc);
+        let lit = ast::lit_str(istr::from_estr(s), ast::sk_rc);
         ret make_new_lit(cx, sp, lit);
     }
     fn make_new_int(cx: &ext_ctxt, sp: span, i: int) -> @ast::expr {
diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs
index 0664987e530..ec176dd2fa3 100644
--- a/src/comp/syntax/ext/ident_to_str.rs
+++ b/src/comp/syntax/ext/ident_to_str.rs
@@ -5,7 +5,7 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: option::t<str>) -> @ast::expr {
+                     _body: &option::t<istr>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
@@ -18,8 +18,8 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
     }
 
     ret make_new_lit(cx, sp,
-                     ast::lit_str(istr::to_estr(expr_to_ident(cx, args[0u],
-                                                "expected an ident")),
+                     ast::lit_str(expr_to_ident(cx, args[0u],
+                                                "expected an ident"),
                                   ast::sk_rc));
 
 }
diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs
index 3cf240097dc..3cab1dbd915 100644
--- a/src/comp/syntax/ext/log_syntax.rs
+++ b/src/comp/syntax/ext/log_syntax.rs
@@ -4,7 +4,7 @@ import syntax::ast;
 import std::istr;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: option::t<str>) -> @ast::expr {
+                     _body: &option::t<istr>) -> @ast::expr {
 
     cx.print_backtrace();
     std::io::stdout().write_line(
diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs
index 55f54c3057c..eca20e2225e 100644
--- a/src/comp/syntax/ext/simplext.rs
+++ b/src/comp/syntax/ext/simplext.rs
@@ -688,7 +688,7 @@ fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], _repeat_after: bool,
 }
 
 fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
-                     _body: option::t<str>) -> base::macro_def {
+                     _body: &option::t<istr>) -> base::macro_def {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
@@ -768,7 +768,8 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
          ext: normal(ext)};
 
     fn generic_extension(cx: &ext_ctxt, sp: span, arg: @expr,
-                         _body: option::t<str>, clauses: [@clause]) -> @expr {
+                         _body: &option::t<istr>,
+                         clauses: [@clause]) -> @expr {
         for c: @clause in clauses {
             alt use_selectors_to_bind(c.params, arg) {
               some(bindings) { ret transcribe(cx, bindings, c.body) }
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 85f809ef965..ce3b917118e 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -696,7 +696,7 @@ fn parse_lit(p: &parser) -> ast::lit {
           token::LIT_UINT(u) { p.bump(); lit = ast::lit_uint(u); }
           token::LIT_FLOAT(s) {
             p.bump();
-            lit = ast::lit_float(p.get_str(s));
+            lit = ast::lit_float(istr::from_estr(p.get_str(s)));
           }
           token::LIT_MACH_INT(tm, i) {
             p.bump();
@@ -704,12 +704,12 @@ fn parse_lit(p: &parser) -> ast::lit {
           }
           token::LIT_MACH_FLOAT(tm, s) {
             p.bump();
-            lit = ast::lit_mach_float(tm, p.get_str(s));
+            lit = ast::lit_mach_float(tm, istr::from_estr(p.get_str(s)));
           }
           token::LIT_CHAR(c) { p.bump(); lit = ast::lit_char(c); }
           token::LIT_STR(s) {
             p.bump();
-            lit = ast::lit_str(p.get_str(s), ast::sk_rc);
+            lit = ast::lit_str(istr::from_estr(p.get_str(s)), ast::sk_rc);
           }
           token::LPAREN. {
             p.bump();
@@ -896,7 +896,8 @@ fn parse_bottom_expr(p: &parser) -> @ast::expr {
             let sp = p.get_span();
             p.bump();
             let lit =
-                @{node: ast::lit_str(p.get_str(s), ast::sk_unique),
+                @{node: ast::lit_str(istr::from_estr(p.get_str(s)),
+                                     ast::sk_unique),
                   span: sp};
             ex = ast::expr_lit(lit);
           }
@@ -1971,7 +1972,10 @@ fn parse_item_native_fn(p: &parser, attrs: &[ast::attribute]) ->
     let t = parse_fn_header(p);
     let decl = parse_fn_decl(p, ast::impure_fn, ast::il_normal);
     let link_name = none;
-    if p.peek() == token::EQ { p.bump(); link_name = some(parse_str(p)); }
+    if p.peek() == token::EQ {
+        p.bump();
+        link_name = some(istr::from_estr(parse_str(p)));
+    }
     let hi = p.get_hi_pos();
     expect(p, token::SEMI);
     ret @{ident: t.ident,
@@ -2006,7 +2010,7 @@ fn parse_native_mod_items(p: &parser, native_name: &str,
         initial_attrs = [];
         items += [parse_native_item(p, attrs)];
     }
-    ret {native_name: native_name,
+    ret {native_name: istr::from_estr(native_name),
          abi: abi,
          view_items: view_items,
          items: items};
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 530b16a2037..9fff1a8be80 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -371,7 +371,11 @@ fn print_native_item(s: &ps, item: &@ast::native_item) {
                  decl.constraints);
         alt lname {
           none. { }
-          some(ss) { space(s.s); word_space(s, "="); print_string(s, ss); }
+          some(ss) {
+            space(s.s);
+            word_space(s, "=");
+            print_string(s, istr::to_estr(ss));
+          }
         }
         end(s); // end head-ibox
         word(s.s, ";");
@@ -426,9 +430,9 @@ fn print_item(s: &ps, item: &@ast::item) {
         }
         word_nbsp(s, "mod");
         word_nbsp(s, istr::to_estr(item.ident));
-        if !str::eq(nmod.native_name, istr::to_estr(item.ident)) {
+        if !istr::eq(nmod.native_name, item.ident) {
             word_space(s, "=");
-            print_string(s, nmod.native_name);
+            print_string(s, istr::to_estr(nmod.native_name));
             nbsp(s);
         }
         bopen(s);
@@ -1505,7 +1509,7 @@ fn print_literal(s: &ps, lit: &@ast::lit) {
     alt lit.node {
       ast::lit_str(st, kind) {
         if kind == ast::sk_unique { word(s.s, "~"); }
-        print_string(s, st);
+        print_string(s, istr::to_estr(st));
       }
       ast::lit_char(ch) {
         word(s.s,
@@ -1514,14 +1518,14 @@ fn print_literal(s: &ps, lit: &@ast::lit) {
       }
       ast::lit_int(val) { word(s.s, istr::to_estr(int::str(val))); }
       ast::lit_uint(val) { word(s.s, istr::to_estr(uint::str(val)) + "u"); }
-      ast::lit_float(fstr) { word(s.s, fstr); }
+      ast::lit_float(fstr) { word(s.s, istr::to_estr(fstr)); }
       ast::lit_mach_int(mach, val) {
         word(s.s, istr::to_estr(int::str(val as int)));
         word(s.s, ast_util::ty_mach_to_str(mach));
       }
       ast::lit_mach_float(mach, val) {
         // val is already a str
-        word(s.s, val);
+        word(s.s, istr::to_estr(val));
         word(s.s, ast_util::ty_mach_to_str(mach));
       }
       ast::lit_nil. { word(s.s, "()"); }