about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorRicho Healey <richo@psych0tik.net>2014-05-22 16:57:53 -0700
committerRicho Healey <richo@psych0tik.net>2014-05-24 21:48:10 -0700
commit553074506ecd139eb961fb91eb33ad9fd0183acb (patch)
tree01682cf8147183250713acf5e8a77265aab7153c /src/libsyntax/parse
parentbbb70cdd9cd982922cf7390459d53bde409699ae (diff)
downloadrust-553074506ecd139eb961fb91eb33ad9fd0183acb.tar.gz
rust-553074506ecd139eb961fb91eb33ad9fd0183acb.zip
core: rename strbuf::StrBuf to string::String
[breaking-change]
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/comments.rs34
-rw-r--r--src/libsyntax/parse/lexer.rs12
-rw-r--r--src/libsyntax/parse/mod.rs40
-rw-r--r--src/libsyntax/parse/parser.rs20
-rw-r--r--src/libsyntax/parse/token.rs12
5 files changed, 59 insertions, 59 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 63b1bf44061..907e89622d0 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -19,7 +19,7 @@ use parse::token;
 
 use std::io;
 use std::str;
-use std::strbuf::StrBuf;
+use std::string::String;
 use std::uint;
 
 #[deriving(Clone, Eq)]
@@ -33,7 +33,7 @@ pub enum CommentStyle {
 #[deriving(Clone)]
 pub struct Comment {
     pub style: CommentStyle,
-    pub lines: Vec<StrBuf>,
+    pub lines: Vec<String>,
     pub pos: BytePos,
 }
 
@@ -53,9 +53,9 @@ pub fn doc_comment_style(comment: &str) -> ast::AttrStyle {
     }
 }
 
-pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf {
+pub fn strip_doc_comment_decoration(comment: &str) -> String {
     /// remove whitespace-only lines from the start/end of lines
-    fn vertical_trim(lines: Vec<StrBuf> ) -> Vec<StrBuf> {
+    fn vertical_trim(lines: Vec<String> ) -> Vec<String> {
         let mut i = 0u;
         let mut j = lines.len();
         // first line of all-stars should be omitted
@@ -81,7 +81,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf {
     }
 
     /// remove a "[ \t]*\*" block from each line, if possible
-    fn horizontal_trim(lines: Vec<StrBuf> ) -> Vec<StrBuf> {
+    fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {
         let mut i = uint::MAX;
         let mut can_trim = true;
         let mut first = true;
@@ -130,7 +130,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf {
         let lines = comment.slice(3u, comment.len() - 2u)
             .lines_any()
             .map(|s| s.to_strbuf())
-            .collect::<Vec<StrBuf> >();
+            .collect::<Vec<String> >();
 
         let lines = vertical_trim(lines);
         let lines = horizontal_trim(lines);
@@ -141,8 +141,8 @@ pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf {
     fail!("not a doc-comment: {}", comment);
 }
 
-fn read_to_eol(rdr: &mut StringReader) -> StrBuf {
-    let mut val = StrBuf::new();
+fn read_to_eol(rdr: &mut StringReader) -> String {
+    let mut val = String::new();
     while !rdr.curr_is('\n') && !is_eof(rdr) {
         val.push_char(rdr.curr.unwrap());
         bump(rdr);
@@ -151,7 +151,7 @@ fn read_to_eol(rdr: &mut StringReader) -> StrBuf {
     return val
 }
 
-fn read_one_line_comment(rdr: &mut StringReader) -> StrBuf {
+fn read_one_line_comment(rdr: &mut StringReader) -> String {
     let val = read_to_eol(rdr);
     assert!((val.as_slice()[0] == '/' as u8 &&
                 val.as_slice()[1] == '/' as u8) ||
@@ -202,7 +202,7 @@ fn read_line_comments(rdr: &mut StringReader, code_to_the_left: bool,
                       comments: &mut Vec<Comment>) {
     debug!(">>> line comments");
     let p = rdr.last_pos;
-    let mut lines: Vec<StrBuf> = Vec::new();
+    let mut lines: Vec<String> = Vec::new();
     while rdr.curr_is('/') && nextch_is(rdr, '/') {
         let line = read_one_line_comment(rdr);
         debug!("{}", line);
@@ -241,8 +241,8 @@ fn all_whitespace(s: &str, col: CharPos) -> Option<uint> {
     return Some(cursor);
 }
 
-fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<StrBuf> ,
-                                        s: StrBuf, col: CharPos) {
+fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,
+                                        s: String, col: CharPos) {
     let len = s.len();
     let s1 = match all_whitespace(s.as_slice(), col) {
         Some(col) => {
@@ -263,12 +263,12 @@ fn read_block_comment(rdr: &mut StringReader,
                       comments: &mut Vec<Comment> ) {
     debug!(">>> block comment");
     let p = rdr.last_pos;
-    let mut lines: Vec<StrBuf> = Vec::new();
+    let mut lines: Vec<String> = Vec::new();
     let col = rdr.col;
     bump(rdr);
     bump(rdr);
 
-    let mut curr_line = StrBuf::from_str("/*");
+    let mut curr_line = String::from_str("/*");
 
     // doc-comments are not really comments, they are attributes
     if (rdr.curr_is('*') && !nextch_is(rdr, '*')) || rdr.curr_is('!') {
@@ -297,7 +297,7 @@ fn read_block_comment(rdr: &mut StringReader,
                 trim_whitespace_prefix_and_push_line(&mut lines,
                                                      curr_line,
                                                      col);
-                curr_line = StrBuf::new();
+                curr_line = String::new();
                 bump(rdr);
             } else {
                 curr_line.push_char(rdr.curr.unwrap());
@@ -356,7 +356,7 @@ fn consume_comment(rdr: &mut StringReader,
 
 #[deriving(Clone)]
 pub struct Literal {
-    pub lit: StrBuf,
+    pub lit: String,
     pub pos: BytePos,
 }
 
@@ -364,7 +364,7 @@ pub struct Literal {
 // probably not a good thing.
 pub fn gather_comments_and_literals(span_diagnostic:
                                         &diagnostic::SpanHandler,
-                                    path: StrBuf,
+                                    path: String,
                                     srdr: &mut io::Reader)
                                  -> (Vec<Comment>, Vec<Literal>) {
     let src = srdr.read_to_end().unwrap();
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 34116c3a4be..e045116c9e2 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -424,10 +424,10 @@ fn consume_block_comment(rdr: &mut StringReader) -> Option<TokenAndSpan> {
     if res.is_some() { res } else { consume_whitespace_and_comments(rdr) }
 }
 
-fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option<StrBuf> {
+fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option<String> {
     // \x00 hits the `return None` case immediately, so this is fine.
     let mut c = rdr.curr.unwrap_or('\x00');
-    let mut rslt = StrBuf::new();
+    let mut rslt = String::new();
     if c == 'e' || c == 'E' {
         rslt.push_char(c);
         bump(rdr);
@@ -449,8 +449,8 @@ fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option<StrBuf>
     }
 }
 
-fn scan_digits(rdr: &mut StringReader, radix: uint) -> StrBuf {
-    let mut rslt = StrBuf::new();
+fn scan_digits(rdr: &mut StringReader, radix: uint) -> String {
+    let mut rslt = String::new();
     loop {
         let c = rdr.curr;
         if c == Some('_') { bump(rdr); continue; }
@@ -858,7 +858,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
         return token::LIT_CHAR(c2);
       }
       '"' => {
-        let mut accum_str = StrBuf::new();
+        let mut accum_str = String::new();
         let start_bpos = rdr.last_pos;
         bump(rdr);
         while !rdr.curr_is('"') {
@@ -1002,7 +1002,7 @@ mod test {
 
     // open a string reader for the given string
     fn setup<'a>(span_handler: &'a diagnostic::SpanHandler,
-                 teststr: StrBuf) -> StringReader<'a> {
+                 teststr: String) -> StringReader<'a> {
         let fm = span_handler.cm.new_filemap("zebra.rs".to_strbuf(), teststr);
         new_string_reader(span_handler, fm)
     }
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 31a67ff92f5..c4947b528f1 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -77,8 +77,8 @@ pub fn parse_crate_attrs_from_file(
     inner
 }
 
-pub fn parse_crate_from_source_str(name: StrBuf,
-                                   source: StrBuf,
+pub fn parse_crate_from_source_str(name: String,
+                                   source: String,
                                    cfg: ast::CrateConfig,
                                    sess: &ParseSess)
                                    -> ast::Crate {
@@ -89,8 +89,8 @@ pub fn parse_crate_from_source_str(name: StrBuf,
     maybe_aborted(p.parse_crate_mod(),p)
 }
 
-pub fn parse_crate_attrs_from_source_str(name: StrBuf,
-                                         source: StrBuf,
+pub fn parse_crate_attrs_from_source_str(name: String,
+                                         source: String,
                                          cfg: ast::CrateConfig,
                                          sess: &ParseSess)
                                          -> Vec<ast::Attribute> {
@@ -102,8 +102,8 @@ pub fn parse_crate_attrs_from_source_str(name: StrBuf,
     inner
 }
 
-pub fn parse_expr_from_source_str(name: StrBuf,
-                                  source: StrBuf,
+pub fn parse_expr_from_source_str(name: String,
+                                  source: String,
                                   cfg: ast::CrateConfig,
                                   sess: &ParseSess)
                                   -> @ast::Expr {
@@ -111,8 +111,8 @@ pub fn parse_expr_from_source_str(name: StrBuf,
     maybe_aborted(p.parse_expr(), p)
 }
 
-pub fn parse_item_from_source_str(name: StrBuf,
-                                  source: StrBuf,
+pub fn parse_item_from_source_str(name: String,
+                                  source: String,
                                   cfg: ast::CrateConfig,
                                   sess: &ParseSess)
                                   -> Option<@ast::Item> {
@@ -121,8 +121,8 @@ pub fn parse_item_from_source_str(name: StrBuf,
     maybe_aborted(p.parse_item(attrs),p)
 }
 
-pub fn parse_meta_from_source_str(name: StrBuf,
-                                  source: StrBuf,
+pub fn parse_meta_from_source_str(name: String,
+                                  source: String,
                                   cfg: ast::CrateConfig,
                                   sess: &ParseSess)
                                   -> @ast::MetaItem {
@@ -130,8 +130,8 @@ pub fn parse_meta_from_source_str(name: StrBuf,
     maybe_aborted(p.parse_meta_item(),p)
 }
 
-pub fn parse_stmt_from_source_str(name: StrBuf,
-                                  source: StrBuf,
+pub fn parse_stmt_from_source_str(name: String,
+                                  source: String,
                                   cfg: ast::CrateConfig,
                                   attrs: Vec<ast::Attribute> ,
                                   sess: &ParseSess)
@@ -145,8 +145,8 @@ pub fn parse_stmt_from_source_str(name: StrBuf,
     maybe_aborted(p.parse_stmt(attrs),p)
 }
 
-pub fn parse_tts_from_source_str(name: StrBuf,
-                                 source: StrBuf,
+pub fn parse_tts_from_source_str(name: String,
+                                 source: String,
                                  cfg: ast::CrateConfig,
                                  sess: &ParseSess)
                                  -> Vec<ast::TokenTree> {
@@ -164,8 +164,8 @@ pub fn parse_tts_from_source_str(name: StrBuf,
 // Create a new parser from a source string
 pub fn new_parser_from_source_str<'a>(sess: &'a ParseSess,
                                       cfg: ast::CrateConfig,
-                                      name: StrBuf,
-                                      source: StrBuf)
+                                      name: String,
+                                      source: String)
                                       -> Parser<'a> {
     filemap_to_parser(sess, string_to_filemap(sess, source, name), cfg)
 }
@@ -185,7 +185,7 @@ pub fn new_sub_parser_from_file<'a>(sess: &'a ParseSess,
                                     cfg: ast::CrateConfig,
                                     path: &Path,
                                     owns_directory: bool,
-                                    module_name: Option<StrBuf>,
+                                    module_name: Option<String>,
                                     sp: Span) -> Parser<'a> {
     let mut p = filemap_to_parser(sess, file_to_filemap(sess, path, Some(sp)), cfg);
     p.owns_directory = owns_directory;
@@ -244,7 +244,7 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
 
 // given a session and a string, add the string to
 // the session's codemap and return the new filemap
-pub fn string_to_filemap(sess: &ParseSess, source: StrBuf, path: StrBuf)
+pub fn string_to_filemap(sess: &ParseSess, source: String, path: String)
                          -> Rc<FileMap> {
     sess.span_diagnostic.cm.new_filemap(path, source)
 }
@@ -293,7 +293,7 @@ mod test {
     use util::parser_testing::{string_to_expr, string_to_item};
     use util::parser_testing::string_to_stmt;
 
-    fn to_json_str<'a, E: Encodable<json::Encoder<'a>, io::IoError>>(val: &E) -> StrBuf {
+    fn to_json_str<'a, E: Encodable<json::Encoder<'a>, io::IoError>>(val: &E) -> String {
         let mut writer = MemWriter::new();
         let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
         let _ = val.encode(&mut encoder);
@@ -709,7 +709,7 @@ mod test {
 
     #[test] fn attrs_fix_bug () {
         string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
-                   -> Result<@Writer, StrBuf> {
+                   -> Result<@Writer, String> {
     #[cfg(windows)]
     fn wb() -> c_int {
       (O_WRONLY | libc::consts::os::extra::O_BINARY) as c_int
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index ae104707284..bfdf0361f05 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -79,7 +79,7 @@ use owned_slice::OwnedSlice;
 use collections::HashSet;
 use std::mem::replace;
 use std::rc::Rc;
-use std::strbuf::StrBuf;
+use std::string::String;
 
 #[allow(non_camel_case_types)]
 #[deriving(Eq)]
@@ -350,7 +350,7 @@ pub struct Parser<'a> {
     /// Name of the root module this parser originated from. If `None`, then the
     /// name is not known. This does not change while the parser is descending
     /// into modules, and sub-parsers have new values for this name.
-    pub root_module_name: Option<StrBuf>,
+    pub root_module_name: Option<String>,
 }
 
 fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
@@ -359,12 +359,12 @@ fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
 
 impl<'a> Parser<'a> {
     // convert a token to a string using self's reader
-    pub fn token_to_str(token: &token::Token) -> StrBuf {
+    pub fn token_to_str(token: &token::Token) -> String {
         token::to_str(token)
     }
 
     // convert the current token to a string using self's reader
-    pub fn this_token_to_str(&mut self) -> StrBuf {
+    pub fn this_token_to_str(&mut self) -> String {
         Parser::token_to_str(&self.token)
     }
 
@@ -399,7 +399,7 @@ impl<'a> Parser<'a> {
     pub fn expect_one_of(&mut self,
                          edible: &[token::Token],
                          inedible: &[token::Token]) {
-        fn tokens_to_str(tokens: &[token::Token]) -> StrBuf {
+        fn tokens_to_str(tokens: &[token::Token]) -> String {
             let mut i = tokens.iter();
             // This might be a sign we need a connect method on Iterator.
             let b = i.next()
@@ -3883,7 +3883,7 @@ impl<'a> Parser<'a> {
         (ident, ItemImpl(generics, opt_trait, ty, meths), Some(inner_attrs))
     }
 
-    // parse a::B<StrBuf,int>
+    // parse a::B<String,int>
     fn parse_trait_ref(&mut self) -> TraitRef {
         ast::TraitRef {
             path: self.parse_path(LifetimeAndTypesWithoutColons).path,
@@ -3891,7 +3891,7 @@ impl<'a> Parser<'a> {
         }
     }
 
-    // parse B + C<StrBuf,int> + D
+    // parse B + C<String,int> + D
     fn parse_trait_ref_list(&mut self, ket: &token::Token) -> Vec<TraitRef> {
         self.parse_seq_to_before_end(
             ket,
@@ -4214,12 +4214,12 @@ impl<'a> Parser<'a> {
     fn eval_src_mod_from_path(&mut self,
                               path: Path,
                               owns_directory: bool,
-                              name: StrBuf,
+                              name: String,
                               id_sp: Span) -> (ast::Item_, Vec<ast::Attribute> ) {
         let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
         match included_mod_stack.iter().position(|p| *p == path) {
             Some(i) => {
-                let mut err = StrBuf::from_str("circular modules: ");
+                let mut err = String::from_str("circular modules: ");
                 let len = included_mod_stack.len();
                 for p in included_mod_stack.slice(i, len).iter() {
                     err.push_str(p.display().as_maybe_owned().as_slice());
@@ -4808,7 +4808,7 @@ impl<'a> Parser<'a> {
 
         // FAILURE TO PARSE ITEM
         if visibility != Inherited {
-            let mut s = StrBuf::from_str("unmatched visibility `");
+            let mut s = String::from_str("unmatched visibility `");
             if visibility == Public {
                 s.push_str("pub")
             } else {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 17ce03ba213..e3788801293 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -21,7 +21,7 @@ use std::fmt;
 use std::path::BytesContainer;
 use std::mem;
 use std::rc::Rc;
-use std::strbuf::StrBuf;
+use std::string::String;
 
 #[allow(non_camel_case_types)]
 #[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)]
@@ -136,7 +136,7 @@ impl fmt::Show for Nonterminal {
     }
 }
 
-pub fn binop_to_str(o: BinOp) -> StrBuf {
+pub fn binop_to_str(o: BinOp) -> String {
     match o {
       PLUS => "+".to_strbuf(),
       MINUS => "-".to_strbuf(),
@@ -151,7 +151,7 @@ pub fn binop_to_str(o: BinOp) -> StrBuf {
     }
 }
 
-pub fn to_str(t: &Token) -> StrBuf {
+pub fn to_str(t: &Token) -> String {
     match *t {
       EQ => "=".to_strbuf(),
       LT => "<".to_strbuf(),
@@ -194,7 +194,7 @@ pub fn to_str(t: &Token) -> StrBuf {
 
       /* Literals */
       LIT_CHAR(c) => {
-          let mut res = StrBuf::from_str("'");
+          let mut res = String::from_str("'");
           c.escape_default(|c| {
               res.push_char(c);
           });
@@ -207,7 +207,7 @@ pub fn to_str(t: &Token) -> StrBuf {
                                                  ast_util::ForceSuffix),
       LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() }
       LIT_FLOAT(s, t) => {
-        let mut body = StrBuf::from_str(get_ident(s).get());
+        let mut body = String::from_str(get_ident(s).get());
         if body.as_slice().ends_with(".") {
             body.push_char('0');  // `10.f` is not a float literal
         }
@@ -215,7 +215,7 @@ pub fn to_str(t: &Token) -> StrBuf {
         body
       }
       LIT_FLOAT_UNSUFFIXED(s) => {
-        let mut body = StrBuf::from_str(get_ident(s).get());
+        let mut body = String::from_str(get_ident(s).get());
         if body.as_slice().ends_with(".") {
             body.push_char('0');  // `10.f` is not a float literal
         }