about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-01 17:27:58 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-01 17:27:58 -0700
commitab6bb035e50f735cb36cc1959e5a097f076a3b74 (patch)
tree21cb2954ef9cfe15134fec56f8888ddefce771bf /src/comp/syntax/parse
parent913667ba2550cbc6b8673580ef90d025d4abd205 (diff)
downloadrust-ab6bb035e50f735cb36cc1959e5a097f076a3b74.tar.gz
rust-ab6bb035e50f735cb36cc1959e5a097f076a3b74.zip
Rename std::istr to std::str. Issue #855
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/eval.rs2
-rw-r--r--src/comp/syntax/parse/lexer.rs56
-rw-r--r--src/comp/syntax/parse/parser.rs28
-rw-r--r--src/comp/syntax/parse/token.rs6
4 files changed, 46 insertions, 46 deletions
diff --git a/src/comp/syntax/parse/eval.rs b/src/comp/syntax/parse/eval.rs
index 6318c4c769b..ee7c5a3d338 100644
--- a/src/comp/syntax/parse/eval.rs
+++ b/src/comp/syntax/parse/eval.rs
@@ -1,5 +1,5 @@
 
-import std::istr;
+import std::str;
 import std::option;
 import std::option::some;
 import std::option::none;
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index 37eddf59abe..57720422306 100644
--- a/src/comp/syntax/parse/lexer.rs
+++ b/src/comp/syntax/parse/lexer.rs
@@ -2,7 +2,7 @@
 import std::io;
 import std::int;
 import std::vec;
-import std::istr;
+import std::str;
 import std::map;
 import std::map::hashmap;
 import std::option;
@@ -44,19 +44,19 @@ fn new_reader(cm: &codemap::codemap, src: &istr, filemap: codemap::filemap,
         fn get_str_from(start: uint) -> istr {
             // I'm pretty skeptical about this subtraction. What if there's a
             // multi-byte character before the mark?
-            ret istr::slice(src, start - 1u, pos - 1u);
+            ret str::slice(src, start - 1u, pos - 1u);
         }
         fn get_chpos() -> uint { ret chpos; }
         fn get_byte_pos() -> uint { ret pos; }
         fn curr() -> char { ret ch; }
         fn next() -> char {
             if pos < len {
-                ret istr::char_at(src, pos);
+                ret str::char_at(src, pos);
             } else { ret -1 as char; }
         }
         fn init() {
             if pos < len {
-                let next = istr::char_range_at(src, pos);
+                let next = str::char_range_at(src, pos);
                 pos = next.next;
                 ch = next.ch;
             }
@@ -69,7 +69,7 @@ fn new_reader(cm: &codemap::codemap, src: &istr, filemap: codemap::filemap,
                     codemap::next_line(fm, chpos, pos + fm.start_pos.byte);
                     col = 0u;
                 }
-                let next = istr::char_range_at(src, pos);
+                let next = str::char_range_at(src, pos);
                 pos = next.next;
                 ch = next.ch;
             } else { ch = -1 as char; }
@@ -85,7 +85,7 @@ fn new_reader(cm: &codemap::codemap, src: &istr, filemap: codemap::filemap,
     }
     let strs: [istr] = [];
     let rd =
-        reader(cm, src, istr::byte_len(src), 0u, 0u, -1 as char,
+        reader(cm, src, str::byte_len(src), 0u, 0u, -1 as char,
                filemap.start_pos.ch, strs, filemap, itr);
     rd.init();
     ret rd;
@@ -178,15 +178,15 @@ fn scan_exponent(rdr: &reader) -> option::t<istr> {
     let c = rdr.curr();
     let rslt = ~"";
     if c == 'e' || c == 'E' {
-        rslt += istr::unsafe_from_bytes([c as u8]);
+        rslt += str::unsafe_from_bytes([c as u8]);
         rdr.bump();
         c = rdr.curr();
         if c == '-' || c == '+' {
-            rslt += istr::unsafe_from_bytes([c as u8]);
+            rslt += str::unsafe_from_bytes([c as u8]);
             rdr.bump();
         }
         let exponent = scan_dec_digits(rdr);
-        if istr::byte_len(exponent) > 0u {
+        if str::byte_len(exponent) > 0u {
             ret some(rslt + exponent);
         } else { rdr.err(~"scan_exponent: bad fp literal"); fail; }
     } else { ret none::<istr>; }
@@ -196,7 +196,7 @@ fn scan_dec_digits(rdr: &reader) -> istr {
     let c = rdr.curr();
     let rslt: istr = ~"";
     while is_dec_digit(c) || c == '_' {
-        if c != '_' { rslt += istr::unsafe_from_bytes([c as u8]); }
+        if c != '_' { rslt += str::unsafe_from_bytes([c as u8]); }
         rdr.bump();
         c = rdr.curr();
     }
@@ -348,11 +348,11 @@ fn next_token_inner(rdr: &reader) -> token::token {
     let c = rdr.curr();
     if is_alpha(c) || c == '_' {
         while is_alnum(c) || c == '_' {
-            istr::push_char(accum_str, c);
+            str::push_char(accum_str, c);
             rdr.bump();
             c = rdr.curr();
         }
-        if istr::eq(accum_str, ~"_") { ret token::UNDERSCORE; }
+        if str::eq(accum_str, ~"_") { ret token::UNDERSCORE; }
         let is_mod_name = c == ':' && rdr.next() == ':';
         ret token::IDENT(interner::intern::<istr>(
             *rdr.get_interner(),
@@ -493,20 +493,20 @@ fn next_token_inner(rdr: &reader) -> token::token {
                 let escaped = rdr.curr();
                 rdr.bump();
                 alt escaped {
-                  'n' { istr::push_byte(accum_str, '\n' as u8); }
-                  'r' { istr::push_byte(accum_str, '\r' as u8); }
-                  't' { istr::push_byte(accum_str, '\t' as u8); }
-                  '\\' { istr::push_byte(accum_str, '\\' as u8); }
-                  '"' { istr::push_byte(accum_str, '"' as u8); }
+                  'n' { str::push_byte(accum_str, '\n' as u8); }
+                  'r' { str::push_byte(accum_str, '\r' as u8); }
+                  't' { str::push_byte(accum_str, '\t' as u8); }
+                  '\\' { str::push_byte(accum_str, '\\' as u8); }
+                  '"' { str::push_byte(accum_str, '"' as u8); }
                   '\n' { consume_whitespace(rdr); }
                   'x' {
-                    istr::push_char(accum_str, scan_numeric_escape(rdr, 2u));
+                    str::push_char(accum_str, scan_numeric_escape(rdr, 2u));
                   }
                   'u' {
-                    istr::push_char(accum_str, scan_numeric_escape(rdr, 4u));
+                    str::push_char(accum_str, scan_numeric_escape(rdr, 4u));
                   }
                   'U' {
-                    istr::push_char(accum_str, scan_numeric_escape(rdr, 8u));
+                    str::push_char(accum_str, scan_numeric_escape(rdr, 8u));
                   }
                   c2 {
                     rdr.err(
@@ -516,7 +516,7 @@ fn next_token_inner(rdr: &reader) -> token::token {
                   }
                 }
               }
-              _ { istr::push_char(accum_str, ch); }
+              _ { str::push_char(accum_str, ch); }
             }
         }
         rdr.bump();
@@ -569,7 +569,7 @@ type cmnt = {style: cmnt_style, lines: [istr], pos: uint};
 fn read_to_eol(rdr: &reader) -> istr {
     let val = ~"";
     while rdr.curr() != '\n' && !rdr.is_eof() {
-        istr::push_char(val, rdr.curr());
+        str::push_char(val, rdr.curr());
         rdr.bump();
     }
     if rdr.curr() == '\n' { rdr.bump(); }
@@ -634,8 +634,8 @@ fn trim_whitespace_prefix_and_push_line(lines: &mutable [istr], s: &istr,
                                         col: uint) {
     let s1;
     if all_whitespace(s, 0u, col) {
-        if col < istr::byte_len(s) {
-            s1 = istr::slice(s, col, istr::byte_len(s));
+        if col < str::byte_len(s) {
+            s1 = str::slice(s, col, str::byte_len(s));
         } else { s1 = ~""; }
     } else { s1 = s; }
     log ~"pushing line: " + s1;
@@ -659,7 +659,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt {
             curr_line = ~"";
             rdr.bump();
         } else {
-            istr::push_char(curr_line, rdr.curr());
+            str::push_char(curr_line, rdr.curr());
             if rdr.curr() == '/' && rdr.next() == '*' {
                 rdr.bump();
                 rdr.bump();
@@ -675,7 +675,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt {
             }
         }
     }
-    if istr::byte_len(curr_line) != 0u {
+    if str::byte_len(curr_line) != 0u {
         trim_whitespace_prefix_and_push_line(lines, curr_line, col);
     }
     let style = if code_to_the_left { trailing } else { isolated };
@@ -722,8 +722,8 @@ type lit = {lit: istr, pos: uint};
 fn gather_comments_and_literals(cm: &codemap::codemap, path: &istr,
                                 srdr: io::reader) ->
    {cmnts: [cmnt], lits: [lit]} {
-    let src = istr::unsafe_from_bytes(srdr.read_whole_stream());
-    let itr = @interner::mk::<istr>(istr::hash, istr::eq);
+    let src = str::unsafe_from_bytes(srdr.read_whole_stream());
+    let itr = @interner::mk::<istr>(str::hash, str::eq);
     let rdr = new_reader(cm, src,
                          codemap::new_filemap(
                              path, 0u, 0u), itr);
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index e22ebeb78d3..763172c81fa 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1,7 +1,7 @@
 
 import std::io;
 import std::vec;
-import std::istr;
+import std::str;
 import std::option;
 import std::option::some;
 import std::option::none;
@@ -66,7 +66,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: &ast::crate_cfg, path: &istr,
     let filemap = codemap::new_filemap(
         path, chpos, byte_pos);
     sess.cm.files += [filemap];
-    let itr = @interner::mk(istr::hash, istr::eq);
+    let itr = @interner::mk(str::hash, str::eq);
     let rdr = lexer::new_reader(sess.cm, src, filemap, itr);
     ret new_parser(sess, cfg, rdr, ftype);
 }
@@ -247,7 +247,7 @@ fn eat(p: &parser, tok: &token::token) -> bool {
 
 fn is_word(p: &parser, word: &istr) -> bool {
     ret alt p.peek() {
-          token::IDENT(sid, false) { istr::eq(word, p.get_str(sid)) }
+          token::IDENT(sid, false) { str::eq(word, p.get_str(sid)) }
           _ { false }
         };
 }
@@ -255,7 +255,7 @@ fn is_word(p: &parser, word: &istr) -> bool {
 fn eat_word(p: &parser, word: &istr) -> bool {
     alt p.peek() {
       token::IDENT(sid, false) {
-        if istr::eq(word, p.get_str(sid)) {
+        if str::eq(word, p.get_str(sid)) {
             p.bump();
             ret true;
         } else { ret false; }
@@ -2036,14 +2036,14 @@ fn parse_item_native_mod(p: &parser, attrs: &[ast::attribute]) -> @ast::item {
     let abi = ast::native_abi_cdecl;
     if !is_word(p, ~"mod") {
         let t = parse_str(p);
-        if istr::eq(t, ~"cdecl") {
-        } else if istr::eq(t, ~"rust") {
+        if str::eq(t, ~"cdecl") {
+        } else if str::eq(t, ~"rust") {
             abi = ast::native_abi_rust;
-        } else if istr::eq(t, ~"llvm") {
+        } else if str::eq(t, ~"llvm") {
             abi = ast::native_abi_llvm;
-        } else if istr::eq(t, ~"rust-intrinsic") {
+        } else if str::eq(t, ~"rust-intrinsic") {
             abi = ast::native_abi_rust_intrinsic;
-        } else if istr::eq(t, ~"x86stdcall") {
+        } else if str::eq(t, ~"x86stdcall") {
             abi = ast::native_abi_x86stdcall;
         } else { p.fatal(~"unsupported abi: " + t); }
     }
@@ -2419,8 +2419,8 @@ fn is_view_item(p: &parser) -> bool {
     alt p.peek() {
       token::IDENT(sid, false) {
         let st = p.get_str(sid);
-        ret istr::eq(st, ~"use") || istr::eq(st, ~"import") ||
-                istr::eq(st, ~"export");
+        ret str::eq(st, ~"use") || str::eq(st, ~"import") ||
+                str::eq(st, ~"export");
       }
       _ { ret false; }
     }
@@ -2450,7 +2450,7 @@ fn parse_crate_from_source_str(name: &istr, source: &istr,
     let ftype = SOURCE_FILE;
     let filemap = codemap::new_filemap(name, 0u, 0u);
     sess.cm.files += [filemap];
-    let itr = @interner::mk(istr::hash, istr::eq);
+    let itr = @interner::mk(str::hash, str::eq);
     let rdr = lexer::new_reader(sess.cm, source,
                                 filemap, itr);
     let p = new_parser(sess, cfg, rdr, ftype);
@@ -2588,9 +2588,9 @@ fn parse_crate_from_crate_file(input: &istr, cfg: &ast::crate_cfg,
 
 fn parse_crate_from_file(input: &istr, cfg: &ast::crate_cfg,
                          sess: &parse_sess) -> @ast::crate {
-    if istr::ends_with(input, ~".rc") {
+    if str::ends_with(input, ~".rc") {
         parse_crate_from_crate_file(input, cfg, sess)
-    } else if istr::ends_with(input, ~".rs") {
+    } else if str::ends_with(input, ~".rs") {
         parse_crate_from_source_file(input, cfg, sess)
     } else {
         codemap::emit_error(none, ~"unknown input file type: "
diff --git a/src/comp/syntax/parse/token.rs b/src/comp/syntax/parse/token.rs
index 6ae2affdb04..24d2a3b9a6f 100644
--- a/src/comp/syntax/parse/token.rs
+++ b/src/comp/syntax/parse/token.rs
@@ -5,7 +5,7 @@ import std::map::new_str_hash;
 import util::interner;
 import std::int;
 import std::uint;
-import std::istr;
+import std::str;
 
 type str_num = uint;
 
@@ -166,8 +166,8 @@ fn to_str(r: lexer::reader, t: token) -> istr {
       LIT_CHAR(c) {
         // FIXME: escape.
         let tmp = ~"'";
-        istr::push_char(tmp, c);
-        istr::push_byte(tmp, '\'' as u8);
+        str::push_char(tmp, c);
+        str::push_byte(tmp, '\'' as u8);
         ret tmp;
       }
       LIT_BOOL(b) { if b { ret ~"true"; } else { ret ~"false"; } }