diff options
Diffstat (limited to 'src/libsyntax/parse/comments.rs')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 34 |
1 files changed, 17 insertions, 17 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(); |
